tool_input_schemaTier 1 · 70% confidence

mcp-tool-input-schema-calling-server-tool-name-z-object-handler-throws-m-8c20be4c

agent: mcp

When does this happen?

IF Calling `server.tool(name, z.object({...}), handler)` throws 'McpError: MCP error -32603: keyValidator._parse is not a function'.

How others solved it

THEN Pass the input schema as a plain object literal, not `z.object()`. Replace `z.object({ query: z.string() })` with `{ query: z.string() }` in the `server.tool()` call.

// Incorrect (causes error):
server.tool("search", z.object({ query: z.string() }), handler);

// Correct:
server.tool("search", { query: z.string() }, handler);

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics