v2 - clean deprecated methods and exports (#1419)

Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
This commit is contained in:
Konstantin Konstantinov 2026-01-23 18:39:14 +02:00 • committed by GitHub
commit dcf708d892
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 258 additions and 565 deletions

View file

@ -25,11 +25,13 @@ describe.each(zodTestMatrix)('Issue #1277: $zodVersionLabel', (entry: ZodMatrixE
version: '1.0'
});
mcpServer.prompt(
mcpServer.registerPrompt(
'test',
{
name: z.string().describe('The user name'),
value: z.string().describe('The value to set')
argsSchema: {
name: z.string().describe('The user name'),
value: z.string().describe('The value to set')
}
},
async ({ name, value }) => ({
messages: [

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,7 @@ async function setupServer(withSessionManagement: boolean, z: ZNamespace) {
);
// Add a simple resource
mcpServer.resource('test-resource', '/test', { description: 'A test resource' }, async () => ({
mcpServer.registerResource('test-resource', '/test', { description: 'A test resource' }, async () => ({
contents: [
{
uri: '/test',
@ -39,7 +39,7 @@ async function setupServer(withSessionManagement: boolean, z: ZNamespace) {
]
}));
mcpServer.prompt('test-prompt', 'A test prompt', async () => ({
mcpServer.registerPrompt('test-prompt', { description: 'A test prompt' }, async () => ({
messages: [
{
role: 'user',
@ -51,11 +51,13 @@ async function setupServer(withSessionManagement: boolean, z: ZNamespace) {
]
}));
mcpServer.tool(
mcpServer.registerTool(
'greet',
'A simple greeting tool',
{
name: z.string().describe('Name to greet').default('World')
description: 'A simple greeting tool',
inputSchema: {
name: z.string().describe('Name to greet').default('World')
}
},
async ({ name }) => {
return {

View file

@ -60,11 +60,13 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
mcpServer = new McpServer({ name: 'test-server', version: '1.0.0' }, { capabilities: { logging: {} } });
// Add a simple notification tool that completes quickly
mcpServer.tool(
mcpServer.registerTool(
'send-notification',
'Sends a single notification',
{
message: z.string().describe('Message to send').default('Test notification')
description: 'Sends a single notification',
inputSchema: {
message: z.string().describe('Message to send').default('Test notification')
}
},
async ({ message }, { sendNotification }) => {
// Send notification immediately
@ -83,12 +85,14 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
);
// Add a long-running tool that sends multiple notifications
mcpServer.tool(
mcpServer.registerTool(
'run-notifications',
'Sends multiple notifications over time',
{
count: z.number().describe('Number of notifications to send').default(10),
interval: z.number().describe('Interval between notifications in ms').default(50)
description: 'Sends multiple notifications over time',
inputSchema: {
count: z.number().describe('Number of notifications to send').default(10),
interval: z.number().describe('Interval between notifications in ms').default(50)
}
},
async ({ count, interval }, { sendNotification }) => {
// Send notifications at specified intervals

View file

@ -44,7 +44,9 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
const server = new McpServer({ name: 'test-server', version: '1.0.0' }, { capabilities: {} });
// Register tool without title
server.tool('test-tool', 'A test tool', { value: z.string() }, async () => ({ content: [{ type: 'text', text: 'result' }] }));
server.registerTool('test-tool', { description: 'A test tool', inputSchema: { value: z.string() } }, async () => ({
content: [{ type: 'text', text: 'result' }]
}));
const client = new Client({ name: 'test-client', version: '1.0.0' });
@ -64,7 +66,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
const server = new McpServer({ name: 'test-server', version: '1.0.0' }, { capabilities: {} });
// Register prompt with title by updating after creation
const prompt = server.prompt('test-prompt', 'A test prompt', async () => ({
const prompt = server.registerPrompt('test-prompt', { description: 'A test prompt' }, async () => ({
messages: [{ role: 'user', content: { type: 'text', text: 'test' } }]
}));
prompt.update({ title: 'Test Prompt Display Name' });