DEV Community

Cover image for A Minimal WebMCP Demo in Chrome: Typed, Tested Headless, and Driven by an Agent

A Minimal WebMCP Demo in Chrome: Typed, Tested Headless, and Driven by an Agent

xbill on November 29, 2026

WebMCP lets a web page hand an AI agent a set of tools: named functions with a description and a JSON Schema for their input, registered on documen...
Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The denied-permissions run is the most interesting result here — add_todo and complete_todo never reaching the page while list_todos ran 4 times shows readOnlyHint actually doing the enforcement work, not just decorating the schema. One wrinkle: in 1 of 3 denied runs the agent counted with status "all" and called it "open" — that's the kind of quiet miscount that would slip past a demo. Are you planning to tighten the list_todos description to pin the counting down, or is that on the model side?

Collapse
 
xbill profile image
xbill Google Developer Experts •

putting this on my follow up list

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

Good — that counting wrinkle is the one I'd watch first. A status='all' call reading as 'open' is exactly the kind of quiet miscount that compounds once the demo grows past four tools. Curious what you land on when you get to it.

Collapse
 
andrii_0308f2a18c503d78ec profile image
Andrii •

One interesting edge case is the denied-permissions run where the agent called list_todos({ status: "all" }) but reported the result as the number of open items. Since the count happened to be zero, the incorrect filter went unnoticed at the answer level. I'd consider adding a dedicated count_open_todos tool and testing that the returned status matches the user's intent, not just that the expected tool was called. Have you considered using intent-specific tools to reduce this kind of semantic mismatch?

Collapse
 
xbill profile image
xbill Google Developer Experts •

putting this on my list. I kept the first version minimal to start.

Collapse
 
andrii_0308f2a18c503d78ec profile image
Andrii •

I am new here, please teach me a lot.
Thank you!!!

Thread Thread
 
xbill profile image
xbill Google Developer Experts •

try pulling the whole repo into claude code - you can
then use the CLI to take a deep dive.

I am attaching a sample screen shot.

Thread Thread
 
andrii_0308f2a18c503d78ec profile image
Andrii •

Thank you!!!

Collapse
 
aheadkit profile image
AheadKit •

20 of 20 with every expected tool call is a strong number, and the no-model checks are the part I would steal first — tsc against the schema plus the headless run means the tools are verified before any model ever touches them. The question I would ask before copying the shape is whether the 20/20 holds when the page is a real app instead of 95 lines. My own browser-agent runs showed the cost lives in what comes back after every step: a full page snapshot on a long page ran 185,659 tokens on one Wikipedia article alone. A page handing the agent its own tools skips that snapshot entirely, which is the real win here — but a changing DOM is where a declarative form tool either keeps working or quietly drifts from what the page actually shows. Have you run the same 20 conversations against a page whose content changes between calls?

Collapse
 
xbill profile image
xbill Google Developer Experts •

another good idea. got a lot of traction on this article. adding it to my list

Collapse
 
visionwei profile image
Wei Bin •

The field-name mismatch through puppeteer is the detail I’ll remember — checking annotations.readOnlyHint or JSON.parse(output) would fail even though the tool itself works, which is a nasty place for a false red. I also liked that the 20 of 20 result came with the failure modes kept in: the agent counting with status "all" in one denied run shows the count can be exactly right for the wrong set. Since the agent never chose add_todo_form because the imperative tool returns the id, would you keep the form tool in a real page, or is it mainly there to prove the declarative path works?

Collapse
 
xbill profile image
xbill Google Developer Experts •

Just proof of concept for now. this is my first browser based MCP testing.

Collapse
 
paullovelace profile image
Paul Lovelace •

The field-name mismatch is the bit I'd steal first — readOnlyHint coming back as readOnly, output already parsed, errorText empty with the message hiding in exception.description. That's the kind of thing that passes every test you wrote against the spec and fails the moment you touch the real browser. The on-device model reporting unavailable is the part I'd want to see revisited though — the whole no-key story leans on it, and right now the agent runs still go through Gemini on the extension's server. Machine quirk, or a Chrome 158 thing?

Collapse
 
the_daily_flare profile image
The daily flare •

Chrome 158 ignoring --load-extension explains a failure I hit last week.