From 7f0755627fd6e617e0ccfaf4757d1b61f723b298 Mon Sep 17 00:00:00 2001 From: Pavel Bezglasny Date: Thu, 20 Nov 2025 15:33:37 +0100 Subject: [PATCH] Fix example server elicitation conf (#29) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix server elicitation conf * Remove empty elicitation object from server config * 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 --------- Co-authored-by: Paul Carleton Co-authored-by: Claude Co-authored-by: Paul Carleton --- examples/servers/typescript/everything-server.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/examples/servers/typescript/everything-server.ts b/examples/servers/typescript/everything-server.ts index be90caf..a7ffdfd 100644 --- a/examples/servers/typescript/everything-server.ts +++ b/examples/servers/typescript/everything-server.ts @@ -13,6 +13,7 @@ import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'; import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'; +import { ElicitResultSchema } from '@modelcontextprotocol/sdk/types.js'; import { z } from 'zod'; import express from 'express'; import cors from 'cors'; @@ -369,9 +370,7 @@ function createMcpServer() { } } }, - z - .object({ method: z.literal('elicitation/create') }) - .passthrough() as any + ElicitResultSchema ); const elicitResult = result as any; @@ -445,9 +444,7 @@ function createMcpServer() { } } }, - z - .object({ method: z.literal('elicitation/create') }) - .passthrough() as any + ElicitResultSchema ); const elicitResult = result as any; @@ -544,9 +541,7 @@ function createMcpServer() { } } }, - z - .object({ method: z.literal('elicitation/create') }) - .passthrough() as any + ElicitResultSchema ); const elicitResult = result as any;