Skip to content

webmcp-list misses tools registered after the last snapshot, while webmcp-call can call them #544

Closed

Description

What's going on?

webmcp-list shows the tools from the last snapshot, not the ones the page registers now. A tool registered after open (e.g. after SPA hydration) is missing from webmcp-list, although webmcp-call can call it. After snapshot, it is listed.

index.html:

<script>
  const mc = document.modelContext ?? navigator.modelContext;
  const tool = (name) => ({ name, description: name, inputSchema: { type: "object", properties: {} }, execute: async () => ({ ok: name }) });
  mc.registerTool(tool("immediate"));
  setTimeout(() => mc.registerTool(tool("delayed")), 1000);
</script>
echo '{"browser":{"launchOptions":{"args":["--enable-features=WebMCP"]}}}' > cli.config.json
python3 -m http.server 8080 &
npx playwright cli open --config=cli.config.json http://localhost:8080/
sleep 2
npx playwright cli webmcp-list            # only "immediate"
npx playwright cli webmcp-call delayed    # works: { "ok": "delayed" }
npx playwright cli snapshot
npx playwright cli webmcp-list            # "delayed" and "immediate"

Expected: webmcp-list lists the tools that the page currently registers, consistent with webmcp-call.

The browser_webmcp_list handler appears to render the cached tab.webmcpTools(), which is refreshed only by snapshots and tab selection. Refreshing it in the handler would fix this. Related, but different: microsoft/playwright#42816, microsoft/playwright#42869.

Version

1.65.1 (also 1.64.1 and 1.66.0-alpha-2026-11-17), Chrome 158, macOS arm64


Investigated and drafted with an AI coding agent; the reproduction was run as shown.

Activity

  1. microsoft-playwright-automation commented on Nov 18, 2026

    @microsoft-playwright-automation
  2. microsoft-playwright-automation commented on Nov 18, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot. I reproduced this and prepared an upstream fix.

    Reproduced on macOS with Playwright 1.66.0-next (d456688ec2c9fbcbc4a8515afb901fabdcf1a136) on Chrome 156, bundled Chromium 159 and Firefox 159. webmcp-list reads the last snapshot's cached tools. The fix refreshes that cache before listing, using the existing helper that respects the WebMCP configuration and open dialogs.

    Reproduction and checks

    The existing webmcp-list and webmcp-call test now registers a second tool through eval after open, without another snapshot. Before the fix, the list still reports one tool; with the fix, it reports both. This avoids relying on a timer.

    The CLI and neighbouring MCP WebMCP tests passed on Chrome 156.0.8078.80, bundled Chromium 159.0.8154.6 and Firefox 159.0: 48 passed, 24 skipped across the four headless browser projects. The existing skips cover WebKit (no WebMCP support), Firefox iframe registration and unsupported annotation reporting. Build, lint and type checks passed. The regression was also rechecked without the fix: it fails on all three supported projects and passes with the fix restored.

    The fix belongs in microsoft/playwright; this package will still need a dependency roll after it lands.

    Draft PR: microsoft/playwright#44216

    Triaged on macOS by the Playwright bot - agent run

  3. dcrousso commented on Nov 18, 2026

    @dcrousso

    this should be fixed in the next playwright

  4. mrclrchtr commented on Nov 18, 2026

    @mrclrchtr
    Author

    Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions