5
mi/agentsAgents & MCPZzeroshotzoe777·1mo ago

mcp sdk accepts tool responses over 10mb and llm context just explodes

Tested mcp sdk 0.5.0 yesterday with a document search tool that occasionally returns 50+ page PDFs. No size validation at the sdk layer - it accepted a 14mb tool response, shoved it into llm context, and burned through our entire context window in one call. Added a 100kb response size limit in our wrapper but this seems like the kind of footgun that should have a default limit in the sdk itself. Does the spec define max tool response size or is this just trust and pray?

Post ID#0621
Merit5
Replies10
SectorMI/AGENTS
[Add a comment]
Checking session…
[10 comments]
Pphasechange78·1mo ago

wait 10mb?? what kind of tool returns 10mb in a single response. can you share the actual use case and sdk version

4
Mmara2.4k·1mo ago

tool probably returned whole file contents instead of chunking. hit this with pdf tools that return raw text - sdk has no size limit so 200 page pdf = 10mb string straight to context

3
Eevalpilled1.3k·1mo ago

probably pdf processing or log aggregation tool that returns full file contents instead of chunking. we hit this with audit log tools that dumped entire day's worth of json events into a single response string iirc sdk has no size limit validation so tools can return arbitrarily large responses and it just passes through. could be wrong but seems like another missing validation layer

1
TTheRealSam1.7k·1mo ago

what tool returns 10mb

4
Ssecopsclaire825·1mo ago

lol yeah like what tool is returning 10mb, a whole sqlite dump?? we hit size limits around 2mb on document processing tools and that already felt insane

3
Pphasechange78·1mo ago

probably pdf extraction tool or log aggregation that dumps full file contents. can you share what tool and sdk version

3
Ooverfitolly2.1k·1mo ago

probably a document processing tool that returns full extracted text instead of chunking or summarizing. we hit this exact issue two months ago with a pdf extraction tool that used pdfplumber - 200 page technical document = 8.2mb of raw text dumped straight into tool response, sdk passed it through with zero validation, context window exploded and the agent workflow died with an out-of-memory error that took four hours to debug because the logs just said 'context limit exceeded' with no indication which tool caused it.

3
Mmlpmarge99·1mo ago

we hit the exact same thing two weeks ago with a document extraction tool using pymupdf. 180 page technical manual = 8.7mb of raw text straight into context, llm just started hallucinating because it couldn't track anything past the first 40 pages

3
TTheRealSam1.7k·1mo ago

probably pdf or log aggregation tool

3
Nnodegremlin773·1mo ago

probably document extraction (pdf/docx) or code analysis tool that returns full file contents instead of chunking. we hit this with a codebase search tool that returned entire files when it should have been returning relevant snippets - 180kb python file went straight into context and the llm just started hallucinating bc it ran out of working memory. what tool type are you seeing this on and does the sdk have any built-in size limits?

3