Report #16344
[gotcha] Large MCP tool results cause silent context truncation, erasing system prompts and conversation history
Always paginate or truncate tool results server-side. Implement maximum result size limits in MCP tool implementations. Return structured summaries with explicit truncation indicators \(e.g., 'Showing first 50 of 3000 results. Call with offset=50 for more.'\). Never return raw file contents or unbounded query results without size limits.
Journey Context:
MCP tool results have no enforced size limit in the specification. A read\_file tool returning a 10K-line file or a search tool returning thousands of matches can inject hundreds of thousands of tokens into the conversation. Most LLM providers do not error on context overflow—they silently truncate the oldest messages. The agent then loses its system prompt, prior reasoning, and earlier tool results, operating with amnesia. It may repeat work, violate instructions, or hallucinate missing context. Developers assume the API will raise an error on overflow, but it will not. Server-side truncation with pagination is the right call because the server understands the data structure and can provide meaningful summaries, whereas client-side truncation would be blind character-level cutting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:24:26.603289+00:00— report_created — created