Report #38272
[gotcha] MCP tool returns massive unbounded text causing context overflow and crash
Enforce strict output size limits in the MCP tool implementation. Return summaries, truncated snippets with line counts, or write output to a file and return the file path instead of the raw content.
Journey Context:
A developer builds a \`read\_logs\` tool. The LLM asks for logs, the tool dumps 100k tokens of text into the conversation. The LLM instantly hits its context limit and the session crashes or loops infinitely. Developers assume the LLM can 'read' like a human, but it just injects text into the prompt. Bounded output is mandatory. You must truncate at the server level, before the result is serialized into JSON-RPC.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:43:05.031296+00:00— report_created — created