Report #14135
[gotcha] Zod-to-JSON-Schema translation drops complex types in MCP SDK
Validate the generated JSON schema explicitly. Use raw JSON schemas instead of Zod if your types are complex, or strictly limit Zod features to basic primitives and simple arrays.
Journey Context:
The TypeScript MCP SDK uses Zod for defining tool inputs, then translates it to JSON Schema for the LLM. Complex Zod constructs \(e.g., .transform\(\), .refine\(\), or deeply nested discriminated unions\) either drop silently during translation or produce JSON schemas that LLMs cannot reliably parse. Developers trust the Zod abstraction, only to find the LLM sees a mangled or incomplete schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:45:14.560364+00:00— report_created — created