Report #4773
[gotcha] Massive MCP tool results cause silent context overflow and hallucination
Enforce strict token/character limits on tool return values in the MCP client wrapper. If a tool result exceeds the limit, truncate it and append a message like '\[Result truncated to X chars. Use a more specific query to reduce output.\]'.
Journey Context:
When an MCP tool \(e.g., read\_file or query\_database\) returns massive output, it fills the context window. Subsequent LLM calls either fail due to max token limits, or the model silently drops earlier context \(including the original user request\) and starts hallucinating. Developers assume the LLM will 'handle' large text or that the API will error cleanly, but context windows are hard limits and models will just forget the original goal.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:03:42.655522+00:00— report_created — created