TECHNICAL FIX MANUAL / 03

Implement WebMCP with confirmation

WebMCP lets a participating browser surface a website’s declared operations to an agent as named tools. Finding the syntax is a useful clue, but it doesn’t prove that the action is available, supported, or safe to execute.

Back to Agent Action Check

Implementation checklist

  1. 01

    Choose a useful read-only action, such as viewing available times. Give it a specific name and describe what it does and does not change.

  2. 02

    Inspect the form and use its named fields to draft a schema. Validate the allowed values at your server boundary, and avoid passing secrets or sensitive fields as tool arguments.

  3. 03

    Feature-detect document.modelContext and register the tool in a supporting browser. Pass AbortSignal to any async operations. Use the browser’s safety annotations and enforce your own confirmation for side effects.

  4. 04

    Test the runtime tool with valid, invalid, cancelled and repeated requests. Verify that inaccessible actions remain inaccessible, and keep conventional form controls usable.

WebMCP lets a participating browser surface a website’s declared operations to an agent as named tools. Finding the syntax is a useful clue, but it doesn’t prove that the action is available, supported, or safe to execute.

From visual guessing to declared capabilities

An agent can often navigate unfamiliar controls by reading labels, links and form fields. But a label that makes sense to a person can still be ambiguous to software. A declared tool gives the browser a name, a description and an input schema. The schema identifies fields and types so an agent can supply arguments directly instead of guessing which widget to operate. This is useful for read-only operations such as searching a site, filtering listings, or showing available appointment times. It does not replace accessible form labels, validation messages, keyboard support, or an ordinary human-facing workflow.

Understand what static inspection finds

The scanner looks for literal API names in initial HTML and up to five same-origin scripts. It also checks for experimental declarative attributes on elements and identifies forms in the response. A literal string can occur in a comment or an unused bundle, so its presence is not proof of successful registration. A working tool can be invisible to this check if it is loaded dynamically, bundled under another name, or registered from a runtime state we do not reach. Going live requires testing in a supported browser with the feature enabled; use static results to decide where to look.

Use the current browser surface and detect support

Current Chrome documentation shows imperative registration on document.modelContext and identifies navigator.modelContext as deprecated. Feature availability varies by browser and version, so check for registerTool before calling it. Keep your website functional when support is missing. Pair readable operation names with concise descriptions, and make the input schema describe the values your server actually accepts. Pick a small, reversible task for the first implementation. Review existing options, required fields, bounds, and defaults rather than treating every string scraped from the HTML as authoritative.

Keep preview, confirmation and execution separate

A generated schema is a starting point, not production action logic. Validate inputs on the server, use the signed-in visitor’s actual permissions, and treat tool output that includes third-party or user-provided text as untrusted. When someone might book, buy, broadcast, or change records, show them exactly what would happen and require explicit confirmation in a trusted interface. Browser annotations can help describe risk but are not a substitute for your application’s authorization and confirmation. Pass the supplied AbortSignal to cancellable operations and do not claim cancellation can undo a completed transaction.

Test the action in realistic states

Inspect the tool list on a supported browser. Verify that the expected tool appears only on the right page and disappears when its underlying action becomes unavailable. Test missing fields, invalid values, repeated calls, a signed-out visitor, permission failures, and cancellation at each stage. Confirm that a preview does not mutate anything and that duplicate submission does not create multiple bookings. Keep your original UI available for people who do not use an agent. After deployment, rerun static inspection and compare it with actual runtime behavior rather than assuming either result tells the whole story.

Keep authorization on your server

Tool schemas describe accepted inputs; they do not grant permission to perform an action. Keep execution behind server-side validation and authorization, and bind the current user and session on the server rather than trusting values an agent supplies. Treat search results and other remote content as untrusted, and set timeouts and rate limits on every endpoint. For actions that can change records, book appointments or spend money, show a human-readable preview and obtain explicit confirmation before executing. Keep a normal website flow for visitors whose browsers do not support WebMCP.

Check the results

Chrome’s WebMCP imperative API documentation

FIELD NOTES

Frequently asked questions

Does finding a form mean it is already a WebMCP tool?

No. An ordinary HTML form is not proof of an agent-facing tool. Look for an explicit registration or supported declarative definition.

Does the scanner ever call an agent tool or submit a form?

No. It inspects public HTML and limited script text. Generated snippets preview a schema and do not submit forms.

Is navigator.modelContext the same as document.modelContext?

They refer to different revisions of the browser API. Current Chrome guidance uses document.modelContext; check feature support in your target browsers.