/webmcp-browser-agents:webmcp-register-toolfrom webmcp-browser-agents
Implements WebMCP's imperative API — register tools via navigator.modelContext.registerTool() with proper schemas, execute callbacks, and lifecycle management. Use when building dynamic tool registration in JavaScript.
Ships in webmcp-browser-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Fetch live docs:
https://webmachinelearning.github.io/webmcp/ for the latest registerTool method signature and parameterswebmcp navigator.modelContext registerTool specification for the full API referencesite:developer.chrome.com webmcp registerTool for Chrome-specific guidancesite:github.com mcp-b registerTool for polyfill-compatible registration patternsnavigator.modelContext.registerTool() is the core imperative method for exposing a tool to AI agents. Each registered tool becomes discoverable and invocable by any agent integrated with the browser.
A tool object passed to registerTool() has these fields:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique tool identifier (e.g., "addToCart") |
description | string | Yes | Natural-language description for the agent |
inputSchema | object | Yes | JSON Schema defining accepted parameters |
execute | async function | Yes | Callback (input, client) => Promise<result> |
annotations | object | No | Safety hints (readOnlyHint, destructiveHint, idempotentHint) |
The execute(input, client) callback:
inputSchema, already parsed as a JavaScript objectModelContextClient object providing requestUserInteraction() for human-in-the-loop flowsnavigator.modelContext.registerTool(tool) makes the tool discoverableexecutenavigator.modelContext.unregisterTool(name) removes the toolSimple read-only tool:
navigator.modelContext.registerTool({
name: "getProductInfo",
description: "Get details about a product by ID",
inputSchema: {
type: "object",
properties: { productId: { type: "string" } },
required: ["productId"]
},
annotations: { readOnlyHint: true },
async execute(input) {
const res = await fetch(`/api/products/${input.productId}`);
return await res.json();
}
});
Transactional tool with user confirmation:
navigator.modelContext.registerTool({
name: "placeOrder",
description: "Place the current order and charge the saved payment method",
inputSchema: { type: "object", properties: {}, required: [] },
annotations: { destructiveHint: true },
async execute(input, client) {
const confirmed = await client.requestUserInteraction((resolve) => {
showConfirmDialog("Confirm order?", resolve);
});
if (!confirmed) return { status: "canceled" };
const res = await fetch("/api/orders", { method: "POST" });
return await res.json();
}
});
searchProducts, not search-products)addToCart not add)cart.add, cart.remove or addToCart, removeFromCartTools should handle errors gracefully:
Tools can be registered and unregistered dynamically based on page state:
clearContext() on page transitions in SPAsFetch the specification for exact method signatures, return types, and any new fields before implementing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
14 skills in this plugin
/webmcp-authenticationImplement WebMCP authentication patterns — browser session inheritance, cookie-based auth, role-gated tool registration, and conditional tool exposure. Use when managing which tools are available based on user authentication state./webmcp-commerce-toolsImplement commerce-specific WebMCP tools — product search, cart management, checkout, returns, subscriptions, and support. Use when building agentic shopping experiences on e-commerce websites./webmcp-context-providerImplement the WebMCP provideContext API — bulk tool registration, contextual metadata, page state sharing, and dynamic context updates. Use when providing rich context and multiple tools to agents simultaneously./webmcp-declarative-formsImplement the WebMCP Declarative API — annotate HTML forms with toolname and tooldescription attributes for automatic tool extraction. Use when making existing forms agent-ready with minimal code changes./webmcp-dev-patternsApply WebMCP cross-cutting development patterns — SPA routing, error handling, performance optimization, multi-site agents, accessibility, SEO, and production deployment. Use when architecting WebMCP-enabled sites or solving cross-cutting concerns./webmcp-mcp-bridgeIntegrate WebMCP client-side tools with backend MCP servers and UCP endpoints — bridge browser-based agent interactions with server-to-server protocols. Use when connecting front-end WebMCP to existing backend API infrastructure.npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin webmcp-browser-agentsOther plugins' skills for the same job