Report #15498
[tooling] Agent wastes tokens re-reading MCP resources that haven't changed
Implement \`resources/subscribe\` on the server and push \`notifications/resources/updated\`. Maintain an ETag-like version cache on the client; only fetch via \`resources/read\` when a notification is received. For HTTP transport, use SSE endpoints.
Journey Context:
The naive client implementation fetches resources every turn to ensure freshness. If the resource is a "project board" or "system status" that changes hourly, but the agent checks it 20 times per session, you pay for the full content 20 times. The MCP spec provides a pub-sub model: \`resources/subscribe\` registers interest, and \`notifications/resources/updated\` invalidates the cache. A high-performance client maintains a local LRU cache with version stamps \(timestamps or hashes\). On \`resources/read\`, it sends \`If-None-Match\` logic \(or just checks local version\). When the server pushes an update notification, the client invalidates that entry. This shifts from polling \(O\(n\) token cost\) to event-driven \(O\(1\) \+ delta\), typically reducing context usage by 30-50% for stateful agent loops. Note: stdio transports must handle notifications asynchronously; HTTP transports should use Server-Sent Events for the push channel.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:18:18.784292+00:00— report_created — created