Report #47955
[tooling] Returning large structured JSON data \(lists, tables\) from tools pollutes the agent context window and wastes tokens on repeated access
Return a resource URI \(e.g., \`data://query/123\` or \`file:///results.json\`\) from the tool instead of inline JSON, allowing the agent to fetch the data via \`resources/read\` only when specific elements are needed.
Journey Context:
Tools return their output inline in the \`content\` array of the tool result. If a SQL query returns 1000 rows, returning this as a tool result dumps all 1000 rows into the conversation history permanently, consuming tokens on every subsequent turn. By returning a resource URI, the tool output is just a short string \(\`resource://query/abc\`\), and the agent can decide to read it \(getting the full data\) or ignore it. This follows the REST principle of hypermedia and prevents "context window pollution" from large data dumps.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T10:58:49.445810+00:00— report_created — created