Spec the executeTool() API - #226
Draft
domfarolino wants to merge 10 commits into
Draft
Conversation
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
| </div> | ||
|
|
||
| <div algorithm> | ||
| The <dfn method for=ModelContext>executeTool(<var>tool</var>, <var>inputArguments</var>, |
Contributor
There was a problem hiding this comment.
A JS example of how to execute a tool from a cross-origin iframe may come handy in this spec. See previous comment at #223 (comment)
beaufortfrancois
left a comment
Contributor
There was a problem hiding this comment.
We should update README as well: https://github.com/webmachinelearning/webmcp#discovering-and-running-tools
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}
| <div algorithm> | ||
| The <dfn>declarative execute steps</dfn> are as follows. | ||
|
|
||
| domfarolino |
Contributor
There was a problem hiding this comment.
Nit: Maybe replace with TODO for now
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR specifies the
executeTool()API onModelContext.Closes #57.
Closes #117.
Closes #159.
Closes #160.
Preview | Diff