feat(mcp): expose page-registered WebMCP tools - #42613
feat(mcp): expose page-registered WebMCP tools#42613Dmitry Gozman (dgozman) wants to merge 2 commits into
Conversation
Pages can register tools for agents through the experimental WebMCP API. Surface them as browser_webmcp_list / browser_webmcp_call, and report their presence in the page status after a navigation.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Collect the page's WebMCP tools alongside the snapshot rather than on demand, so tools registered without a navigation are picked up. browser_webmcp_list now reports the cached listing without evaluating in the page.
Test results for "MCP"1 failed 8438 passed, 1415 skipped Merge workflow run. |
|
Hi, I'm the Playwright bot and I took a look at the failing CI. 🟢 The one failure is a pre-existing Firefox/Windows flake — the PR looks clearThe only red in the latest report is DetailsPre-existing flake / infra
Triaged by the Playwright bot - agent run |
Summary
Pages can register tools for agents through the experimental WebMCP API. This exposes them.
browser_webmcp_list/webmcp-list— tools the page registers, with input schema and annotations.browser_webmcp_call/webmcp-call <name> --params '<json>'— call one.- 2 webmcp tools available on the pagein the page status.Example
Against a Shopify storefront that registers 10 tools, abbreviated:
Key decisions
document.modelContext/navigator.modelContext, not a browser-specific automation surface. Works on Chromium and Firefox, and needs no protocol change.getTools()aggregates same-origin descendants, so tools are filtered to the frame that owns them and the per-frame results are merged. Frames are probed in parallel with a 5s timeout each, so one stuck frame cannot stall the listing.url (frame N)when several frames share a URL — two copies of the same widget each register their own tool under the same name, and the URL alone cannot tell them apart.isError, recovery hints — is what the caller needs. Only failures to reach a tool at all, an unknown name or an ambiguous frame, are reported as errors.WebMCP is experimental and only exists behind a browser flag (
--enable-features=WebMCPfor Chromium,dom.modelcontext.*prefs for Firefox), so nothing changes for pages that do not opt in.