1.1.0: execution AbortSignals + document.modelContext consumer API - #54
Merged
Conversation
4 tasks
kashishhora
force-pushed
the
feat/execution-signals-and-consumer-api
branch
2 times, most recently
from
September 3, 2026 20:44
07d2354 to
6698a81
Compare
AGENTS.md still named navigator.modelContextTesting as the external-call path
in the architecture note and the Testing section, which would steer new tests
at a surface that is removed in 2.0.0. Name document.modelContext.getTools() /
executeTool() instead and mention the shim only as deprecated.
Drop the unused `{ signal }` destructure from the README quick start — it
trips noUnusedParameters for anyone copying the first snippet. The 1.1.0
section still shows the two-argument handler.
kashishhora
force-pushed
the
feat/execution-signals-and-consumer-api
branch
from
September 3, 2026 20:45
6698a81 to
0ee5484
Compare
naji247
approved these changes
Sep 3, 2026
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.
What changed
Built on #53 (the 1.0.0 release, now merged) — this is the 1.1.0 delta on top of it.
Chrome's WebMCP implementation moved in three steps (per the Chrome WebMCP team's EPP announcements, checked against Chromium source):
navigator.modelContextTesting. The consumer API isdocument.modelContext.getTools()/executeTool()(shipping since 150.0.7861.0).executeasexecute(input, { signal })— webmcp issue #48, spec PR #247. From 153.0.8008.0, unregistering a tool no longer cancels its in-flight executions (issue #218).RegisteredTool.inputSchemafrom a JSON string to an object (spec PR #241).Library
src/types.ts—ToolDescriptor.executeand the confighandlertake(input, { signal }). NewToolExecuteCallbackOptions,ExecuteToolOptions,RegisteredTool(inputSchema: InputSchema | string, since 153 and 154 differ),ModelContextGetToolOptions;ModelContextgains optionalgetTools/executeTool. One-argument handlers still type-check.src/hooks/useMcpTool.ts— the directexecute()path and the registered descriptor now share onerunHandler. Handlers always receive a realAbortSignal; on Chrome <=152 (which passes no options) a never-aborting one is substituted. When an aborted execution's handler rejects it's treated as cancellation:isExecutingclears,state.errorandonErrorare left alone.execute(input?, { signal }?)accepts a caller signal.src/polyfill/execute.ts(new) — one execution engine behind bothexecuteTooland the shim: per-executionAbortController, a caller abort rejects withsignal.reasonwhile the tool-side signal aborts with a genericAbortError(what 153 does), late settlement after abort is ignored, tool failures rejectUnknownError, results serialize the way native does. Input is still validated againstinputSchema(OperationError); native doesn't validate yet (issue #92).src/polyfill/index.ts—document.modelContext.getTools()/executeTool()on the polyfill: fresh sorted objects, deep-copied objectinputSchema(the 154 shape),fromOriginsvalidation,UnknownErrorfor a stale tool. In-flight executions survive unregistration.src/polyfill/testing-shim.ts— now a thin wrapper over the engine that warns once thatnavigator.modelContextTestingis deprecated (removal planned for 2.0.0). Keeps its historicalNotFoundError/OperationErrorinput errors.docs/api.md(Cancellation section and a Chrome compat table), AGENTS.md, both skills, CHANGELOG. Version bump to 1.1.0.Test plan
pnpm typecheck/pnpm lint(zero warnings) /pnpm buildpnpm test— 205 passing: both execution paths, cancellation semantics, engine abort races and serialization, consumer API, shim parityThe extension and examples migration is stacked on this branch in a follow-up PR.