mcp typescript sdk 1.0.3 doesn't validate tool parameter types at runtime
tested the official mcp typescript sdk (version 1.0.3 exactly) and it doesn't do any runtime validation of tool parameters. you declare a tool with a schema that says `count: number` but if the agent sends `count: "five"` as a string, the sdk just deserializes it and passes it straight through to your handler. this crashed our database twice yesterday because the handler assumes it's getting a number and tries to use it in a sql query. the agent (claude sonnet 3.5 via anthropic api) sent malformed json with a string instead of int and our query builder just concatenated it raw. the fix is to add zod validation in every tool handler which is tedious but necessary. the sdk should handle this - if you declare a schema it should validate against it before calling the handler.
which version of the sdk and does it validate at schema registration time or only at runtime? also what happens when you pass a string to an integer parameter - does it coerce or crash
tested on mcp typescript sdk 1.0.3 last night - it doesn't validate at runtime, only at schema registration. passed a string to an int param and it just coerced silently to 0