WebMCP API updates

François Beaufort
François Beaufort

Published: November 26, 2026

Explainer Web Extensions Chrome Status Intent
GitHub Origin trial Origin trial View Intent to Experiment

Follow this page to track API additions, behavior changes, and breaking changes to WebMCP across Chrome releases.

Code examples in earlier releases reflect the API shape at the time of each change. Refer to the Imperative API and Declarative API documentation for the latest usage.

Chrome 160

New Tool interface replaces RegisteredTool dictionary

Following PR #348, the objects returned by getTools() are now instances of a new Tool interface instead of RegisteredTool dictionaries. In addition, the window member, which exposes the window of the document that registered the tool, is now called source. This change starts in Chrome 160.0.8173.0.

Each Tool returned by getTools() has a unique internal ID. executeTool() refers to this ID to run the tool. This fixes several race conditions, such as a tool being unregistered while it runs. It also prepares for running tools registered by opaque origin documents and for future worker integration.

Because Tool is now an interface object, be aware of these additional compatibility changes:

  • When left empty, inputSchema, outputSchema, and annotations are now null instead of undefined.
  • JSON.stringify(tool) returns "{}", and the spread operator ({...tool}) copies nothing. Read the attributes you need explicitly instead.
  • structuredClone(tool) throws, since Tool is not serializable.

The following example reads a tool's properties while staying backward-compatible with the previous RegisteredTool dictionary:

const tools = await document.modelContext.getTools();
for (const tool of tools) {
  // TODO: Remove `tool.window` fallback when Chrome 160 reaches Stable (January 5, 2027).
  const source = tool.source ?? tool.window;

  // Use explicit properties rather than JSON.stringify(tool) or {...tool}.
  const { name, title, description, origin } = tool;
  const inputSchema = tool.inputSchema ?? null;
  const outputSchema = tool.outputSchema ?? null;
  const annotations = tool.annotations ?? null;

  console.log({ name, title, description, origin, inputSchema, outputSchema, annotations, source });
}

Chrome 159

Add outputSchema support in registerTool

From Chrome 159.0.8140.0, document.modelContext.registerTool() supports an optional outputSchema property. Use it to declare a JSON Schema for the tool's return value, the same way inputSchema describes its parameters. The spec change is in PR #254.

The spec doesn't yet define whether executeTool() fails when a tool's output doesn't match its outputSchema (see issue #92). For now, agent harnesses should check each tool's output against its outputSchema before returning it to the model. If it doesn't match, send the model a clear validation error instead of the malformed data. For an example, see webmcp-extension PR #98.

await document.modelContext.registerTool({
  name: "getWeather",
  description: "Returns the current weather for a city.",
  inputSchema: {
    type: "object",
    properties: { city: { type: "string" } },
    required: ["city"]
  },
  outputSchema: {
    type: "object",
    properties: {
      temperature: { type: "number" },
      conditions: { type: "string" }
    },
    required: ["temperature", "conditions"]
  },
  async execute({ city }) { /* ... */ }
});

Chrome 156

Relocate ontoolactivated and ontoolcancel to document.modelContext

From Chrome 156.0.8076.0, the ontoolactivated and ontoolcancel event handler properties move from window to document.modelContext (see PR #245). These event handlers indicate when tool execution starts and when it is canceled, respectively.

The following example handles both events while maintaining backward compatibility with the legacy event handlers:

const targetFor = (type, listener, options) =>
  (`on${type}` in (document.modelContext ?? {}) ? document.modelContext : window)
    .addEventListener(type, listener, options);

targetFor("toolactivated", ({ toolName }) => {
  console.log(`Tool "${toolName}" started execution.`);
});
targetFor("toolcancel", ({ toolName }) => {
  console.log(`Tool "${toolName}" execution is cancelled.`);
});

Add debugging member to ToolAnnotations

From Chrome 156.0.8067.0, ToolAnnotations includes a new debugging member.

Set debugging to true when registering tools for developer tooling. This includes inspection, framework testing, and Chrome DevTools AI assistance. This helps general purpose and end-user agents to filter out developer-focused tools. Full technical details are available in PR #253.

await document.modelContext.registerTool({
  name: "getInternalState",
  description: "Returns internal component state for diagnostics and troubleshooting.",
  inputSchema: {
    type: "object",
    properties: { componentId: { type: "string", description: "ID of the component to inspect" } },
    required: ["componentId"],
  },
  execute: ({ componentId }) => {
    return myFramework.getState(componentId);
  },
  annotations: {
    readOnlyHint: true,
    debugging: true, // Diagnostic tool intended for troubleshooting
  },
});

Chrome 155

Change executeTool input arguments type

Following PR #246 and PR #251, the input arguments type for executeTool() changed from DOMString to an optional JavaScript object from Chrome 155.0.8052.0.

Previously, executeTool() required stringified input arguments. Accepting an optional JavaScript object directly avoids manually calling JSON.stringify() and aligns with ToolExecuteCallback's inputObject. The promise returned by executeTool() now rejects if the input object is neither a valid JavaScript object nor serializable to a JSON string.

The following example passes an input object while maintaining backward compatibility for existing stringified input arguments:

const inputObject = { answer: 42 };

let result;
try {
  result = await document.modelContext.executeTool(myTool, inputObject);
} catch (e) {
  // TODO: Remove when executeTool doesn't accept JSON stringified inputArgs in Chrome Stable.
  if (e.message.startsWith("Failed to parse input")) {
    result = await document.modelContext.executeTool(myTool, JSON.stringify(inputObject));
  } else {
    throw e;
  }
}

Change RegisteredTool inputSchema type

Following PR #241, the inputSchema property type on RegisteredTool changed from DOMString to a JavaScript object from Chrome 155.0.8051.0. This change initially landed in Chrome 154.0.8014.0 and was temporarily reverted.

Previously, while ModelContextTool#inputSchema was defined as an object during registration, RegisteredTool#inputSchema returned a stringified JSON schema (DOMString) when retrieved using getTools(). This change resolves that inconsistency by ensuring RegisteredTool#inputSchema always returns a JavaScript object that is a deep copy of the schema provided at registration.

The following example handles inputSchema as an object while maintaining backward compatibility for existing stringified JSON schemas:

const [tool] = await document.modelContext.getTools();
const inputSchemaObject =
  typeof tool.inputSchema === "string" ? JSON.parse(tool.inputSchema) : tool.inputSchema;

Chrome 154

Add consequentialHint member to ToolAnnotations

From Chrome 154.0.8017.0, ToolAnnotations includes a new consequentialHint member.

Set consequentialHint to true when registering tools that perform high-stakes, irreversible, or real-world actions—such as booking flights, transferring funds, or deleting data. This hint signals agents to require explicit user confirmation prior to execution, helping prevent unintended or unauthorized actions. For complete technical details, see issue #176.

await document.modelContext.registerTool({
  name: 'book_flight',
  description: 'Book a flight for the user with confirmed flight details.',
  inputSchema: {
    type: 'object',
    properties: {
      flightId: { type: 'string', description: 'ID of the flight to book' },
      passengers: { type: 'number', description: 'Number of tickets to purchase' },
    },
    required: ['flightId', 'passengers'],
  },
  annotations: {
    readOnlyHint: false,
    consequentialHint: true,
    untrustedContentHint: false,
  },
  execute: async ({ flightId, passengers }) => {
    // Add your flight booking transaction logic here.
    return `Booked ${passengers} passenger(s) on flight ${flightId}.`;
  },
});

Chrome 153

Pass AbortSignal to ModelContextTool execute function

From Chrome 153.0.8009.0, the execute function for tools registered using document.modelContext.registerTool() always receives signal in its second argument, changing the signature to execute(inputObject, { signal }). Find the full technical details in issue #48 and PR #247.

This allows tools to gracefully handle execution cancellations initiated by the user or agent. Passing this signal to long-running asynchronous tasks or network operations (such as fetch()) helps prevent unnecessary work, improves overall resource management, and avoids potential leaks.

Additionally, unregistering a tool no longer automatically cancels in-flight executions, eliminating unexpected side effects when managing tool lifecycles in component frameworks.

The following example forwards signal to a fetch() request so network activity is immediately aborted when execution is canceled. For declarative API usage, refer to PR #321.

await document.modelContext.registerTool({
  name: "fetch_tool",
  description: "Fetch the text content of a URL and stream the response.",
  inputSchema: {
    type: "object",
    properties: {
      url: { type: "string", description: "The URL to fetch" },
      priority: { type: "string", enum: ["high", "low", "auto"] },
    },
    required: ["url"],
  },
  execute: async ({ url, priority }, { signal }) => {
    // Abort the fetch request when tool execution is aborted.
    const response = await fetch(url, { priority, signal });
    const stream = response.body.pipeThrough(new TextDecoderStream());
    for await (const chunk of stream) {
      document.querySelector("pre").textContent += chunk;
    }
    return "Success";
  },
});

Chrome 152

navigator.modelContext, which was deprecated in Chrome 150, is removed as of Chrome 152.0.7943.0. Use document.modelContext instead.

Chrome 151

Return a Promise from registerTool

The document.modelContext.registerTool() method returns a Promise starting in Chrome 151.0.7922.0. This change, detailed in issue #175, is necessary because cross-origin iframe integration allows tools to be shared across the frame tree, making registration fundamentally asynchronous. The Promise resolves only when the tool is actually available to getTools() in other documents, ensuring better error handling and forward compatibility as the API evolves.

Update your code to use the asynchronous pattern shown in the following example. For practical examples, see how the WebMCP demos were updated in PR #228.

try {
  await document.modelContext.registerTool(myTool);
} catch (e) {
  console.error('Tool registration failed:', e);
}

Chrome 150

To align with the fact that tools are effectively per-document, the WebML CG agreed to move the modelContext getter from the Navigator interface to the Document interface. Find the full technical details in issue #173 and PR #184.

navigator.modelContext is deprecated as of Chrome 150.0.7861.0 and was later removed in Chrome 152. Use document.modelContext instead.

The following feature detection pattern maintains compatibility across Chrome releases before and after the move. For practical examples, see how the WebMCP demos were updated in PR #189.

const modelContext = document.modelContext || navigator.modelContext;
if (modelContext) {
  // Register tools...
}

Chrome 149

Add untrustedContentHint member to ToolAnnotations

From Chrome 149.0.7810.0, ToolAnnotations includes a new untrustedContentHint member.

Explicitly set untrustedContentHint to true if the tool processes data from external or unverified sources to indicate that the tool's output contains data that is untrusted from the perspective of the author registering the tool. Full technical details are available in issue #136.

navigator.modelContext.registerTool({
  name: "addTodo",
  description: "Add a new item to the todo list",
  inputSchema: {
    type: "object",
    properties: { text: { type: "string" } },
  },
  execute: ({ text }) => {
    // You should handle the persistence logic here (omitted for demo)
    return `Added todo: ${text}`;
  },
  annotations: { readOnlyHint: false, untrustedContentHint: true },
});

Chrome 148

Replace unregisterTool with AbortSignal in registerTool

The WebML CG agreed that unregistering a tool should require the same level of ownership as unregistering an event listener. To prevent scripts from inadvertently or maliciously unregistering tools they didn't create, unregisterTool() is removed.

From Chrome 148.0.7757.0, registerTool() supports an optional AbortSignal. Aborting this signal triggers the tool's unregistration. Full technical details are available in PR #147.

To maintain compatibility across releases, use a wrapper similar to the following example. You can also refer to PR #104 to see how WebMCP demos were updated.

const controller = new AbortController();
navigator.modelContext.registerTool(myTool, { signal: controller.signal });

// Unregister tool later...
navigator.modelContext.unregisterTool?.(myTool.name);
controller.abort();

Remove toolparamtitle attribute

From Chrome 148.0.7730.0, the toolparamtitle attribute is removed. As discussed in PR #76 by the WebML CG, nothing contributes to the title field in the synthesized JSON Schema anymore. Using the standard HTML <label> element for this purpose remains a possibility for the future.

Chrome 147

Remove provideContext and clearContext

To improve the WebMCP API shape, the provideContext() and clearContext() methods are removed from Chrome 147.0.7721.0. This change, detailed in issue #101, addresses two primary architectural concerns:

  • By clearing existing tools before registering new ones, provideContext() posed a security risk where third-party scripts could unintentionally or maliciously overwrite official tools and hijack user-agent interactions.
  • Feedback indicated that "delete-all" patterns are unconventional in web APIs. Developers preferred an additive model similar to addEventListener, allowing scripts to manage their own registrations independently.

To maintain more granular and secure control, use registerTool() and unregisterTool() (later replaced by AbortSignal in Chrome 148).