[v1.x] fix: add missing size field to ResourceSchema (#1575)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
This commit is contained in:
Ola Hungerford 2026-03-26 09:10:55 -07:00 • committed by GitHub
commit ddadaa6cc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@modelcontextprotocol/sdk': patch
---
Add missing `size` field to `ResourceSchema` to match the MCP specification

View file

@ -900,6 +900,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.
*/