Skip to content
Skills Library
AI & agents · Building & coding

webmcp-context-provider

/webmcp-context-provider

Implement 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.

Licence
MIT
Last repository change
14.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 14.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Implement 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.

Original author description

Implement 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.

How it works

  1. Before writing code
  2. Conceptual Architecture
Original SKILL.md headings · 133 lines, 498 words
SKILL.md preview
---
name: webmcp-context-provider
description: Implement 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.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
---

# WebMCP Context Provider

## Before writing code

**Fetch live docs**:
1. Fetch `https://webmachinelearning.github.io/webmcp/` for the `provideContext` method specification
2. Web-search `webmcp provideContext specification` for the API shape and options
3. Web-search `webmcp context metadata agent` for contextual data patterns
4. Web-search `site:developer.chrome.com webmcp context` for Chrome-specific context features

## Conceptual Architecture

### What provideContext Does

`navigator.modelContext.provideContext(options)` is a method for bulk registration of multiple tools and providing additional contextual metadata to agents. While `registerTool` adds one tool at a time, `provideContext` can set up an entire tool surface in a single call.

**Note:** This API is still being specified and may change. Always fetch the latest spec before implementing.

### Why Context Matters

Agents make better decisions when they understand the current page state:
- What page the user is on (product detail, cart, checkout)
- User's authentication state and preferences
- Current cart contents and totals
- Available promotions or special offers
- Site capabilities and limitations

### provideContext vs registerTool

| Aspect | registerTool | provideContext |
|--------|-------------|----------------|
| **Granularity** | One tool at a time | Multiple tools + metadata |
| **Metadata** | Tool-level only | Page-level context included |
| **Use case** | Dynamic, individual tools | Page initialization, bulk setup |
| **Lifecycle** | Register/unregister individually | Set/clear entire context |

### Contextual Metadata Patterns

Provide agents with situational awareness:

**Product page context:**
```js
navigator.modelContext.provideContext({
  tools: [viewDetails, addToCart, compareProducts],
  metadata: {
    pageType: "product-detail",
    productId: "sku-12345",
    productName: "Wireless Headphones",
    price: 79.99,
    inStock: true,
    userAuthenticated: true
  }
});
```

**Cart page context:**
```js
navigator.modelContext.provideContext({
  tools: [updateQuantity, removeItem, applyCoupon, checkout],
  metadata: {
    pageType: "shopping-cart",
    itemCount: 3,
    subtotal: 247.50,
    currency: "USD",
    hasShippingAddress: true,
    hasSavedPayment: true
  }
});
```

### Dynamic Context Updates

Update context as the page state changes:

```js
// Initial page load — browse tools
navigator.modelContext.provideContext({
  tools: [searchProducts, viewDetails],
  metadata: { pageType: "catalog", authenticated: false }
});

// User logs in — expand tools
navigator.modelContext.clearContext();
navigator.modelContext.provideContext({
  tools: [searchProducts, viewDetails, addToCart, getCartContents, checkout],
  metadata: { pageType: "catalog", authenticated: true, userName: "Alice" }
});

// Navigate to cart — switch tools
navigator.modelContext.clearContext();
navigator.modelContext.provideContext({
  tools: [updateQuantity, removeItem, applyCoupon, checkout],
  metadata: { pageType: "cart", itemCount: 3 }
});
```

### SPA Route-Based Context

In single-page applications, update context on route changes:

```js
router.on("routeChange", (route) => {
  navigator.modelContext.clearContext();

  switch (route.name) {
    case "catalog":
      provideCatalogContext();
      break;
    case "product":
      provideProductContext(route.params.id);
      break;
    case "cart":
      provideCartContext();
      break;
    case "checkout":
      provideCheckoutContext();
      break;
  }
});
```

### Best Practices

- Use `provideContext` for initial page setup; use `registerTool` / `unregisterTool` for incremental changes
- Include page type and user state in metadata so agents understand the current context
- Clear context on navigation and re-provide for the new page
- Keep metadata lightweight — summaries, not full data dumps
- Avoid including sensitive user data (email, address) in metadata — agents don't need it
- Update context when significant state changes occur (login, cart update, page navigation)

Fetch the specification for the exact `provideContext` options shape, metadata fields, and any new features before implementing.

Versions

The database has no other skills named webmcp-context-provider.

Database snapshot: 13.11.2026 · package version 6206ecd4aae6 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100webmcp-gen
    Build and validate experimental WebMCP tools for an existing web page. Use when an agent needs to expose a site's real workflows as page tools, create webmcp.init.js, define deterministic checks, or compare WebMCP with accessibility-tree automation.
  • 100webmcpx
    Add WebMCP tools to a website and check them. Use when a user wants AI agents to use their site, asks about WebMCP, navigator.modelContext or document.modelContext, registerTool, or wants to lint/validate WebMCP tool definitions.
  • 100crestapps-core-webmcp
    Skill for WebMCP in CrestApps.Core 2.0, the proposed W3C standard that lets a page give tools to browser AI agents through document.modelContext. Covers CrestApps.Core.AI.WebMcp with AddWebMcp and AddCoreAIWebMcp, MapWebMcpTools list and invoke endpoints, WebMcpOptions…
  • 100webmcp-tool-annotations
    Implement WebMCP tool annotations — readOnlyHint, destructiveHint, idempotentHint safety hints that inform browser permission prompts and agent behavior. Use when marking tools with appropriate safety metadata.
  • 100webmcp-testing
    Test WebMCP tools with AI agents — Chrome DevTools integration, agent testing workflows, tool discovery verification, and end-to-end commerce flow testing. Use when validating that tools work correctly with real AI agents.
  • 100webmcp
    Exposes a web page's functionality to AI agents as callable tools with WebMCP, a draft browser API (document.modelContext) from the W3C Web Machine Learning Community Group. Use when a user asks to "make my web app agent-ready", "let AI agents add items or search on my site",…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.