Skip to content

Add executeTool() - #2

Draft
MiguelsPizza wants to merge 1 commit into
alex/core-polyfillfrom
alex/execute-tool
Draft

MiguelsPizza wants to merge 1 commit into
alex/core-polyfillfrom
alex/execute-tool

Conversation

@MiguelsPizza

@MiguelsPizza MiguelsPizza commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

WIP - currently having some AI's do reviews. Below is AI generated

this adds executeTool() on top of #1, following the draft algorithm: object input, JSON-serialized results, and cancellation that hands the callback its own fresh signal and a default AbortError while the caller gets its own reason back. The method is declared by a local augmentation that mirrors webmcp-types#3 exactly, including ModelContextExecuteToolOptions, so removing it once that ships is a straight deletion.

The execution tests are their own file, so this PR is mostly one new file rather than hunks spliced through the registration tests.

100 browser tests and the package checks pass. WPT is at 51 passing assertions including all 22 IDL checks, with five expected failures recorded per assertion in wpt-metadata. The pin is the WPT export of the Chromium CL for #246 and #251 and it rewrote all four of those files, so these aren't stale tests waiting on an update: the draft's input and result rules haven't moved since #251 merged. Four of the five call executeTool() with no input, which the draft rejects with a TypeError before it looks the tool up; object-arguments wants an unquoted "Success" back from a callback whose result the draft JSON-serializes. Unexpected passes fail the run too, so these can't quietly go green. Details in TESTING.md.

One thing I'd like your read on: a tool.window from another document rejects with UnknownError, matching step 16.1, rather than NotSupportedError as I originally had it. Extension integration is #3.

@MiguelsPizza
MiguelsPizza force-pushed the alex/core-polyfill branch 2 times, most recently from bea387f to 1be0c1f Compare September 14, 2026 15:30
@MiguelsPizza
MiguelsPizza force-pushed the alex/execute-tool branch 2 times, most recently from 49e0a43 to a8d5c56 Compare September 14, 2026 15:50
@MiguelsPizza
MiguelsPizza force-pushed the alex/execute-tool branch 2 times, most recently from ad06f90 to f757b99 Compare September 14, 2026 21:48
@MiguelsPizza
MiguelsPizza force-pushed the alex/core-polyfill branch 2 times, most recently from 34da5b6 to 855027d Compare September 15, 2026 16:38
Implement executeTool() against the current draft: object input, JSON-serialized results, and abort handling that gives the callback its own signal and a default AbortError while the caller receives its own reason. Extend the WPT selection from 13 files to 18, and from 27 assertions to 56, now that the interface is complete enough for the IDL harness.

Record as per-subtest expected failures in wpt-metadata the four upstream files that disagree with the draft on omitted input and on result serialization, rather than patching tests or relaxing the implementation. Carry a temporary ModelContext augmentation mirroring webmcp-types#3 until that ships.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant