A book about WebMCP

Tools, Not Clicks

Building Agent-Ready Websites with WebMCP

v2.0.2Second edition, November 2026Tested with Chrome 156 and the WebMCP draft of 27 October 2026

WebMCP lets a page hand the browser's agent real tools: named, described, schema-typed functions it calls directly, inside the user's own session, with the user watching and in control.

Listing 4.1 · from the book
// Progressive enhancement: do nothing where WebMCP isn't available.if ('modelContext' in document) {  const agentTools = new AbortController();  await document.modelContext.registerTool({    name: 'search_availability',    title: 'Search available tables',    description:      'Find open tables at Fjord Table for a date, time and party size. ' +      'Returns up to five nearby time slots. Does not make a booking.',    inputSchema: {      type: 'object',      properties: {        date:      { type: 'string', description: 'Visit date, YYYY-MM-DD' },        time:      { type: 'string', description: 'Preferred time, 24h HH:MM' },        partySize: { type: 'integer', minimum: 1, maximum: 12 }      },      required: ['date', 'partySize']    },    annotations: { readOnlyHint: true },    async execute({ date, time, partySize }, { signal }) {      // The same function the date picker calls when a human searches.      const slots = await availability.search({ date, time, partySize, signal });      bookingPanel.showSlots(slots);   // the user sees what the agent found

Contents

17 chapters in 6 parts

Free to read online, from the first chapter to the appendices. About 176,000 words.

  1. 1
    The Agentic Web ArrivesA tent, a deadline and a very patient robot · Agents in the browser · Actuation: using the web like a person · Where actuation breaks · The bill: cost, latency and reliability · Why sites have a stake · …
  2. 2
    From APIs to Tools: A Short HistoryOne capability, many descriptions · Before tools: APIs for programs · Teaching models to use tools · Function calling: JSON Schema becomes the lingua franca · OpenAPI meets the chatbot: plug-ins and actions · The description is the new documentation · …
  3. 3
    MCP in PracticeA tent, an order and a protocol · Where MCP came from · Architecture: hosts, clients and servers · The wire: JSON-RPC 2.0, one request at a time · What servers offer: tools, resources and prompts · What clients offer: elicitation · …
  4. 4
    Enter WebMCPTwo Fridays at Fjord Table · What WebMCP is · The problem: the actuation tax · The core idea: tools that live in the tab · A first taste of code · WebMCP and MCP: siblings, not twins · …
  1. 5
    Registering Tools with document.modelContextBack to Listing 4.1 · Where the API lives · ① Feature detection and secure contexts · ② The shape of registerTool() · ③ Names, titles and descriptions · ④ The input schema · …
  2. 6
    Annotations, Lifecycle and ErrorsWhat happens after registerTool() · The four annotation hints · The lifecycle of a tool call · Cancellation · Errors: the platform’s and your own · The toolchange event and keeping agents in sync · …
  3. 7
    Frames, Origins and Page-Embedded AgentsA page is more than one document · Two kinds of agent, two ways to see tools · Gate 1: the tools Permissions Policy · Gates 2 and 3: exposedTo and fromOrigins · getTools() and executeTool(): building an in-page agent · Extensions as agents · …
  4. 8
    The Declarative API: Forms as ToolsA form is already a tool · Where the declarative API came from · Three attributes · Schema synthesis: what the agent actually sees · The life of a declarative call · Submitting: the person’s click or toolautosubmit · …
  1. 9
    Your First WebMCP App, End to EndFrom pieces to an app · Local setup · Progressive enhancement, for real · Seeing what the agent sees · A Test Agent you can script · Polyfills and bridges · …
  2. 10
    WebMCP in FrameworksFrom a page to an app · What a framework integration has to do · React: two hooks · Tools as thin wrappers over one application service · Routing and per-view tool sets · Unregistering without breaking in-flight calls · …
  3. 11
    Designing Tools Agents Can Actually UseThe reader who can’t ask questions · Tool strategy and budget · Naming, descriptions and character budgets · Schemas that reduce ambiguity · Returning useful results and errors · Keeping agent-facing text in step with the UI · …
  1. 12
    Threat Models for Tool-Exposing PagesA new door into a house you already own · Who is attacking whom · ①② Prompt injection through your tools · ④ Misrepresentation of intent · ③ Over-parameterisation: the personalisation-to-fingerprinting pipeline · ⑤ Cross-origin exposure · …
  2. 13
    Privacy, Consent and the Human in the LoopWho presses the button? · Three parties, three kinds of consent · Building Trailhead's checkout · What a trusted click proves, and what it doesn't · Elicitation: asking the user in the middle of a call · Signed-in sessions and sensitive data · …
  1. 14
    Testing, Debugging and EvalsTwo kinds of “it works” · Seeing your tools · Layer 1: unit tests for execute callbacks · Layer 2: the browser contract · Layer 3: calling tools the way a browser agent does · Layer 4: evals · …
  2. 15
    Browser Support and the Standards RoadTwo answers to one question · Reading the signals · Chrome and Edge: two origin trials · Firefox and WebKit, in their own words · The TAG review · Who consumes WebMCP today · …
  1. 16
    Product and Business ImplicationsThe question on Kari’s whiteboard · Agent-readiness is not the new SEO (yet) · Choosing the first journeys · Keeping the agent a guest · Measuring agent-driven conversion · Pricing and policy questions · …
  2. 17
    The Road AheadKari’s second whiteboard · How to read an open question · Output schemas · Multimodal and streaming data · When the work outlives the document · Who sees your tools by default · …
Appendices

Reference

  1. A
    API Quick Reference (IDL, Attributes, Events, Errors)A.1 The interface at a glance · A.2 registerTool(tool, options) · A.3 getTools(options) and RegisteredTool · A.4 executeTool(tool, inputObject, options) · A.5 Events · A.6 Permissions Policy · …
  2. B
    GlossaryB.1 Terms, A to Z · B.2 The running examples
  3. C
    Resources and Further ReadingC.1 The specification and its repository · C.2 Chrome · C.3 Microsoft Edge · C.4 Standards positions, reviews and process · C.5 The Model Context Protocol · C.6 Packages the chapters use · …
  4. D
    Migration Notes: navigator.modelContext and provideContext() to document.modelContextD.1 What changed, and when · D.2 Before: the early-2026 shape · D.3 After: the current shape · D.4 Keeping the “swap the tool set” pattern · D.5 Finding old code paths · D.6 From the first edition to now (October to November 2026) · …
Back matter
  1. Release historyEvery edition, what changed, and when

Get the PDF

Subscribe to the newsletter and the PDF edition comes with the welcome email.

Get the PDF

For publishers

Interested in publishing this book? Contact Maxim Salnikov directly.

Contact Maxim Salnikov