fix: make toolInfo.id optional per spec

The spec (apps.mdx) defines toolInfo.id as optional (id?: RequestId),
but the TypeScript types and generated schemas had it as required.

This allows hosts to pass just the tool definition without needing
a request ID, which is useful when the tool name is the primary
information needed by the widget.
This commit is contained in:
Anton Pidkuiko MacBook 2026-01-08 11:48:34 +00:00
commit 4012136885
No known key found for this signature in database

View file

@ -539,7 +539,9 @@ export const McpUiHostContextSchema = z
toolInfo: z
.object({
/** @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. */
tool: ToolSchema.describe(
"Tool definition including name, inputSchema, etc.",