---
title: "Give in-browser agents your tools · Agent Wranglers"
url: https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents/webmcp
id: AGT-68
level: Optional
updated: 2026-10-27
build: a2a6bdfed830
tokens: 886
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Give in-browser agents your tools

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Ready for AI agents](https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: AGT-68
- Level: Optional
- Chapter: [Ready for AI agents](https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents.md)
- Rule: Register the site's tools with the browser through WebMCP. Mark the ones with effects, and report expected failures in the tool's answer.
- Check: In a browser with WebMCP turned on, the tools appear with their schemas. Calling each one with a bad input returns a readable failure.
- How: Where `document.modelContext` exists, call `registerTool` for each tool with its schema. Chromium 150 deprecated the older `navigator.modelContext`, and Chromium 152 removed it. Pass an `AbortSignal` and abort it to remove the tool. Set `readOnlyHint` on tools that only read, and `consequentialHint` on tools with effects. Set `untrustedContentHint` on tools that return text other people wrote. A thrown error reaches the agent without its message, so return expected failures as data. WebMCP is a draft from a W3C Community Group, not a W3C standard. Chrome offers it as an origin trial, and other browsers do not ship it. Tools with effects need a clear yes, as [Ask a person before the agent spends or deletes](https://agentwranglers.se/playbook/ai-features/agents-in-products/agent-approval-irreversible.md) says.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
const modelContext = document.modelContext ?? navigator.modelContext;
const tools = new AbortController();
if (modelContext) {
  await modelContext.registerTool({
    name: 'book_call',
    description: 'Book a call at a free time slot.',
    inputSchema: { type: 'object', properties: { slot: { type: 'string' } }, required: ['slot'] },
    annotations: { consequentialHint: true },
    async execute({ slot }) {
      const res = await fetch('/api/book', {
        method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ slot }),
      });
      if (!res.ok) return { booked: false, reason: 'Slot not available, pick another' };
      return { booked: true, slot };
    },
  }, { signal: tools.signal });
}
```

## Related rules

- AIF-70 [Ask a person before an agent does what cannot be undone](https://agentwranglers.se/playbook/ai-features/agents-in-products/agent-approval-irreversible.md) in AI features

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents/webmcp">Agent Wranglers agents as users playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Publish a topic index for agents](https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents/topic-index.md)
- Next: [Package your knowledge for agents](https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents/okf-bundle.md)
- [Ready for AI agents](https://agentwranglers.se/playbook/agents-as-users/ready-for-ai-agents.md)
