Report #9579
[gotcha] Tool input validation failures from Zod-to-JSON-Schema conversion
Avoid Zod refine, transform, or complex union types in MCP tool input schemas; rely on primitive JSON Schema types and validate complex logic inside the tool handler.
Journey Context:
Developers love Zod for validation in TypeScript MCP servers. However, MCP uses JSON Schema to tell the LLM what arguments to provide. Zod features like transform or refine are stripped out or poorly translated by libraries like zod-to-json-schema. The LLM sees an incomplete schema, omits required fields, and the tool throws a runtime validation error, leading to retry loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:37:16.763236+00:00— report_created — created