Agents and harnesses · evolving · reviewed Oct 11, 2026 · 5 min
How does WebMCP expose website tools to agents?
The website registers a tool's name, input schema and handler. A compatible browser mediates discovery and invocation; website code performs the action using application logic and the current session. The backend still owns authorization and saved state.
The website supplies the operation
An agent can operate an ordinary shop by inspecting the page, changing quantity and clicking a button. WebMCP adds a different interface: the shop can offer add_to_cart as a named operation with a description, structured arguments and an executable handler.
The website owner must implement that support. The browser does not invent the shop's business operations, and an automation client cannot discover a tool that the page has not registered. A tool definition describes the available action; its handler is website code that actually carries it out.
WebMCP is an experimental web-platform proposal. As reviewed on 11 October 2026, its specification is a Community Group draft, not a W3C standard. The current imperative API uses document.modelContext. Browser and client support must be checked independently; old examples can describe different API revisions.
Follow one cart operation
Suppose the user asks an agent to add two units of a cable. The page has registered add_to_cart, whose schema requires a product ID and positive integer quantity. The agent's harness discovers that definition and requests the operation with an argument object.
The browser mediates the call into the page's registered handler. The handler validates the input and reuses the shop's authenticated cart client. Its backend checks the current principal, product and stock before returning saved data or rejecting the operation. After success, the page updates its visible cart and returns a tool result.
The diagram follows the successful path after registration. Its backend request and UI update describe this shop example; a page-local tool can perform its operation without a backend request.
Source-grounded diagram based on the upstream WebMCP explainer, using a shop as the anchor example. WebMCP mediates the page call; the HTTP cart request is application behavior. This reading page does not run an agent or change a cart.
The return value and the user-visible page are separate outputs. A handler can return the correct cart while forgetting to refresh the display. Shared application state makes agreement possible; the interface does not guarantee that the website implemented it correctly.
A schema describes data, not authority
For an invented teaching fixture, cable 11 costs $12.50. An argument object { productId: 11, quantity: 2 } asks for two additional units. A successful application response should therefore correspond to a $25.00 saved cart when it started empty.
That object does not prove that product 11 belongs to this shop, that stock is available or that the caller may modify the cart. Runtime validation checks the argument shape. Authorization and business rules check authoritative application state. The model's generated request supplies neither permission nor evidence of success.
A TypeScript interface helps the developer construct a request. It is erased at runtime. A runtime schema library can instead supply validation and produce the JSON Schema used in the tool definition. The browser receives a JavaScript schema object; converting an object to JSON text is a distinct serialization operation.
Clients discover tools through the browser
There are two client roles to distinguish. A browser agent is integrated with or hosted by the browser. The draft defines how the browser makes page tools available to it. An in-page client is JavaScript supplied by a website, potentially in an iframe. It can use document.modelContext.getTools() to discover exposed tools, then pass a discovered tool and an argument object to executeTool(). In this API, the returned promise resolves to the serialized result. A browser agent uses the browser's integration mechanism rather than necessarily calling these JavaScript methods itself.
Discovery is scoped. Tools belong to the document that registered them; they are not a permanent catalogue of everything the site could ever do. Registration can be removed using an abort signal. Destroying the document also ends its registrations, so a client must handle a tool becoming unavailable between discovery and invocation.
The tools Permissions Policy controls whether a document may use this capability. Origin exposure controls which other documents can discover and invoke a tool; cross-origin access requires explicit exposure. Neither mechanism grants permission to change a user's cart. That remains an application decision, checked against the current session and backend rules.
Predict the boundary
| Changed condition | What follows |
|---|---|
The website never registers add_to_cart | It is unavailable through WebMCP; the caller may use the ordinary UI if that path is supported |
| Arguments contain a string quantity | The handler should reject the malformed request before making the cart write |
| Arguments are valid, but stock is unavailable | The backend rejects the write; valid JSON does not create stock or permission |
| The human Add button is broken | A separately wired page tool can still succeed, so tool success does not establish that the button works |
| The page omits its UI refresh | Saved data and the tool result can be correct while the screen remains stale |
| The registering document is destroyed | Its tools disappear; route-specific tools can also end earlier through explicit cleanup |
Tool names, descriptions and results are supplied by the page. An agent must treat them as untrusted input and retain its own task and permission boundaries. A useful operation contract makes behavior easier to request and test; it does not establish correctness, safety or general model reliability.
Sources
Sources and further reading
- 01WebMCP Community Group draftW3C Web Machine Learning Community Group · standard · source checked Oct 11, 2026
Current experimental browser API, Document model context, tool registration lifetime, execution, and security boundaries; this is not a W3C standard.
- 02WebMCP explainer and in-browser tool flowWebMCP contributors · documentation · source checked Oct 11, 2026
Explains website-owned handlers, shared page context and the call flow from an agent through the page to application services and visible state.
- 03WebMCP security and privacy self-reviewWebMCP contributors · documentation · source checked Oct 11, 2026
Explains document-scoped registrations, origin exposure, Permissions Policy and risks from page-controlled tool metadata and results. This evolving self-review is read alongside the normative draft.
