From 858ed17d6b30dea5e3bc495c37a14b928f075634 Mon Sep 17 00:00:00 2001 From: smartass Date: Fri, 12 Jun 2026 00:22:46 +0500 Subject: [PATCH] docs: registerTool accepts strict zod object --- AGENTS.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c0c4477..564309c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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, never `console.log` - ESM with NodeNext resolution: relative imports need the `.js` extension -- MCP SDK v1 (`@modelcontextprotocol/sdk`): `registerTool` takes a ZodRawShape - (plain object of zod fields), NOT `z.object()`; subpath imports - (`server/mcp.js`, `server/stdio.js`, `client/index.js`, `inMemory.js`, `types.js`) +- MCP SDK v1 (`@modelcontextprotocol/sdk`): `registerTool` accepts a ZodRawShape + (plain object of zod fields) OR a full Zod object (verified on 1.29: AnySchema, + `.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'`)