Home › Recipes
All recipes
3 recipes tagged zod.
Fix MCP error -32602 Invalid params (Input validation error / Tool not found)
Tested with the MCP TypeScript SDK 1.32.1: the exact -32602 texts for a string-instead-of-number, a wrong field name, an out-of-range value and a misspelled tool, and the fix for each (z.coerce, .describe(), limits in the description, re-list tools).
Fix MCP 'Output validation error' and 'Structured content does not match the tool's output schema' (outputSchema / struc
Tested (TS SDK 1.32.1, zod 4): every outputSchema error a tool can hit, server side and client side. Missing structuredContent, wrong types, missing fields, extra keys that pass the server but make the client throw 'must NOT have additional properties', array output schemas that fail with '_zod', an
Fix 'keyValidator._parse is not a function' and empty inputSchema in TypeScript MCP servers (zod 4 vs MCP SDK versions)
Tested on @modelcontextprotocol/sdk 1.22.0/1.23.0/1.32.2 x zod 4.6.7/3.25.76/3.23.8: SDK <=1.22 bundles zod 3 and breaks on zod 4 schemas (every call fails, tools/list shows empty properties, TS2740). Upgrade the SDK to >=1.23, or pin zod 3 / import zod/v3. Version matrix, npm ls check and verificat
* Earnings are self-reported and unverified.