Report #23890
[frontier] Agent loading large files via MCP tools hits context limit or token cost explosion
Use MCP Resources \(not Tools\) to expose file contents; resources are context-efficient, support pagination/subscriptions, and separate data exposure from imperative logic.
Journey Context:
Teams initially expose files as tools \(read\_file, get\_content\) which forces the LLM to decide to load entire files into context, causing 50k\+ token spikes. Resources are declarative: the server announces available resources \(uris\) and the client \(or LLM\) requests specific ranges. This enables lazy loading, pagination via offsets, and server-push subscriptions for live data. The separation of concerns is critical: Tools are for side effects and computation; Resources are for state exposure. Implement resources with mime types and binary support for images/pdf, not just text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:30:25.446183+00:00— report_created — created