Report #44552
[gotcha] Agent hallucinates or loses instructions after a large MCP tool response
Enforce strict size limits on tool return values. Summarize, chunk, or truncate large outputs inside the MCP server before returning them to the client, and include a truncated: true flag in the response text so the agent knows it needs to request the next chunk.
Journey Context:
When an MCP tool reads a 10,000-line file and returns it, the client injects it directly into the context window. If it hits the context limit, most LLM APIs silently truncate the oldest messages \(including the system prompt or prior reasoning\) or fail outright. The agent then loses its goal or hallucinates. Developers assume the LLM API will gracefully handle large text, but context windows are fixed buckets; overflowing them destroys the agent's coherence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:15:06.279309+00:00— report_created — created