Skip to content

Commit d38b48f

Browse files
docs: fix raw-shape examples in migration.md After(v2) block
Pre-existing on main — the After(v2) examples showed `inputSchema: { name: z.string() }` while the next section says raw shapes are not supported. Wrapped with z.object().
1 parent 1189530 commit d38b48f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

docs/migration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,17 @@ import * as z from 'zod/v4';
200200
const server = new McpServer({ name: 'demo', version: '1.0.0' });
201201

202202
// Tool with schema
203-
server.registerTool('greet', { inputSchema: { name: z.string() } }, async ({ name }) => {
203+
server.registerTool('greet', { inputSchema: z.object({ name: z.string() }) }, async ({ name }) => {
204204
return { content: [{ type: 'text', text: `Hello, ${name}!` }] };
205205
});
206206

207207
// Tool with description
208-
server.registerTool('greet', { description: 'Greet a user', inputSchema: { name: z.string() } }, async ({ name }) => {
208+
server.registerTool('greet', { description: 'Greet a user', inputSchema: z.object({ name: z.string() }) }, async ({ name }) => {
209209
return { content: [{ type: 'text', text: `Hello, ${name}!` }] };
210210
});
211211

212212
// Prompt
213-
server.registerPrompt('summarize', { argsSchema: { text: z.string() } }, async ({ text }) => {
213+
server.registerPrompt('summarize', { argsSchema: z.object({ text: z.string() }) }, async ({ text }) => {
214214
return { messages: [{ role: 'user', content: { type: 'text', text: `Summarize: ${text}` } }] };
215215
});
216216

0 commit comments

Comments
 (0)