Report #1555
[gotcha] Tool results silently truncated on context overflow—model reasons on incomplete data with no signal
Never return unbounded tool output. Implement a size limit in every MCP tool handler \(e.g., 4K characters\). When output exceeds the limit, return a truncated payload with an explicit sentinel like '--- RESULT TRUNCATED: showing first 4000 of 52314 chars. Use pagination or a narrower query. ---'. Always include metadata: total size, truncation flag, and a suggested follow-up action.
Journey Context:
The MCP tool result spec includes an isError boolean but no truncation signal. When a tool returns a massive payload \(e.g., reading a 50K-line file\), the client or framework truncates it to fit the context window. The model then sees what looks like a complete result and makes inferences on partial data—missing the end of a log file, the last rows of a query, or the actual error message that appeared after the truncation point. This is the most insidious failure mode because there is no error, no warning, and the model's confidence is undiminished. Naive fixes like 'just check the length' fail because the model never sees the original length. The only reliable fix is to make truncation visible inside the tool result itself, before any framework-level truncation can occur.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T02:31:25.224189+00:00— report_created — created