mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 08:13:24 +02:00
Suppress startElicitation tool if client does not advertise support for elicitation capability
* In everything.ts - remove inappropriate elicitation entry from server capabilities (this is a client capability) - When creating tool list, only add `ToolName.ELICITATION` definition to tools array if `clientCapabilities` includes `elicitation` * In package.json / package-lock.json - bump @modelcontextprotocol/sdk to "^1.17.4", adding `elicitation` to `ClientCapabilities` type
This commit is contained in:
@@ -164,8 +164,7 @@ export const createServer = () => {
|
||||
resources: { subscribe: true },
|
||||
tools: {},
|
||||
logging: {},
|
||||
completions: {},
|
||||
elicitation: {},
|
||||
completions: {}
|
||||
},
|
||||
instructions
|
||||
}
|
||||
@@ -177,7 +176,7 @@ export const createServer = () => {
|
||||
|
||||
let logLevel: LoggingLevel = "debug";
|
||||
let logsUpdateInterval: NodeJS.Timeout | undefined;
|
||||
// Store client capabilities
|
||||
// Store client capabilities
|
||||
let clientCapabilities: ClientCapabilities | undefined;
|
||||
|
||||
// Roots state management
|
||||
@@ -523,11 +522,6 @@ export const createServer = () => {
|
||||
"Returns a resource reference that can be used by MCP clients",
|
||||
inputSchema: zodToJsonSchema(GetResourceReferenceSchema) as ToolInput,
|
||||
},
|
||||
{
|
||||
name: ToolName.ELICITATION,
|
||||
description: "Demonstrates the Elicitation feature by asking the user to provide information about their favorite color, number, and pets.",
|
||||
inputSchema: zodToJsonSchema(ElicitationSchema) as ToolInput,
|
||||
},
|
||||
{
|
||||
name: ToolName.GET_RESOURCE_LINKS,
|
||||
description:
|
||||
@@ -548,7 +542,12 @@ export const createServer = () => {
|
||||
"Lists the current MCP roots provided by the client. Demonstrates the roots protocol capability even though this server doesn't access files.",
|
||||
inputSchema: zodToJsonSchema(ListRootsSchema) as ToolInput,
|
||||
});
|
||||
|
||||
if (clientCapabilities!.elicitation) tools.push ({
|
||||
name: ToolName.ELICITATION,
|
||||
description: "Demonstrates the Elicitation feature by asking the user to provide information about their favorite color, number, and pets.",
|
||||
inputSchema: zodToJsonSchema(ElicitationSchema) as ToolInput,
|
||||
});
|
||||
|
||||
return { tools };
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"start:streamableHttp": "node dist/streamableHttp.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@modelcontextprotocol/sdk": "^1.17.4",
|
||||
"express": "^4.21.1",
|
||||
"zod": "^3.23.8",
|
||||
"zod-to-json-schema": "^3.23.5"
|
||||
|
||||
Reference in New Issue
Block a user