|
1 | 1 | import { McpServer } from './mcp.js'; |
2 | 2 | import { Client } from '../client/index.js'; |
3 | 3 | import { InMemoryTransport } from '../inMemory.js'; |
4 | | -import { z } from 'zod'; |
| 4 | +import * as z from 'zod/v4'; |
| 5 | +import * as zMini from 'zod/v4-mini'; |
5 | 6 | import { |
6 | 7 | ListToolsResultSchema, |
7 | 8 | CallToolResultSchema, |
@@ -522,8 +523,8 @@ describe('tool()', () => { |
522 | 523 | mcpServer.tool( |
523 | 524 | 'test', |
524 | 525 | { |
525 | | - name: z.string(), |
526 | | - value: z.number() |
| 526 | + name: zMini.string(), |
| 527 | + value: zMini.number() |
527 | 528 | }, |
528 | 529 | async ({ name, value }) => ({ |
529 | 530 | content: [ |
@@ -695,14 +696,14 @@ describe('tool()', () => { |
695 | 696 | version: '1.0' |
696 | 697 | }); |
697 | 698 |
|
698 | | - mcpServer.tool('test', { name: z.string() }, { title: 'Test Tool', readOnlyHint: true }, async ({ name }) => ({ |
| 699 | + mcpServer.tool('test', { name: zMini.string() }, { title: 'Test Tool', readOnlyHint: true }, async ({ name }) => ({ |
699 | 700 | content: [{ type: 'text', text: `Hello, ${name}!` }] |
700 | 701 | })); |
701 | 702 |
|
702 | 703 | mcpServer.registerTool( |
703 | 704 | 'test (new api)', |
704 | 705 | { |
705 | | - inputSchema: { name: z.string() }, |
| 706 | + inputSchema: { name: zMini.string() }, |
706 | 707 | annotations: { title: 'Test Tool', readOnlyHint: true } |
707 | 708 | }, |
708 | 709 | async ({ name }) => ({ |
@@ -879,8 +880,8 @@ describe('tool()', () => { |
879 | 880 | 'test (new api)', |
880 | 881 | { |
881 | 882 | inputSchema: { |
882 | | - name: z.string(), |
883 | | - value: z.number() |
| 883 | + name: zMini.string(), |
| 884 | + value: zMini.number() |
884 | 885 | } |
885 | 886 | }, |
886 | 887 | async ({ name, value }) => ({ |
@@ -3081,7 +3082,7 @@ describe('prompt()', () => { |
3081 | 3082 | ); |
3082 | 3083 |
|
3083 | 3084 | // Register a prompt with completion |
3084 | | - mcpServer.prompt('echo', { message: completable(z.string(), () => ['hello', 'world']) }, ({ message }) => ({ |
| 3085 | + mcpServer.prompt('echo', { message: completable(zMini.string(), () => ['hello', 'world']) }, ({ message }) => ({ |
3085 | 3086 | messages: [ |
3086 | 3087 | { |
3087 | 3088 | role: 'user', |
@@ -3153,7 +3154,7 @@ describe('prompt()', () => { |
3153 | 3154 | mcpServer.prompt( |
3154 | 3155 | 'test-prompt', |
3155 | 3156 | { |
3156 | | - name: completable(z.string(), () => ['Alice', 'Bob', 'Charlie']) |
| 3157 | + name: completable(zMini.string(), () => ['Alice', 'Bob', 'Charlie']) |
3157 | 3158 | }, |
3158 | 3159 | async ({ name }) => ({ |
3159 | 3160 | messages: [ |
@@ -3192,7 +3193,7 @@ describe('prompt()', () => { |
3192 | 3193 | mcpServer.prompt( |
3193 | 3194 | 'test-prompt', |
3194 | 3195 | { |
3195 | | - name: completable(z.string(), () => ['Alice', 'Bob', 'Charlie']) |
| 3196 | + name: completable(zMini.string(), () => ['Alice', 'Bob', 'Charlie']) |
3196 | 3197 | }, |
3197 | 3198 | async ({ name }) => ({ |
3198 | 3199 | messages: [ |
@@ -3249,7 +3250,7 @@ describe('prompt()', () => { |
3249 | 3250 | mcpServer.prompt( |
3250 | 3251 | 'test-prompt', |
3251 | 3252 | { |
3252 | | - name: completable(z.string(), test => ['Alice', 'Bob', 'Charlie'].filter(value => value.startsWith(test))) |
| 3253 | + name: completable(zMini.string(), test => ['Alice', 'Bob', 'Charlie'].filter(value => value.startsWith(test))) |
3253 | 3254 | }, |
3254 | 3255 | async ({ name }) => ({ |
3255 | 3256 | messages: [ |
@@ -3741,10 +3742,10 @@ describe('Tool title precedence', () => { |
3741 | 3742 | title: 'Team Greeting', |
3742 | 3743 | description: 'Generate a greeting for team members', |
3743 | 3744 | argsSchema: { |
3744 | | - department: completable(z.string(), value => { |
| 3745 | + department: completable(zMini.string(), value => { |
3745 | 3746 | return ['engineering', 'sales', 'marketing', 'support'].filter(d => d.startsWith(value)); |
3746 | 3747 | }), |
3747 | | - name: completable(z.string(), (value, context) => { |
| 3748 | + name: completable(zMini.string(), (value, context) => { |
3748 | 3749 | const department = context?.arguments?.['department']; |
3749 | 3750 | if (department === 'engineering') { |
3750 | 3751 | return ['Alice', 'Bob', 'Charlie'].filter(n => n.startsWith(value)); |
|
0 commit comments