Implements WebMCP Imperative API to register browser tools via navigator.modelContext.registerTool() with JSON schemas, execute callbacks, annotations, and lifecycle management in JavaScript.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin webmcp-browser-agentsThis skill is limited to using the following tools:
**Fetch live docs**:
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
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.