Register WebMCP tools with cache-stable schemas and frozen targets - #9
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Problem and behavior
Follow-up to #8, which is already merged. WebMCP calls previously required the model to copy a session-local
toolRefinto a generic execution wrapper. This change registers each discovered capability as a scopedwebmcp__tool with its business parameter schema, so the model supplies the business arguments directly.Tool names derive from canonical capability content rather than random session/document IDs. Existing declarations survive navigation and loading; currently available tools are reported through append-only runtime context. A bounded historical catalog avoids accumulating unlimited obsolete declarations.
Each model step separately freezes its execution bindings at
agent/pre-step. Reading browser context or previewing a prompt cannot retarget a call already generated for another page. Dispatch still validates tab, document, frame, revision and schema; stale calls are rejected before dispatch, and uncertain actions are never automatically replayed. The runtime implementation stays in the Cordis browser plugin; upstream Harness source and unrelated Jev work are excluded.Compatibility:
browser_webmcp_calland its legacy identity arguments are removed. Browser discovery now returnscallName; Builder guidance and DevTools guidance use the registered business tools. Benchmark diagnostics count both historical wrapper calls and new direct calls.Benchmark evidence and limitations
Six selected WebMCP ON cases, three attempts per case/model. These are historical comparisons, not a full-suite or concurrent randomized A/B result. USD estimates use actual uncached input, cache reads, cache writes and output separately; Luna is API-equivalent pricing.
Compared with the short-reference implementation from #8:
The intermediate direct-tool experiment had cache hit rates of 68.8%/53.7%; stable declarations recover these to 79.0%/54.5%, not to the short-reference baseline. Newly discovered capabilities still change the top-level tool list. MiMo also becomes slower than that intermediate experiment (194.3 → 323.3 sec), mainly in the order task.
MiMo's
hev-1third attempt returned an empty tool name/ID, then the next request failed with HTTP 400. It remains in the results without replacement, and early termination makes the aggregate cost unsuitable as a same-success-quality claim. Across the other five tasks, all three repeats pass; mean cost is $0.026222 → $0.018658 compared with the intermediate direct-tool run. The malformed-call handling is not fixed here.The report also preserves individual cost/cache regressions, two interrupted infrastructure starts before any model attempt, frozen model/configuration/source checks, and the unused historical Jev-tool schema difference. All 12 course/order completion audits verify successful tool results rather than relying on final prose.
Sanitized per-attempt datasets are included; raw conversations, credentials and generated build outputs are not committed.
Validation and review
pnpm checkandpnpm buildpassed.pnpm testpassed withNODE_OPTIONS=--no-experimental-webstorage. Default Node 25 initially failed an unrelated jsdomlocalStorage.cleartest; the environment flag resolves that conflict without changing business code.Code/tests and benchmark documentation are separate commits for review. The benchmark JSON is verbose; start with the runtime/bindings diff and the Markdown report. This PR is for review, with no main merge or deployment performed.