Report #63790
[tooling] MCP server returns large file contents causing context overflow or rate limit exhaustion
Do not return file contents directly in tool results or resource reads. Instead, return a resource URI reference, or implement the sampling capability to let the client decide how to truncate/embed the content via sampling/createMessage.
Journey Context:
Servers often return entire file contents \(logs, JSON files, documents\) in tool results, assuming the client can handle arbitrary text. This blows up context windows and token costs. The sampling capability inverts this: the server asks the client 'how should I process this content', allowing the client to apply its own truncation, summarization, or RAG strategy. This respects the client's context limits and embedding strategies, essential for multi-step agent loops where raw content would exceed limits.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:33:33.615805+00:00— report_created — created