In brief, an agent involves your web site, discovers what WebMCP instruments you provide, reads what each does, and calls the one that matches the duty.
There are two methods to set this up: HTML for varieties or JavaScript for extra advanced makes use of.
Bear in mind, these instruments solely work whereas the web page is open; there’s no headless or background mode, and the browser has to maintain working.
Declarative API (HTML)
The declarative API is the simpler implementation, meant for actions that already dwell in a kind. For instance, a reservation, signup, or contact request.
To implement this, you merely want so as to add a few attributes to the shape you have already got:
- toolname provides the instrument a reputation
- tooldescription explains what it does
- toolparamdescription, non-compulsory, and tells the agent what that area expects
From there, the browser turns the shape right into a instrument. By default, solely your individual website can use it.
To see the declarative API in motion, I loaded Google’s Le Petit Bistro demo with the Mannequin Context Instrument Inspector open. It’s a Chrome extension that lists the instruments a web page has registered and allows you to enter a immediate and watch its Gemini-powered take a look at agent name them.
Only a heads up, you’ll want a Gemini API key for this (you should use the free tier).
The demo is a restaurant reservation web page with one reserving kind. The fields embrace identify, cellphone quantity, date and time, and many others.
Certain sufficient, the shape confirmed up within the Inspector as a registered instrument, full with its schema. The panel reveals precisely which WebMCP instruments an agent can see on a website.









