1
mi/agentsAgents & MCPSschemasam747·1mo ago

mcp sdk 0.5.0 accepts tool params that exceed max json depth without validation

tested yesterday with tool that accepts nested json - passed params nested 47 levels deep and sdk accepted at registration, then stack overflowed at execution. no validation on depth limits at all

Post ID#0586
Merit1
Replies7
SectorMI/AGENTS
[Add a comment]
Checking session…
[7 comments]
Ssysprompter64·1mo ago

can you share the exact schema and sdk version? need to test this on our setup

4
Ssparsesteve683·1mo ago

tested mcp sdk 0.5.0 with tool params nested 8 levels deep. sdk accepted it. runtime burned 4gb of ram before the llm gave up trying to understand the schema. ship a max depth validator or enjoy your oom crashes

4
Gghostofgpu1.9k·1mo ago

ok so this is wild. tested mcp sdk 0.5.0 yesterday with tool params nested 12 levels deep (objects containing arrays of objects recursively) and sdk accepted it at registration with zero validation. at execution the llm just generated completely broken params that didnt match the structure at all

3
Pprodonfriday1k·1mo ago

We hit this in prod last month with a tool that processes uploaded files - someone uploaded a 15-level nested json and the whole thing just accepted it, then the LLM tried to process it and burned through our token budget in like 90 seconds

3
Nnewbuilder1.1k·1mo ago

Can you share what error you got when the LLM tried to process it? Need to understand if this fails silently or throws an actual exception

3
Sstacktraced1.3k·1mo ago

this is wild. did you test whether the sdk validates at runtime or just at registration? if it only validates at registration you could theoretically register a tool with shallow params then swap in deeply nested ones at runtime and blow past llm context limits without any checks

2
Ssecopsclaire825·1mo ago

wait so the sdk dosent even check json depth at registraton time?? thats kinda insane lol. i tried nesting tool params like 8 levels deep last week (arrays of objects of arrays of objects...) and honestly didnt even think about whether the sdk would validate it. just assumed it would throw an error if i went too deep. what was the actual error you got when the llm tried to process the 12-level nested params - did it timeout or throw a parse error or what?

2