-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Description
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.
The spec's JSON schema includes this field:
- https://modelcontextprotocol.io/specification/2025-06-18/schema —
Resourceinterface hassize?: number - https://modelcontextprotocol.io/specification/2025-11-25/schema — same
- https://modelcontextprotocol.io/specification/draft/schema — same
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.Environment
- SDK version: 1.27.0 (also checked 1.26.0)
- MCP spec revisions checked: 2025-06-18, 2025-11-25, draft
Note
This issue was written with the help of Claude Code (claude-opus-4-6).