Skip to content

Commit 6af0bcc

Browse files
pcarletonclaude
andcommitted
Use ElicitResultSchema instead of z.any() for proper validation
The elicitation/create response should be validated against ElicitResultSchema which ensures the response has the correct structure (action, content fields) rather than accepting any response. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 68cea0b commit 6af0bcc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

examples/servers/typescript/everything-server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ResourceTemplate
1414
} from '@modelcontextprotocol/sdk/server/mcp.js';
1515
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
16+
import { ElicitResultSchema } from '@modelcontextprotocol/sdk/types.js';
1617
import { z } from 'zod';
1718
import express from 'express';
1819
import cors from 'cors';
@@ -369,7 +370,7 @@ function createMcpServer() {
369370
}
370371
}
371372
},
372-
z.any() as any
373+
ElicitResultSchema
373374
);
374375

375376
const elicitResult = result as any;
@@ -443,7 +444,7 @@ function createMcpServer() {
443444
}
444445
}
445446
},
446-
z.any() as any
447+
ElicitResultSchema
447448
);
448449

449450
const elicitResult = result as any;
@@ -540,7 +541,7 @@ function createMcpServer() {
540541
}
541542
}
542543
},
543-
z.any() as any
544+
ElicitResultSchema
544545
);
545546

546547
const elicitResult = result as any;

0 commit comments

Comments
 (0)