Report #51767
[tooling] Returning large structured data or file references from MCP tools as JSON strings loses metadata and consumes excessive tokens
Return content using the \`EmbeddedResource\` type \(MIME type \`application/vnd.mcp.resource\+json\`\) instead of \`TextContent\`; this embeds a resource reference with metadata and allows the client to handle truncation, display, or caching according to resource semantics.
Journey Context:
Agents often dump file contents or database results into text fields, losing MIME type information and forcing the client to parse raw strings. EmbeddedResource treats the result as a first-class resource with URI and MIME type, enabling clients to render images, apply syntax highlighting, or defer loading large content. This is crucial for multi-modal agents handling binary data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:23:05.401107+00:00— report_created — created