WebMCP gives your website two ways to hand AI agents a tool. One can take an afternoon. The other takes a developer and a plan.
Both end in the same place: an agent that can do something useful on your website without guessing. The difference is how much your site has to do behind the scenes.
Declarative: turn a form you already have into a tool
If your website has a form, you are most of the way there. A declarative tool is an ordinary HTML form with a few extra attributes: a name for the tool, a description of what it does, and a description for each field.
<form toolname="request_quote" tooldescription="Request a delivery quote between two cities">
<input name="from" toolparamdescription="City the goods leave from">
<input name="to" toolparamdescription="City the goods go to">
<button type="submit">Request quote</button>
</form>
The agent fills in the fields. By default, the form waits for a person to press submit, so nothing is sent without someone seeing it first.
Choose declarative when the action is already a form, the inputs are simple, and a human confirming the submit is exactly what you want.
Imperative: register a tool in JavaScript
An imperative tool is registered in your site’s JavaScript with document.modelContext.registerTool(). You give it a name, a description, a schema for its inputs, and the code that runs when an agent calls it.
This is the route for actions that are not a single form: checking stock across branches, returning available slots from a booking system, or combining several steps into one.
Choose imperative when the answer comes from your own systems, the inputs need checking, or the result has to come back to the agent rather than landing in an inbox.
The order we usually recommend
- Start declarative, on one form that already brings in business.
- Watch how agents use it. Read the submissions. Fix the descriptions that confused them.
- Add imperative tools where the form approach runs out, usually availability and stock.
Starting with the hard one first is tempting, especially for developers. It is also how projects end up six weeks late with nothing live.
A word about the descriptions
Whichever route you take, the descriptions do most of the work. “Submit” tells an agent nothing. “Request a delivery quote between two South African cities, for up to 30 pallets” tells it what the tool is for and when not to use it. Write them for a careful stranger.
Where to read more
Our WebMCP business briefing has both code examples, the current browser support and a glossary. For a worked, plain-language example of a declarative quote form for a tradesperson, see MyWebMCP’s guide to AI quote requests.
The next step
Not sure which of your forms to start with? The free Agent-Readiness Snapshot ranks them for you.
Free worksheet: Your first three WebMCP tools (PDF). Pick the three jobs on your website to make ready for AI agents first. No email needed.
Leave a Reply