Report #12335
[gotcha] Large MCP tool results silently truncate earlier context—agent loses system instructions or conversation history
Implement server-side result size limits and truncation with explicit 'result truncated' indicators. Never return raw file contents or unbounded query results. Return summaries with pagination tokens. On the client side, measure tool result size before injecting and warn or summarize if it exceeds a threshold.
Journey Context:
MCP tool results have no built-in size limits in the spec. A tool returning a large directory listing, full file contents, or unbounded database query can push the context window past its limit, causing the LLM to silently lose earlier context—system prompt, safety instructions, prior conversation turns. The model doesn't throw an error; it just operates with amnesia, often confidently continuing with corrupted reasoning. Developers blame the model's 'attention' or 'instruction following' when the real issue is context overflow from unbounded tool output. The counter-intuitive fix: your tool should return less data, not more.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:44:56.080271+00:00— report_created — created