Help us improve
Share bugs, ideas, or general feedback.
Implement WebMCP Declarative API: annotate HTML forms with toolname/tooldescription attributes for automatic agent tool extraction and submission handling.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin webmcp-browser-agentsHow this skill is triggered — by the user, by Claude, or both
Slash command
/webmcp-browser-agents:webmcp-declarative-formsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Fetch live docs**:
Implements and debugs browser WebMCP integrations in JavaScript/TypeScript web apps for exposing imperative or declarative tools via modelContext.
Applies WebMCP patterns for SPA tool lifecycle, error handling, performance optimization, multi-site agents, accessibility, SEO, and production deployment.
Guides adding WebMCP to web applications for AI accessibility, LLM UI tools, and MCP browser automation. Covers design principles, tool architecture, and testing workflows.
Share bugs, ideas, or general feedback.
Fetch live docs:
https://webmachinelearning.github.io/webmcp/ for the declarative form attribute specificationwebmcp declarative form toolname tooldescription HTML attributes for attribute syntax and behaviorsite:developer.chrome.com webmcp declarative forms for Chrome implementation detailswebmcp SubmitEvent agentInvoked for the agent submission event APIThe Declarative API lets developers make existing HTML forms agent-ready by adding attributes — no JavaScript required for basic cases. Chrome auto-extracts form tools and exposes them to agents.
| Attribute | Applied To | Purpose |
|---|---|---|
toolname | <form> | Unique tool name (becomes the tool's name) |
tooldescription | <form> | Natural-language description for the agent |
Standard name, type | <input>, <select>, <textarea> | Mapped to JSON Schema properties automatically |
toolname and tooldescription to a <form> elementSubmitEvent fires with agentInvoked property set to true<form toolname="searchProducts" tooldescription="Search the product catalog by keyword and price range">
<label>
Search: <input name="query" type="text" required />
</label>
<label>
Max Price: <input name="maxPrice" type="number" min="0" />
</label>
<label>
Category:
<select name="category">
<option value="all">All</option>
<option value="electronics">Electronics</option>
<option value="clothing">Clothing</option>
</select>
</label>
<button type="submit">Search</button>
</form>
form.addEventListener("submit", (event) => {
if (event.agentInvoked) {
// Agent submitted this form — handle programmatically
event.preventDefault();
const data = new FormData(form);
handleAgentSearch(Object.fromEntries(data));
}
// Otherwise, normal user submission
});
The browser infers JSON Schema from form fields:
<input type="text"> → { type: "string" }<input type="number"> → { type: "number" }<input type="email"> → { type: "string", format: "email" }<input required> → Added to required array<select> → { type: "string", enum: [...options] }<input type="checkbox"> → { type: "boolean" }| Scenario | Recommended |
|---|---|
| Simple search or filter forms | Declarative |
| Legacy server-rendered pages | Declarative |
| Complex multi-step interactions | Imperative |
| Dynamic SPA with state management | Imperative |
| Quick agent enablement of existing forms | Declarative |
| Tools that need user confirmation dialogs | Imperative |
| Both simple and complex on one page | Both |
A page can use both declarative forms and imperative tools simultaneously:
toolname/tooldescription attributesnavigator.modelContext.registerTool()toolname values that clearly identify the actiontooldescription for the agent, not the user — explain what the form does and what it returnsname attributes are semantic (query not q, maxPrice not mp)agentInvoked submissions gracefully — return structured data, not HTML redirectsrequired attributes to mandatory fields so the schema reflects themFetch the specification for exact attribute names, SubmitEvent properties, and schema inference rules before implementing.