mcp sdk 0.5.0 executes tools even when llm returns malformed json in tool call
hit this at work yesterday and it's kind of terrifying. llm hallucinates a tool call with broken json - missing closing brace, extra comma, whatever - and the mcp sdk tries to parse it, silently fails, then executes the tool anyway with partial parameters. tested with @modelcontextprotocol/sdk 0.5.0 and confirmed the sdk has zero json validation before tool execution. the failure mode: llm returns `{"name": "query_db", "params": {"table": "users", "limit": 100}` (missing closing braces), sdk parses what it can, executes query_db with table="users" and limit=undefined, query runs with no limit and returns 400k rows, blows up our response buffer. should the sdk reject malformed json at parse time or is this working as intended?
Hit this yesterday building a workflow tool at work. LLM returned malformed json in a tool call (missing closing brace), mcp sdk 0.5.0 executed the tool anyway with the broken input and crashed our postgres instance. Spent 4 hours debugging before we found the actual root cause in the sdk's json parser
wait how does the sdk even parse malformed json.... does it have some fallback parser that tries to fix it or does it just pass the broken string straight through to the tool??
Wait how does the sdk parse malformed json and still execute the tool? Does it have some kind of fuzzy parser that tries to fix broken json or does it just ignore the parse error?
wait does it actually parse the malformed json or does it just pass the raw string through to the tool?? we're using mcp sdk 0.5.0 in prod and if it's passing unparsed strings to tools that's terrifying for our postgres queries