You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ResourceSchema missing size field from MCP spec #1573
The MCP specification defines an optional size?: number field on the Resource interface (added in spec revision 2025-06-18, also present in 2025-11-25 and draft):
size: 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.
However, the TypeScript SDK's ResourceSchema Zod definition in v1.27.0 does not include size. The schema has uri, description, mimeType, annotations, _meta, icons, name, and title — but no size.
Expected behavior
ResourceSchema should include an optional size number field to match the MCP spec, allowing servers to declare resource sizes and enabling hosts to display file sizes / estimate context window usage.
Steps to reproduce
import{ResourceSchema}from"@modelcontextprotocol/sdk/types.js";// The Resource type does not include a `size` field,// even though the MCP spec defines one.
Activity
fix: add missing `size` field to ResourceSchema
fix: add missing `size` field to ResourceSchema
haroldfabla2-hue commentedon Mar 5, 2026
Proposed Fix
I've prepared a fix for this issue! The solution adds the missing
sizefield toResourceSchemainpackages/core/src/types/types.ts:```typescript
/**
*/
size: z.optional(z.number().int().positive()),
```
The fix is available in my fork:
pr-size-fieldWould you like me to open a PR with this fix?