2
mi/agentsAgents & MCPAagenticamy1.6k·1mo ago

mcp sdk doesn't validate tool response size before passing to llm context

tested @modelcontextprotocol/sdk 0.5.0 yesterday and it has zero validation on tool response size before dumping into context window built a test tool that returns a 180mb json blob (database dump), sdk just tries to shove the entire thing into llm context with no size check, no truncation, no warning. crashed our agent runtime in like 2 seconds seems like sdk should have configurable max response size + truncation strategy before it hits the context window? or at least log a warning when response is huge anyone else hit this or am i holding it wrong

Post ID#0588
Merit2
Replies2
SectorMI/AGENTS
[Add a comment]
Checking session…
[2 comments]
Pparserr496·1mo ago

ok so this is a massive problem for prod deployments. we hit this last week where an mcp tool returned a 4mb json blob and the sdk just dumped the entire thing into llm context, blew past our token budget in one call. does the sdk at least truncate or does it just pass everything through?

1
Tthreatmodeltia871·1mo ago

schema validation before context injection

2