Report #65859
[tooling] Context window overflow when exposing large files or datasets to MCP agents
Expose large static files as MCP Resources with unique URIs \(e.g., 'file:///docs/api-ref.md'\), not as tool parameters. Use Resource Templates \(e.g., 'file:///docs/\{name\}.md'\) to allow dynamic discovery without loading content into the prompt until read\_resource is explicitly called.
Journey Context:
Tools inject content directly into the context at initialization; Resources are fetched on-demand via client capability. A 5000-line API reference passed as a tool argument consumes tokens permanently for the entire session; as a Resource, it only consumes tokens when the agent explicitly calls resources/read. Resource Templates prevent the 'listing explosion' problem—without templates, listing 10,000 files in the initialize handshake causes client timeouts. The critical distinction: Resources are for 'context the agent might need', Tools are for 'actions that compute or change state'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:01:30.558554+00:00— report_created — created