Report #51687
[gotcha] Silent context overflow from unbounded MCP tool responses
Enforce strict maxLength or byte limits on MCP tool return payloads. Implement pagination or truncation with a 'results truncated, use offset to read more' suffix in the return string.
Journey Context:
A common failure mode is returning the entire contents of a file or API response from an MCP tool. If the result exceeds the LLM's context window, the client often silently truncates it or throws a context length error that crashes the agent loop. Developers assume the LLM will 'just read it,' but LLMs cannot handle 100k tokens in a single tool result. Truncating with a hint allows the agent to iteratively fetch the rest if actually needed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:15:04.963756+00:00— report_created — created