Skip to content

Spec the executeTool() API - #226

Merged
domfarolino merged 15 commits into
mainfrom
executeTools
Aug 14, 2026
Merged

Spec the executeTool() API#226
domfarolino merged 15 commits into
mainfrom
executeTools

Conversation

@domfarolino

@domfarolinodomfarolino commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR specifies the executeTool() API on ModelContext.

Closes#57.
Closes#117.
Closes#159.
Closes#160.

This PR also introduces the AbortSignal member to ModelContextExecuteToolOptions, but it is not wired up to actually abort the tool owner's callback yet. That will be handled in a follow-up PR towards fixing #48.


Preview | Diff

domfarolinoand others added 2 commits July 21, 2026 19:42
This CL introduces the `executeTool()` method to the `ModelContext`
interface in the WebMCP specification. This aligns the spec with the C++
implementation in Blink.
Key changes:
- Adds `executeTool()` and `ExecuteToolOptions` IDL definitions.
- Specifies the `executeTool()` algorithm, detailing cross-document
tool lookup, origin visibility checks, and asynchronous invocation
in the target document`s realm.
- Clarifies the execution callback arguments and JSON serialization.
- Incorporates `AbortSignal` handling for tool cancellation,
dispatching a `toolcancel` event in the target document.
- Fires `toolactivated` event in the target document.
- Updates IDL member access syntax to use idiomatic Bikeshed style.
Small things
Fix some things
Don't serialize
Object argument enforcement
Add AbortSignal issue
Small things
Comment threadindex.bs Outdated
Comment threadindex.bs Outdated
Comment threadindex.bs Outdated
Comment threadindex.bs Outdated
Comment threadindex.bs
Comment threadindex.bs Outdated
Comment threadindex.bs Outdated
Comment threadindex.bs
Comment threadindex.bs Outdated
Comment threadindex.bs Outdated

@beaufortfrancoisbeaufortfrancois left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment threadindex.bs
Comment threadindex.bs
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 28, 2026
See https://crrev.com/c/8121241/comment/a263bec5_46b078a4/ and
webmachinelearning/webmcp#226 (comment).
With both Mason *and* François in agreement about this, we should
migrate from DataError => NotSupportedError.
R=masonf
Bug: 489045948,536063275
Change-Id: I9e5fc78b082de179c016f8a16dc052744ee28513
brave-builds pushed a commit to brave/chromium that referenced this pull request Jul 28, 2026
See https://crrev.com/c/8121241/comment/a263bec5_46b078a4/ and
webmachinelearning/webmcp#226 (comment).
With both Mason *and* François in agreement about this, we should
migrate from DataError => NotSupportedError.
R=masonf
Bug: 489045948,536063275
Change-Id: I9e5fc78b082de179c016f8a16dc052744ee28513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8155899
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1669154}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 28, 2026
See https://crrev.com/c/8121241/comment/a263bec5_46b078a4/ and
webmachinelearning/webmcp#226 (comment).
With both Mason *and* François in agreement about this, we should
migrate from DataError => NotSupportedError.
R=masonf
Bug: 489045948,536063275
Change-Id: I9e5fc78b082de179c016f8a16dc052744ee28513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8155899
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1669154}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 28, 2026
See https://crrev.com/c/8121241/comment/a263bec5_46b078a4/ and
webmachinelearning/webmcp#226 (comment).
With both Mason *and* François in agreement about this, we should
migrate from DataError => NotSupportedError.
R=masonf
Bug: 489045948,536063275
Change-Id: I9e5fc78b082de179c016f8a16dc052744ee28513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8155899
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1669154}
Comment threadindex.bs Outdated
@beaufortfrancoisbeaufortfrancois mentioned this pull request Jul 28, 2026
Comment threadindex.bs
Comment threadindex.bs
Comment threadindex.bs
lando-workerBot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jul 30, 2026
…SupportedError", a=testonly
Automatic update from web-platform-tests
WebMCP: Reject invalid origins with "NotSupportedError"
See https://crrev.com/c/8121241/comment/a263bec5_46b078a4/ and
webmachinelearning/webmcp#226 (comment).
With both Mason *and* François in agreement about this, we should
migrate from DataError => NotSupportedError.
R=masonf
Bug: 489045948,536063275
Change-Id: I9e5fc78b082de179c016f8a16dc052744ee28513
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8155899
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1669154}
--
wpt-commits: bcbf3234805101c41303f35a874913fc70b2d966
wpt-pr: 61564
@domfarolino
domfarolino marked this pull request as ready for review August 13, 2026 20:33
@domfarolino

Copy link
Copy Markdown
CollaboratorAuthor

FYI most of the reviews for this PR happened while in draft mode, graciously by @beaufortfrancois. So I think everything is all addressed and ready to merge here, including the documentation changes in the explainer.

(Note that related to this, Chromium recently got support for tools that keep executing after unregistration. The spec change for this will come after this PR, addressing #218.)

@domfarolino
domfarolino merged commit f303c45 into mainAug 14, 2026
2 checks passed
@domfarolino
domfarolino deleted the executeTools branch August 14, 2026 15:06
github-actionsBot added a commit that referenced this pull request Aug 14, 2026
SHA: f303c45
Reason: push, by domfarolino
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

4 participants

@domfarolino@beaufortfrancois@bvandersloot-mozilla@anssiko