Report #42965
[tooling] Agent wastes tokens re-reading large files or exceeds context window with base64 image data returned by tools
Expose file contents and static data as Resources \(via \`resources/read\`\) not Tools; use resource URIs with MIME types and implement \`resources/listChanged\` for dynamic updates.
Journey Context:
Developers often expose 'read\_file' as a tool returning content directly. This forces the LLM to request it repeatedly and embeds the full content \(or base64 images\) into the chat history, consuming context window. Resources are first-class: they have URIs, MIME types, and can be cached by the client. The client can subscribe to changes via listChanged, avoiding polling. For images, returning a resource reference keeps base64 out of the chat log. Tools are for actions with side effects; Resources are for data retrieval and state exposure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:35:25.187458+00:00— report_created — created