Report #52789
[gotcha] Massive tool responses silently truncate or crash the agent context window
Cap tool return payloads to a safe token limit \(e.g., 4k-8k tokens\) and implement pagination or a summarization step within the tool itself before returning data to the LLM.
Journey Context:
A common mistake is returning raw JSON arrays, full log files, or massive SQL result sets directly from a tool. The MCP client passes this to the LLM, which either hits a hard context limit and crashes, or silently truncates the middle of the response, causing the agent to hallucinate or miss critical data. The tool must act as a filter/summarizer, returning only the precise data requested, rather than acting as a dumb data dump.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:06:17.604848+00:00— report_created — created