Agent actions
WebMCP: let AI agents use your site's forms
WebMCP turns a form or a JavaScript function into a tool a browser agent can call. The declarative and imperative APIs, safety hints, and how to test them.
A browser agent that books a table or files a support request today does it the hard way: it reads the page, guesses which field is which, types, and clicks. WebMCP lets the page say what it can do instead. A form or a JavaScript function becomes a tool with a name, a description and typed parameters, and the agent calls it.
WebMCP is a proposal from the W3C Web Machine Learning Community Group, and Chrome runs it as an origin trial. Chrome’s documentation says it “is under active discussion and subject to change”, so treat the details below as current in November 2026.
Two ways to declare a tool
Declarative: attributes on a form
Add toolname and tooldescription to an existing <form>. The fields become the tool’s
parameters, named by their name attribute and described by their <label>:
<form toolname="request_support"
tooldescription="Submit a support request to the customer team."
action="/support">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
<select name="topic" required
toolparamdescription="Which team the request is routed to.">
<option value="returns">Return a purchase</option>
<option value="delivery">Where is my package</option>
</select>
<button type="submit">Send</button>
</form>
toolnameandtooldescriptionare both required. Remove either and the browser unregisters the tool.toolparamdescriptiondescribes a field. Without it the browser uses the field’s<label>, then itsaria-description.toolautosubmitsubmits the form when the agent calls the tool. Without it, the browser fills the form and the person submits it.
When an agent invokes the tool, the browser focuses and fills the form in view of the person.
The submit event tells you it came from an agent with event.agentInvoked, and
event.respondWith() lets you return a result to the agent instead of navigating.
The declarative attributes are a Chrome feature; the WebMCP specification itself currently defines only the JavaScript API.
Imperative: register a function
For actions that are not a form, register a tool with document.modelContext:
if ("modelContext" in document) {
await document.modelContext.registerTool({
name: "check_availability",
description: "Find free tables for a date and number of guests.",
inputSchema: {
type: "object",
properties: {
date: { type: "string", description: "Date in YYYY-MM-DD" },
guests: { type: "number", description: "Number of guests" },
},
required: ["date", "guests"],
},
annotations: { readOnlyHint: true },
execute: async ({ date, guests }) => {
const response = await fetch(`/api/availability?date=${date}&guests=${guests}`);
return response.json();
},
});
}
A tool needs a name, a description, an inputSchema in JSON Schema and an execute
function. Pass an AbortSignal in the second argument to remove the tool later. Early previews
used navigator.modelContext; current Chrome and the specification use document.modelContext.
Tell the agent what a tool does
Annotations describe the consequences of a call:
readOnlyHint: truefor tools that only read, such as search or availability.consequentialHint: truefor tools that commit to something: a purchase, a booking, a message sent on someone’s behalf. An agent should confirm these with the person.untrustedContentHint: truewhen the result contains content you do not control, such as user reviews, which could carry instructions aimed at the agent.
Keep it safe
A tool is a public entry point into your application, called by software that a person may not be watching closely.
- Expose what a person could do on the page anyway, with the same authentication and the same server-side checks. WebMCP does not replace either.
- Keep destructive actions out, or mark them
consequentialHintand require confirmation in your own flow. - Register few, well-described tools. Lighthouse warns about pages with many tools: they cost the model context and make it pick the wrong one.
- Do not trust inputs. Validate the arguments exactly as you validate a form post.
Try it
WebMCP runs in Chrome with the origin trial token on your origin; register at the Chrome origin trials page linked below. Lighthouse’s Agentic Browsing category lists the tools a page registers and the schema problems the browser found. See Lighthouse Agentic Browsing.
A CrawlWise scan records the tools a page registers with registerTool() and reads forms
with toolname and tooldescription, and warns about a tool without a description or an input
schema. It does not call any tool, and tools registered only after an interaction are not seen.
Sources
- Chrome: WebMCP
- Chrome: WebMCP declarative API
- Chrome: WebMCP imperative API
- W3C Web Machine Learning CG: WebMCP explainer
- W3C Web Machine Learning CG: WebMCP specification
- Chrome: WebMCP origin trial
How CrawlWise checks this
- WebMCP tools are complete
api.webmcp
Last updated .