Use case · Agent interop
Make your page agent-ready with WebMCP
Expose your page's real functionality as WebMCP tools so AI agents call functions instead of scraping your DOM — and let Dornick generate most of that surface from config you already wrote.
document.modelContext@dornick/webmcpwebmcp: { publish: true }<form toolname>
The shape
An AI agent lands on your page and wants to do something real — search your catalog, add to a cart, start a return. Today it guesses: it reads the DOM, finds something that looks like a button, and clicks it. That breaks the moment you ship a redesign.
WebMCP is the W3C answer. Your page declares what it can do, as typed tools with JSON Schemas, and the agent calls those instead of hunting for selectors.
The cheapest possible start
If a form already does the job, attributes are enough — no JavaScript:
<form toolname="search-products"
tooldescription="Search the catalog by keyword and category"
toolautosubmit>
<input name="q" toolparamdescription="What to search for" required>
<select name="category" toolparamdescription="Which department">
<option value="all">Everything</option>
<option value="shoes">Shoes</option>
</select>
<button type="submit">Search</button>
</form>
import { installDeclarativeTools } from "@dornick/webmcp/declarative";
installDeclarativeTools();
Hand the agent a real answer rather than a page reload:
form.addEventListener("submit", (e) => {
e.preventDefault();
const results = search(new FormData(e.target));
render(results);
if (e.agentInvoked) e.respondWith(Promise.resolve({ count: results.length, results }));
});
agentInvoked is true only when an agent pressed the button, so your human path is
untouched.
Where Dornick changes the maths
Everything above is standard WebMCP — any toolkit gets you there.
The difference is that Dornick already knows your data points, so the provider surface comes free:
new Dornick({ config, transport, webmcp: { publish: true } });
// Registers dornick_set_email, dornick_set_plan, … one per configured dataPoint,
// each schema derived from the type / pattern / allowedValues you already wrote,
// plus the read-only workspace verbs and dornick_ask.
And it works in the other direction at the same time: Dornick’s own agent adopts every tool on
document.modelContext — yours, and anyone else’s — as real callable tools named
webmcp__*. One flag, both sides.
What to expect in each browser
| Environment | Who can see your tools |
|---|---|
Chrome 149+ with the origin trial or chrome://flags/#enable-webmcp-testing | the browser’s own agent, extensions, DevTools, page script |
| Anything else (polyfilled) | extensions, CDP/Playwright drivers, the MCP relay, page script |
A polyfill cannot reach the browser’s built-in agent — that’s a browser IPC surface, not page JavaScript. Plan for native if browser-agent reach is the goal; ship the polyfill either way, because it costs ~7 KB and covers everything else.
FAQ
Do I need Chrome's origin trial for this?
Only if you want the browser's own built-in agent to see your tools. Dornick's polyfill covers every other consumer — page script, Dornick itself, extensions, and CDP/Playwright drivers — in every modern browser.
How much tool code do I have to write?
For the fields Dornick already manages, none. `webmcp: { publish: true }` generates a setter per configured data point, with each JSON Schema derived from the type, pattern, and allowedValues in your config. You write tools only for operations Dornick doesn't already know about.
Is it safe to expose tools to any agent?
Dornick publishes read-only tools by default, and field writes route through the VFS so your beforeFieldFill hooks and ACLs still apply. Widening beyond that is an explicit opt-in.
Ship an agent-driven flow this afternoon.
Install Dornick, paste a config, and your form turns into an agent that fills its own inputs.