WebMCP TypeScript API

131 views
Skip to first unread message

Alex McManus

unread,
Feb 26, 2026, 6:31:15 AMFeb 26
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,
Feb 26, 2026, 12:47:43 PMFeb 26
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

Alex McManus

unread,
Mar 2, 2026, 12:14:24 PMMar 2
to Chrome Built-in AI Early Preview Program Discussions, Alex Nahas, Alex McManus
Appreciate your help, thanks very much!

Alex

Reply all
Reply to author
Forward
0 new messages