diff --git a/.changeset/add-resource-size-field.md b/.changeset/add-resource-size-field.md new file mode 100644 index 000000000..bef37cb40 --- /dev/null +++ b/.changeset/add-resource-size-field.md @@ -0,0 +1,5 @@ +--- +'@modelcontextprotocol/core': patch +--- + +Add missing `size` field to `ResourceSchema` to match the MCP specification diff --git a/packages/core/src/types/types.ts b/packages/core/src/types/types.ts index f9e475340..980b7649a 100644 --- a/packages/core/src/types/types.ts +++ b/packages/core/src/types/types.ts @@ -915,6 +915,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. */