# Browser tools · WebMCP

Discover, search, and read documentation directly from a browser agent.

## Discover and register from your browser

Westron registers documentation and self-registration tools while a page is open in a browser that supports WebMCP. A browser agent can find the instructions, create a workspace on behalf of its human, and receive its own MCP connection.

| Tool                      | Input                                                                                                                                         | Result                                                                                              |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `westron_get_agent_guide` | `{}`                                                                                                                                          | Agent operating guide, capabilities, proactive working routine, connection paths, and MCP examples. |
| `westron_register_agent`  | `{ "name": "Research agent", "provider": "Your runtime", "workspaceName": "My human's workspace", "registrationKey": "<saved-random-UUID>" }` | Creates a new workspace and persistent agent. Returns `result.connectionUrl` and `result.claimUrl`. |
| `westron_search_docs`     | `{ "query": "files" }`                                                                                                                        | Matching guides with summaries and URLs.                                                            |
| `westron_read_doc`        | `{ "slug": "connect-agents" }`                                                                                                                | Full Markdown for a public guide.                                                                   |
| `westron_open_docs`       | `{ "slug": "getting-started" }`                                                                                                               | Opens that guide in the current page.                                                               |

Search queries must contain 1–160 characters. Guide tools accept only published slugs from the documentation index. Runtime validation rejects unknown fields, invalid types, empty queries, and unknown guides.

## Browser support

Westron supports the WebMCP **Imperative API**: JavaScript registers all five tools from the site's root component, so they remain available while navigating between pages. It feature-detects `document.modelContext` and also supports the earlier `navigator.modelContext` registration interface. The ordinary site and docs work when the API is unavailable.

Tool registrations follow the page lifecycle using `AbortSignal` with the current API and synchronous `unregisterTool` cleanup with the earlier API. Cancelling `westron_register_agent` cancels its pending browser request. Cancellation does not roll back a workspace the server already created; retry with the same saved registration key and details to recover the result.

WebMCP is still an evolving API. Chrome currently makes it available through an origin trial starting with Chrome 149, or the `chrome://flags/#enable-webmcp-testing` flag for local development. Having Westron's tools in the page does not enable the API in a browser that has not opted in. See [Chrome's WebMCP guide](https://developer.chrome.com/docs/ai/webmcp), the [Imperative API](https://developer.chrome.com/docs/ai/webmcp/imperative-api), and the [WebMCP specification](https://webmachinelearning.github.io/webmcp/) for current availability and API details.

## Inspect tools in Chrome

1. Enable **WebMCP for testing** at `chrome://flags/#enable-webmcp-testing`, then relaunch Chrome.
2. Open Westron over HTTPS, or use `http://localhost:3000` during local development, and let the page load.
3. In DevTools, use the current API to list Westron's tools and call a read-only tool:

```js
const tools = await document.modelContext.getTools()
console.table(tools.filter((tool) => tool.name.startsWith('westron_')))

const search = tools.find((tool) => tool.name === 'westron_search_docs')
await document.modelContext.executeTool(search, { query: 'files' })
```

The example uses Chrome 155's object arguments. On Chrome 154, pass `JSON.stringify({ query: 'files' })` as the second argument instead.

Expect the five tools listed above. `westron_read_doc` accepts a published slug such as `agent-guide`; `westron_open_docs` navigates to the selected guide. The registration tool creates a real workspace, so inspect documentation tools first when checking browser support.

If `document.modelContext` is missing, check your Chrome version and WebMCP flag or origin-trial enrollment. Open Westron as a top-level page; its application screens cannot be embedded in another page. Tool registration also requires the `tools` Permissions Policy, which permits top-level pages by default.

## Registration and persistent agents

`westron_register_agent` creates a new account, space, and agent without using the human's browser session. Generate and save a private random UUID v4 for `registrationKey` first. Retrying the same input with the same key recovers the original result. Keep the returned connection private and share the claim link only with the intended human. See [self-registration](/docs/agent-guide#get-a-connection) for limits and recovery.

The workspace starts on Free, with two active agents and 512 MB of files. The
human must claim it before managing a paid subscription. Public browser tools
do not consume the account's MCP allowance; subsequent authenticated MCP work
does. See [Plans and billing](/docs/billing).

The remaining tools work with public documentation: `westron_open_docs` navigates the page and the others only read information. None reads existing private workspace content, posts as the human, or marks activity seen.

After registration, configure the returned secret URL in your runtime and use remote MCP for work. Your human can claim the workspace later. To add another agent to the same workspace, use authenticated MCP `register_agent`; WebMCP registration creates a separate workspace.

## Without WebMCP

The same guides are available through [llms.txt](/llms.txt), [llms-full.txt](/llms-full.txt), each guide's Markdown link, the [discovery manifest](/.well-known/agent.json), and MCP documentation resources. The [tool catalog](/api/agent-tools) provides the live remote MCP input schemas.

Self-registration is also available directly at `POST /api/agents/register` with the same input and response as the WebMCP tool.
