Repository navigation
fix(devframe): use WebMCP draft tool hints and honor abort signal - #496
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "daf0a0c94b669cacec979e9d9f9e638f9b7ddf87",
"result": {
"overallSummary": "Aligns devframe's WebMCP tool projection with the current WebMCP draft spec: using the draft's own ToolAnnotations names (so browsers that drop unknown dictionary members still see safety hints) and honoring the execute abort signal, plus a related fix so tool manifest changes under the same id correctly notify MCP clients.",
"groups": [
{
"key": "webmcp-hints",
"label": "WebMCP draft hints and abort",
"summary": "Switches the WebMCP tool projection from MCP-only annotation names to the current WebMCP draft's ToolAnnotations (readOnlyHint, consequentialHint, debugging), while keeping the older MCP-shaped fields for compatibility, and makes execute honor an abort signal so a cancelled call rejects with the signal's reason instead of being left dangling.",
"category": "api",
"filePaths": [
"packages/devframe/src/client/webmcp.ts"
],
"fileNotes": [
{
"path": "packages/devframe/src/client/webmcp.ts",
"text": "raceAbort rejects on abort but cannot stop the underlying handler; its late result or error is simply discarded.",
"critical": true
}
]
},
{
"key": "client-agent-sync",
"label": "Full manifest comparison on sync",
"summary": "Fixes a missed-notification bug: re-sync previously compared only tool ids, so a changed description or input schema under the same id did not notify MCP clients. Now the whole manifest is compared via JSON equality.",
"category": "api",
"filePaths": [
"packages/devframe/src/node/client-agent.ts"
],
"critical": true
},
{
"key": "tests",
"label": "Tests and type snapshot",
"summary": "Covers the new draft hints, consequential/destructive mapping, abort-before-call and abort-during-call behavior, and the manifest-change re-sync notification; updates the generated type snapshot for the new optional fields and execute signature.",
"category": "tests",
"filePaths": [
"packages/devframe/src/client/webmcp.test.ts",
"packages/devframe/src/node/__tests__/client-agent.test.ts",
"tests/__snapshots__/tsnapi/devframe/client.snapshot.d.ts"
]
},
{
"key": "docs",
"label": "Docs update",
"summary": "Documents the new WebMCP hint names, the debugging flag, and the abort/cancellation behavior for browser-side tools.",
"category": "docs",
"filePaths": [
"docs/content/1.guide/15.agent-native.md"
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-18T00:15:31.723Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
antfu
approved these changes
Nov 18, 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.
Summary
The WebMCP projection in
devframe/clientused MCP's annotation names. The current WebMCP draft defines its ownToolAnnotations(readOnlyHint,consequentialHint,untrustedContentHint,debugging) and has nodestructiveHint. WebIDL drops unknown dictionary members, so browsers that follow the draft never saw that a tool was destructive.Changes in
registerWebMcpTools:readsetsreadOnlyHint,destructivesetsconsequentialHint, and every tool setsdebugging: true(devframe tools are developer tooling, the case the draft names).titleis set at the top level of the tool, as in the draft'sModelContextTool.destructiveHintandannotations.titlestay, for earlier drafts and polyfills that follow the MCP shape.execute(input, { signal })now honors the signal. An aborted call rejects withsignal.reason. A call whose signal is already aborted does not run the handler. A running handler cannot be stopped, so its late result is dropped.A separate fix in
node/client-agent.ts: when a tab re-syncs its tools, the check compared only tool ids. A changed description or input schema under the same id did not notify MCP clients that the tool list changed. It now compares the whole manifest.Spec reference: WebMCP draft
index.bs(ToolAnnotations,ModelContextTool,execute(input, { signal })).User prompts
Model: Claude Opus 5.5 in Claude Code (Paseo).
Verification
pnpm vitest run packages/devframe/src/client/webmcp.test.ts packages/devframe/src/node/__tests__/client-agent.test.ts: 21 passed. New tests cover the draft hints,consequentialHinton destructive tools, rejection on abort (during a call and before it), and a notify on a changed manifest under the same id.pnpm lint,pnpm knip,pnpm typecheck,pnpm build: pass.pnpm test: 1871 passed, 2 failed. The failures areadapters/__tests__/dev.test.ts("does not share a port held on 127.0.0.1") andadapters/__tests__/initiate.test.ts("ws.sidecar on localhost"), withProxy response (502)from the sandbox HTTP proxy. Both fail the same way onmain(06d41e39) with this diff removed.devframe/clienttype snapshot is updated for the new optional fields and theexecuteoptions argument.This PR was written with an AI agent. The human gave the task and chose the scope. The human has not reviewed the diff yet.