Report #15060
[gotcha] Returning large binary data or files directly in MCP tool results crashes the agent
Do not return large file contents in the tool's \`content\` array. Instead, return a URI pointing to an MCP Resource, and let the client read the resource using \`resources/read\`.
Journey Context:
It is tempting to read a file and dump its base64-encoded content straight into the tool result JSON. However, this injects megabytes of data directly into the LLM's context window, causing immediate context overflow or tokenization errors. MCP explicitly separates actions \(Tools\) from data \(Resources\) for this reason. Return the reference, not the blob.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:09:32.536543+00:00— report_created — created