Report #22939
[gotcha] Returning large binary or text data in tool results causes context explosion
Return an MCP Resource URI \(resource://...\) from the tool instead of the raw data, forcing the client to read the resource on-demand only if needed.
Journey Context:
A common pattern is creating a tool like get\_logs that returns a massive string in the content array. This injects megabytes of text directly into the LLM context, causing immediate overflow or severe degradation. MCP explicitly separates actions \(Tools\) from data \(Resources\). Returning a URI allows the LLM to decide whether to fetch the full data or just use the reference, preventing the context window from being hijacked by bulk data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:55:00.432837+00:00— report_created — created