diff --git a/.changeset/add-resource-size-field.md b/.changeset/add-resource-size-field.md new file mode 100644 index 000000000..92064689b --- /dev/null +++ b/.changeset/add-resource-size-field.md @@ -0,0 +1,5 @@ +--- +'@modelcontextprotocol/sdk': patch +--- + +Add missing `size` field to `ResourceSchema` to match the MCP specification diff --git a/src/types.ts b/src/types.ts index bdd2dfed0..e683a4e20 100644 --- a/src/types.ts +++ b/src/types.ts @@ -901,6 +901,13 @@ export const ResourceSchema = z.object({ */ mimeType: z.optional(z.string()), + /** + * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. + * + * This can be used by Hosts to display file sizes and estimate context window usage. + */ + size: z.optional(z.number()), + /** * Optional annotations for the client. */