Skip to content

move WebCMP from navigator to document API #68947

@geromegrignon

Description

@geromegrignon

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

From the Built-in AI Early Preview Program:

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. You can find the full technical details in Issue 173 and PR #184.

navigator.modelContext is now deprecated as of Chrome 150.0.7861.0 and will be removed in a future Chrome release.
Use document.modelContext instead.

Proposed solution

Recommandations:

We (the Built-in AI Early Preview Program) suggest using the feature detection pattern shown below to maintain compatibility and ensure a smooth transition over the coming releases. For practical examples, see how we updated our WebMCP demos in PR #189.

const modelContext = document.modelContext || navigator.modelContext;

if (modelContext) {

  // Register tools...

}

Alternatives considered

No

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimegemini-triagedLabel noting that an issue has been triaged by gemini

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions