Skip to content

Commit 7f07556

Browse files
pbezglasnypcarletonclaude
authored
Fix example server elicitation conf (#29)
* 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 <noreply@anthropic.com> --------- Co-authored-by: Paul Carleton <paulc@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
1 parent 82d83f2 commit 7f07556

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

examples/servers/typescript/everything-server.ts

Lines changed: 4 additions & 9 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,9 +370,7 @@ function createMcpServer() {
369370
}
370371
}
371372
},
372-
z
373-
.object({ method: z.literal('elicitation/create') })
374-
.passthrough() as any
373+
ElicitResultSchema
375374
);
376375

377376
const elicitResult = result as any;
@@ -445,9 +444,7 @@ function createMcpServer() {
445444
}
446445
}
447446
},
448-
z
449-
.object({ method: z.literal('elicitation/create') })
450-
.passthrough() as any
447+
ElicitResultSchema
451448
);
452449

453450
const elicitResult = result as any;
@@ -544,9 +541,7 @@ function createMcpServer() {
544541
}
545542
}
546543
},
547-
z
548-
.object({ method: z.literal('elicitation/create') })
549-
.passthrough() as any
544+
ElicitResultSchema
550545
);
551546

552547
const elicitResult = result as any;

0 commit comments

Comments
 (0)