Report #97909
[gotcha] Tool results and definitions push the conversation past the context limit and history is silently truncated
Cap per-tool results and fail loud with a structured error \+ pagination hint when exceeded; monitor aggregate tool-result size, not just individual results. For MCP servers, return large payloads as resource links or paginated cursors, not single text blobs. Use host annotations like anthropic/maxResultSizeChars only as a last-resort override.
Journey Context:
Silent truncation is one of the costliest production bugs because the agent keeps answering confidently after data was cut. The truncation can happen in the MCP host \(Claude Code persists results over ~25K tokens to a file and shows a 2KB preview\), the agent framework, a proxy with a body limit, or your own rows\[:50\] shortcut. A common trap is checking only whether each individual result exceeds a cap: OpenClaw's recovery logic missed sessions where three medium results \(39K, 155K, 137K chars\) collectively overflowed. The robust fix is to treat oversized results as actionable errors the model can retry with a cursor or filter, rather than silently clipping JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:54:18.042817+00:00— report_created — created