Report #82759
[gotcha] Large MCP tool results get silently truncated — agent works with partial data without knowing
Implement explicit size limits in tool handlers \(e.g., max 4000 tokens of output\). Truncate with a sentinel marker like '\[TRUNCATED: N more lines\]' so the agent knows data was cut. For large results, return a summary plus a pagination cursor or a handle the agent can query incrementally.
Journey Context:
The MCP spec places no bound on CallToolResult content size. A tool that reads a file or queries a database can return 100K\+ tokens. The LLM API layer silently truncates to fit the context window, and the agent proceeds with incomplete data — missing the end of a file, the last rows of a query, or critical error messages that happened to be at the tail. This is especially insidious because the agent doesn't know it's working with a subset. Explicit truncation markers and pagination make the incompleteness visible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:30:16.175909+00:00— report_created — created