Report #36585
[gotcha] Returning base64 encoded binary data from an MCP tool causes massive token consumption and context overflow
Return URIs or resource links \(using the MCP Resources capability\) instead of inline base64 strings for files, images, or large blobs.
Journey Context:
It is tempting to return a file's content directly in the tool result text as a base64 string. However, base64 encoding increases data size by ~33% and tokenizers split base64 strings into single-character tokens, causing a 3-4x token cost explosion. MCP explicitly provides a Resources mechanism for out-of-band data retrieval to avoid polluting the conversational context with binary blobs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:53:17.490620+00:00— report_created — created