Guide · WebMCP

navigator.modelContext: how to move to document.modelContext

Updated · Checked against the WebMCP draft of 19 November 2026 · By the WebMCP Agency research desk

On this page
  1. The short answer
  2. Why it moved from navigator to document
  3. Old calls and their replacements
  4. Before and after
  5. Should you keep navigator as a fallback?
  6. Find old code on your site

If your code calls navigator.modelContext, it is written for an older draft of WebMCP. The current draft, dated 19 November 2026, defines the API on the document only: document.modelContext. Several methods from the first drafts are gone too: provideContext(), clearContext() and unregisterTool().

This page lists each old call, what replaced it and when, and shows old code rewritten for the current draft.

The short answer

Use document.modelContext. The draft’s IDL is:

partial interface Document {
  [SecureContext, SameObject] readonly attribute ModelContext modelContext;
};

The word navigator does not appear anywhere in the 19 November 2026 draft. Chrome’s imperative-API docs, last updated on 20 November 2026, also use only document.modelContext.

Why it moved from navigator to document

A page’s tools belong to that page. Objects reached through navigator are not tied to one document in the same way: the first about:blank document in a frame shares its Window with the document that loads next, so tools could leak across that navigation. On 19 May 2026 the spec scoped ModelContext to the Document (#177, “Scope ModelContext to Document, and handle detached documents”), while the getter itself stayed on navigator. On 27 May 2026 the getter moved to document (#184, “Move the modelContext getter to Document”). Now a page’s tools end with the page.

Old calls and their replacements

Old code Use now Changed
navigator.modelContext document.modelContext 27 May 2026 (#184)
provideContext(...) One registerTool() call per tool 5 March 2026 (#132)
clearContext() Abort the signal you passed to registerTool() 5 March 2026 (#132)
unregisterTool(name) Abort the signal you passed to registerTool() 27 March 2026 (#156)
registerTool() used as if it returned at once await registerTool() in try and catch 8 June 2026 (#200)
executeTool(tool, jsonString) executeTool(tool, inputObject) 17 August 2026 (#246)
Tool lists as plain dictionaries with window Tool objects with source 19 November 2026 (#348)

provideContext() and clearContext() were removed because they replaced the page’s whole set of tools, so one script could wipe out tools another script had registered.

Before and after

Old code often looked like this:

// Old: an earlier draft. Do not use.
navigator.modelContext.registerTool(searchTool);
// ...later
navigator.modelContext.unregisterTool('search_articles');

The same thing for the current draft:

const tools = new AbortController();

async function registerSearchTool() {
  if (!document.modelContext?.registerTool) return; // no WebMCP in this browser
  try {
    await document.modelContext.registerTool(
      {
        name: 'search_articles',
        title: 'Search articles',
        description: 'Search the articles on this site by keyword. Returns up to 10 matches.',
        inputSchema: {
          type: 'object',
          properties: { query: { type: 'string', description: 'Words to search for.' } },
          required: ['query'],
        },
        annotations: { readOnlyHint: true },
        async execute({ query }, { signal }) {
          const res = await fetch(`/api/search?q=${encodeURIComponent(query)}`, { signal });
          return (await res.json()).slice(0, 10);
        },
      },
      { signal: tools.signal },
    );
  } catch (err) {
    console.warn('WebMCP tool not registered:', err.name, err.message);
  }
}

registerSearchTool();

// Later, to remove every tool registered with this signal:
// tools.abort();

What changed:

  • document, not navigator. Feature-detect with document.modelContext?.registerTool.
  • await the call. registerTool() returns a Promise. The draft rejects it with InvalidStateError for an invalid or duplicate name, an empty description, or a document that is not fully active, and with NotAllowedError when the page is not allowed to use the tools feature. If the signal is already aborted, it rejects too.
  • A signal instead of unregisterTool(). Pass { signal } as the second argument, then call abort() on its controller to remove the tool. One controller can remove a group of tools at once.
  • title is a field on the tool, not inside annotations.

Chrome’s docs add a detail about aborting: from Chrome 153, aborting the signal removes the tool but no longer cancels a call to it that is already running.

Should you keep navigator as a fallback?

No. Code such as (document.modelContext || navigator.modelContext) targets a draft that no longer exists. Neither the current draft nor Chrome’s imperative-API docs define navigator.modelContext, so a fallback adds nothing you can rely on. Feature-detect document.modelContext and do nothing when it is missing.

Find old code on your site

Search your code and any third-party scripts you load for these strings:

  • navigator.modelContext
  • provideContext
  • clearContext
  • unregisterTool

Then check the tools the browser actually registers. Our free check reports the WebMCP tools it found, and its Check in Chrome button shows which tools Chrome lists. For other causes of tools not showing up, see WebMCP not working, and for a full walk-through, how to add WebMCP. Dated changes to the draft are in the spec tracker.

Questions people ask

Is it navigator.modelContext or document.modelContext?

document.modelContext. The WebMCP draft of 19 November 2026 defines modelContext on Document only. The spec moved the modelContext getter from navigator to document on 27 May 2026 (#184). Chrome's imperative-API docs use only document.modelContext.

Why was navigator.modelContext removed?

Tools belong to one page. Through navigator, tools could leak across a navigation, because the first about:blank document in a frame shares its Window with the next document. The spec tied each ModelContext to its Document on 19 May 2026 (#177) and moved the getter to document on 27 May 2026 (#184), so a page's tools go away with that page.

What replaced unregisterTool?

Pass an AbortSignal when you call document.modelContext.registerTool(tool, { signal }), then call abort() on its AbortController. unregisterTool was removed from the proposal on 27 March 2026 (#156).

What replaced provideContext and clearContext?

Register each tool with its own registerTool() call. provideContext() and clearContext() were removed on 5 March 2026 (#132) because they could overwrite tools that other scripts on the page had registered.

Does modelContext.registerTool return a Promise?

Yes. Since #200 (8 June 2026), registerTool() returns a Promise. It rejects on an invalid or duplicate name, an empty description, or when the page is not allowed to use the tools feature, so await it inside try and catch.

Sites in the directory

Real sites whose WebMCP tools worked in Chrome, with the date we last found them working.

See every site in the directory

Sources

  1. WebMCP, Draft Community Group Report (19 November 2026) (read 2026-11-20)
  2. WebMCP imperative API (Chrome for Developers) (read 2026-11-20)
  3. WebMCP pull request #177: Scope ModelContext to Document (read 2026-11-20)
  4. WebMCP pull request #184: Move the modelContext getter to Document (read 2026-11-20)
  5. WebMCP pull request #132: remove provideContext and clearContext (read 2026-10-24)
  6. WebMCP pull requests: remove unregisterTool (#156) (read 2026-10-24)
  7. WebMCP commit history (#200, #246) (read 2026-10-23)
  8. WebMCP commit history (#348, the Tool interface) (read 2026-11-20)