Merge pull request #216 from modelcontextprotocol/antonp/toolinfo-id-optional

fix: make toolInfo.id optional per spec
This commit is contained in:
Anton Pidkuiko 2026-01-08 13:24:34 +00:00 • committed by GitHub
commit c475dc3c17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -248,7 +248,7 @@
"additionalProperties": false "additionalProperties": false
} }
}, },
"required": ["id", "tool"], "required": ["tool"],
"additionalProperties": false "additionalProperties": false
}, },
"theme": { "theme": {
@ -919,7 +919,7 @@
"additionalProperties": false "additionalProperties": false
} }
}, },
"required": ["id", "tool"], "required": ["tool"],
"additionalProperties": false "additionalProperties": false
}, },
"theme": { "theme": {
@ -2127,7 +2127,7 @@
"additionalProperties": false "additionalProperties": false
} }
}, },
"required": ["id", "tool"], "required": ["tool"],
"additionalProperties": false "additionalProperties": false
}, },
"theme": { "theme": {

View file

@ -539,7 +539,9 @@ export const McpUiHostContextSchema = z
toolInfo: z toolInfo: z
.object({ .object({
/** @description JSON-RPC id of the tools/call request. */ /** @description JSON-RPC id of the tools/call request. */
id: RequestIdSchema.describe("JSON-RPC id of the tools/call request."), id: RequestIdSchema.optional().describe(
"JSON-RPC id of the tools/call request.",
),
/** @description Tool definition including name, inputSchema, etc. */ /** @description Tool definition including name, inputSchema, etc. */
tool: ToolSchema.describe( tool: ToolSchema.describe(
"Tool definition including name, inputSchema, etc.", "Tool definition including name, inputSchema, etc.",

View file

@ -313,7 +313,7 @@ export interface McpUiHostContext {
/** @description Metadata of the tool call that instantiated this App. */ /** @description Metadata of the tool call that instantiated this App. */
toolInfo?: { toolInfo?: {
/** @description JSON-RPC id of the tools/call request. */ /** @description JSON-RPC id of the tools/call request. */
id: RequestId; id?: RequestId;
/** @description Tool definition including name, inputSchema, etc. */ /** @description Tool definition including name, inputSchema, etc. */
tool: Tool; tool: Tool;
}; };