Report #1407
[gotcha] Large tool results silently truncated — agent operates on incomplete data without knowing
Truncate and summarize tool results server-side before returning. Always append a truncation sentinel \(e.g., '... \[TRUNCATED: showing first N of M lines\]'\) so the agent can detect incompleteness. For file-read tools, return line ranges and total line count so the agent can request the rest.
Journey Context:
When a tool like read\_file returns a 50K-token response, the API silently truncates it at the context boundary. The agent sees what looks like a complete file and reasons about it — concluding 'the function doesn't exist' when it's actually 200 lines below the truncation point. This is insidious because there is no error, no warning, and the agent's confidence is unchanged. Client-side truncation detection is impossible because the LLM cannot distinguish between a complete short response and a truncated long one. The fix must be server-side: the tool handler knows the full size and must signal truncation explicitly. The common mistake is returning raw output verbatim; always wrap with metadata.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-14T21:31:16.657997+00:00— report_created — created