> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-b.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# WebMCP standard API

> Quick lookup for the document-first WebMCP surface and its compatibility APIs.

The authoritative API definition is the
[W3C WebMCP specification](https://webmachinelearning.github.io/webmcp/).
Chrome's current implementation notes live in the
[Chrome WebMCP imperative API docs](https://developer.chrome.com/docs/ai/webmcp/imperative-api).

## Canonical surface

New code uses `document.modelContext`.

| Member                                   | Purpose                                                          |
| ---------------------------------------- | ---------------------------------------------------------------- |
| `registerTool(tool, { signal })`         | Publish a tool and bind its lifetime to an optional abort signal |
| `getTools()`                             | Discover registered tool objects                                 |
| `executeTool(tool, inputJson, options?)` | Execute a tool object returned by `getTools()`                   |
| `toolchange`                             | Notify consumers that available tools changed                    |

```ts theme={null}
const controller = new AbortController();

document.modelContext.registerTool(tool, {
  signal: controller.signal,
});

controller.abort();
```

`getTools()` and `executeTool()` are the producer-facing discovery and execution
path in Chrome's current preview. `registerTool()` returns `Promise<void>`, and
tool cleanup is tied to the optional `AbortSignal` passed at registration time.

## Compatibility

* `navigator.modelContext` is a deprecated alias for migration.
* `navigator.modelContextTesting` is a compatibility surface for testing.
* `listTools()`, deprecated `callTool()` compatibility helpers, prompts,
  resources, sampling, elicitation, and transports are MCP-B extensions.
* `outputSchema` is not part of the current W3C/Chrome WebMCP tool
  dictionary. MCP-B packages expose it as helper metadata for type inference,
  structured MCP responses, and polyfill/runtime adapters.

See [`@mcp-b/webmcp-polyfill`](/packages/webmcp-polyfill/reference) for the
portable strict runtime.
