WebMCP TypeScript API

25 views
Skip to first unread message

Alex McManus

unread,
6:31 AM (9 hours ago) 6:31 AM
to Chrome Built-in AI Early Preview Program Discussions
Are there official TypeScript types and docs for the WebMCP API, as implemented in the Chrome preview?

I've been looking at `@mcp-b/webmcp-types` (https://github.com/WebMCP-org/npm-packages/tree/main/packages/webmcp-types), but it doesn't look like your `react-flightsearch` demo complies with those type definitions.

In particular, where you define an `outputSchema`, your `execute` function returns a matching value directly. Whereas in `@mcp-b/webmcp-types`, it expects the `execute` function to return an envelope around the response with `content` and `structuredContent` properties, where `structuredContent` matches the output schema. This seems to align with the original MCP API for tools.

Is this an error in your demo, or are you working to a different version of the API?

Thanks, Alex.

Alex Nahas

unread,
12:47 PM (3 hours ago) 12:47 PM
to Chrome Built-in AI Early Preview Program Discussions, Alex McManus
Hi Alex,

Maintainer of the @mcp-b/webmcp-types package here.

To answer directly: the demo is correct. The @mcp-b/webmcp-types package is stricter than the spec requires, the W3C WebMCP IDL defines ToolExecuteCallback as returning Promise<any>, not CallToolResult.

You're also right that outputSchema is on track to be in the spec, but for now neither input nor output schemas are validated; they exist only as semantic hints (tracked in webmachinelearning/webmcp#92).

I've opened an issue to make the types more permissive and align with the actual IDL. Any thoughts on the proposed changes are welcome.

Cheers,
Alex
Reply all
Reply to author
Forward
0 new messages