WebMCP for Websites. How AI Agents Use Structured Tools.
:quality(80))
A website can tell a compatible AI agent what it can do. That’s the idea. The W3C Web Machine Learning Working Group is developing WebMCP. Early previews began in February 2026. Chrome and Edge now offer experimental trials for live testing.
Agents often infer what buttons and fields do by inspecting a page. A redesign can break those assumptions. WebMCP lets a website expose structured tools that describe the available task and the inputs it accepts.
Here’s how it works and where a small business can start.
Contents
Why page automation can break
Two ways to expose a tool
The Imperative API in Detail
The Declarative API: AI-Ready Forms in HTML
Human or Machine? New Events and CSS Classes
What the browser trials support
Recommendations for SMBs
Conclusion: The Browser Becomes an AI Interface
Why page automation can break
When an AI agent needs to book a flight, fill out a form, or compare prices today, it typically does so via DOM scraping: it reads the website's HTML code, identifies buttons and input fields by their CSS classes or IDs, and simulates clicks. It works — until the website owner changes the design.
The result: Fragile automations that break regularly. Companies that rely on web scraping know the problem all too well. A single website update can bring entire processes to a halt. Unstable interfaces are a common reason why RPA (Robotic Process Automation) setups break, and DOM scraping is one of the most fragile parts.
WebMCP solves this problem at its root: instead of AI agents scraping the interface, the website actively offers its functionality as structured tools. The agent doesn't have to guess where the booking button is — it simply calls the search_flights tool.
Two ways to expose a tool
The W3C draft defines an imperative JavaScript API. Chromium’s browser trials also explore a declarative form API. See Chrome’s WebMCP documentation for the current trial scope.
Imperative API — for developers who need full control over tool logic. They register JavaScript functions with clearly defined input schemas.
Declarative API lets a supported browser generate a tool schema from an annotated HTML form.
Both approaches use the same underlying principle: the website tells the browser which actions are available and which parameters they expect. A compatible agent can use those definitions directly.
The Imperative API in Detail
Define your tool’s fields and behaviour in JavaScript, then register it through document.modelContext.navigator.modelContext, which is used to register tools.
Practical example: flight search as an AI tool
await document.modelContext.registerTool({
name: "search_flights",
description: "Search for available flights",
inputSchema: {
type: "object",
properties: {
origin: { type: "string" },
destination: { type: "string" },
date: { type: "string" }
},
required: ["origin", "destination", "date"]
},
annotations: { readOnlyHint: true },
execute: async (params) => {
const results = await searchFlightsAPI(params);
return { flights: results };
}
});Here's what happens step by step:
nameanddescriptiontell the AI agent what the tool does. The agent uses this description to decide whether to invoke the tool.inputSchemadefines the expected parameters in JSON Schema format. This tells the agent exactly what data it needs to provide: origin, destination, and date.executeis the actual function that runs when the agent calls the tool. In this case, it calls an internal API and returns the results in a structured format.
Keep pricing, availability, validation and authorisation on the server. Give the agent only the results it needs for the task.
The API also lets you manage when tools are available.
registerTool(tool, { signal })ties the tool registration to an AbortSignal.controller.abort()unregisters tools attached to that controller when they should no longer be offered.
The Declarative API: AI-Ready Forms in HTML
In Chromium’s declarative trial, HTML form attributes describe a tool. The browser uses named fields to derive its input schema.
Example: prepare a consultation request for the visitor to review
<form toolname="prepare_consultation"
tooldescription="Prepare a consultation request for review">
<label>Name <input name="name" type="text" required /></label>
<label>Email <input name="email" type="email" required /></label>
<label>Service
<select name="service">
<option value="strategy">AI strategy</option>
<option value="chatbot">Chatbot</option>
</select>
</label>
<button type="submit">Send request</button>
</form>Here's how it works:
toolnamegives the tool a unique name that the AI agent can reference.tooldescriptiondescribes what the form does — the agent uses this description for its decision-making.toolautosubmitis an optional attribute for flows that permit automatic submission. Leave it out when the person should review and send a request themselves.The browser generates the input schema automatically from the form fields:
name(text, required),email(email, required), andservice(select).
The form still needs its usual submission handler, validation and accessibility. Keep the human path working in browsers without WebMCP.
Human or Machine? New Events and CSS Classes
A common challenge with AI interactions: how does the website distinguish whether a human or an AI agent submitted a form? WebMCP solves this elegantly:
SubmitEvent.agentInvokedindicates whether an agent initiated the submission in a supported browser. Apply the same permission and validation checks to both paths.SubmitEvent.respondWith(Promise)lets a custom submit handler return a structured result to the agent after preventing the default submission.
Additionally, WebMCP provides CSS pseudo-classes for visual feedback:
:tool-form-active— activates when an AI agent is currently interacting with a form:tool-submit-active— activates while the agent is performing a submission
This lets you show users in real time that an AI is performing an action — for example, with a blue border around the form or a status message.
Developers also have access to the toolactivated and toolcancel events. Chrome 156 dispatches these on document.modelContext. Older trial builds use window.
What the browser trials support
Chrome’s origin trial began with version 149 and Edge’s with version 150. The feature is experimental and support depends on the platform, browser version and trial configuration.The standard is functional but not yet production-ready. Here are some limitations you should be aware of:
Browser context: WebMCP is designed primarily around an active page and a person using the browser. Test your client’s capabilities before relying on background behaviour.
Page-scoped discovery: Compatible clients can discover tools in the active browsing context. That does not provide a web-wide directory.
UI must stay in sync: The website's visual interface must reflect the current state of tool interactions. This requires careful development.
Limited support: Chrome and Edge have trials. Check the implementation status before relying on other browsers or agent clients.
Follow the W3C project’s implementation tracker for browser trial and client support.
Recommendations for SMBs
Test a small task your customers already do on your site.
Audit your forms and interfaces: List all forms on your website that customers or partners use: contact forms, booking systems, product configurators, calculators. These are your potential WebMCP tools.
Pilot project with the Declarative API: Start with search or a form that the visitor can review before submitting. Check in the browser configurations you expect to support.
Think API-first: If you're modernizing your website or online store anyway, plan for clean APIs. WebMCP tools are essentially API calls with browser integration. Those who build good APIs today will have ready-made AI tools tomorrow.
Get your team on board: Ask developers and product owners to test the same workflow with and without agent assistance.
Measure the pilot: Check field accuracy, completion rate and where visitors need help. Keep the normal website workflow available.
Rule of thumb: Start with one form or search and measure whether the tool saves users time.
Conclusion: The Browser Becomes an AI Interface
A structured tool gives an agent the intended action and inputs while your site controls what the tool can do.
For a small business, search, appointment preparation and information requests are practical starting points. Test the experience with customers before depending on it.
Keep the workflow useful to visitors as the specification and browsers evolve.
We help businesses select a suitable task and test a WebMCP pilot with clear permissions, validation and a human review step. Discuss your website workflow
:quality(80))
:quality(80))
:quality(80))
:quality(80))
:quality(80))