What is a WebMCP tool?
A WebMCP tool is an action a web page offers an AI agent, such as search or add to cart, with a name, a description and a schema for its inputs.
Definition
A WebMCP tool is an action a web page offers to an AI agent in the browser: search the catalogue, add to cart, book a slot. The page registers it through WebMCP, and an agent can then call it directly, with no working out which button to press.
What a tool is made of
document.modelContext.registerTool({
name: 'search_products',
description: 'Search the catalogue by keyword. Returns up to 20 products with price and stock.',
inputSchema: {
type: 'object',
properties: { query: { type: 'string', description: 'What the shopper is looking for' } },
required: ['query'],
},
async execute({ query }) { /* run the search, return the result */ },
});
- Name: a short identifier.
- Description: plain language saying what the tool does and when to use it. The agent chooses tools by reading this.
- Input schema: the parameters, as JSON Schema.
- Execute: the function that does the work, running in the page with the visitor's own session.
A tool can also be declared in HTML, on a form, with no JavaScript.
What makes a good one
Most tool problems are in the description and the schema, not the code: a description that does not say when to use the tool, a parameter with no description, two tools that overlap. An agent faced with any of these guesses, or picks nothing.
Why it matters
Tools run inside the visitor's browser, so a call never appears in a server log. Whether a tool was called, and whether it failed, can only be seen from the page. A check lists the tools a page registers and flags weak contracts.