docs: registerTool accepts strict zod object

This commit is contained in:
smartass
2026-06-12 00:22:46 +05:00
parent ae34ad1bc9
commit 858ed17d6b
+6 -3
View File
@@ -53,7 +53,10 @@ Applies to every change in this repo, by any agent or human.
- stdout is the MCP protocol channel — diagnostics go to `console.error` ONLY, - stdout is the MCP protocol channel — diagnostics go to `console.error` ONLY,
never `console.log` never `console.log`
- ESM with NodeNext resolution: relative imports need the `.js` extension - ESM with NodeNext resolution: relative imports need the `.js` extension
- MCP SDK v1 (`@modelcontextprotocol/sdk`): `registerTool` takes a ZodRawShape - MCP SDK v1 (`@modelcontextprotocol/sdk`): `registerTool` accepts a ZodRawShape
(plain object of zod fields), NOT `z.object()`; subpath imports (plain object of zod fields) OR a full Zod object (verified on 1.29: AnySchema,
(`server/mcp.js`, `server/stdio.js`, `client/index.js`, `inMemory.js`, `types.js`) `.strict()` honored at runtime). Use a strict `z.object` where unknown-key
rejection matters (add_connection); raw shapes are fine elsewhere. Subpath
imports (`server/mcp.js`, `server/stdio.js`, `client/index.js`, `inMemory.js`,
`types.js`)
- zod 3 (`import * as z from 'zod'`) - zod 3 (`import * as z from 'zod'`)