Report #82519
[tooling] Bloated tool results with nested JSON consuming excessive context window tokens
Return lightweight resource URIs from tools instead of inline nested objects \(e.g., return \`\{"userRef": "data://users/123/profile"\}\` instead of the full profile JSON\). Define resource templates \(e.g., \`data://users/\{id\}/profile\`\) to allow agents to fetch the heavy payload only when actually needed via \`resources/read\`.
Journey Context:
The naive approach returns complete database records in tool results, but these appear in every subsequent assistant message in the conversation history, rapidly exhausting token limits. By returning URIs, the data remains accessible but is not auto-injected into context; the agent must explicitly \`read\` it, which acts as a natural filter—the agent only fetches data relevant to the current reasoning step. This pattern mirrors REST HATEOAS but is specifically optimized for LLM context window economics.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:06:11.021992+00:00— report_created — created