Repository navigation
WebMCP audit fixes: spec page corrections, typed tool defs, budgets, evals - #261
Merged
Merged
Conversation
…evals
Spec page (agent-readiness/webmcp.md):
- consequentialHint, not destructiveHint (not a WebMCP annotation)
- drop mode: 'summarize' (not in the spec)
- verification: execute() resolves strings, not MCP { content: [...] }
- document untrustedContentHint + debugging, opt-in-only rule
- summary: document.modelContext is the current surface
- changelog entry added
Implementation (src/lib/webmcp.ts):
- tool metadata is now typed data checked against webmcp-types at build
time (new devDependency); helpers/execute emitted via Function.toString()
- list_topics: paginated (page/page_size, default 10) instead of dumping
all 177 topics (~53k chars)
- get_topic: offset/limit line paging with a continuation hint instead of
dumping up to ~12k chars
- registerTool() awaited per tool; rejections warn instead of unhandled
- execute() forwards the AbortSignal to fetch()
- titles added to all five tools
- structured error payloads { error, code, retryable?, suggestion? }
- removed annotations: { readOnlyHint: false } from the UI tools
(annotations are strictly opt-in; omission means false)
Also:
- webmcp.schema.json (generated from the built bundle via
scripts/emit-webmcp-schema.mjs, new npm run webmcp:schema) and
webmcp.evals.json (11 cases in the Chrome Labs evals format) for
npx webmcp-evals local -t webmcp.schema.json -e webmcp.evals.json
- /mcp page documents the browser WebMCP tools
- eslint override for the verbatim-emitted helpers (repo precedent:
BaseLayout byte-frozen script)
Deploying specification-website with
|
| Latest commit: |
02fd391
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://43166216.specification-website.pages.dev |
| Branch Preview URL: | https://webmcp-audit-fixes.specification-website.pages.dev |
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.
Audited our WebMCP implementation against the current spec (webmcp-types) and the Chrome Labs review checklist.
Spec page (
agent-readiness/webmcp.md, + changelog entry):consequentialHint, notdestructiveHint(not a WebMCP annotation)mode: 'summarize' (not in the spec)execute()can resolve any JSON-serialisable value;executeTool()serialises it, and an MCP{ content: [...] }envelope is not requireduntrustedContentHint+debugging, and the opt-in-only ruledocument.modelContextas the current surfaceImplementation (
src/lib/webmcp.ts):webmcp-typesat build time (new devDependency) — a renamed annotation is now a build error; helpers/execute are emitted verbatim viaFunction.toString()list_topics: paginated (page/page_size, default 10) instead of dumping all 177 topics (~53k chars, 35x the recommended budget)get_topic:offset/limitline paging with a continuation hint instead of dumping up to ~12k charsregisterTool()awaited per tool; rejections warn instead of surfacing as unhandled rejectionsexecute()forwards theAbortSignalto topic fetches; the shared manifest fetch is independent, with cancellation handled per callertitleon all five tools; structured errors{ error, code, retryable?, suggestion? }; removed the forbiddenreadOnlyHint: falsedeclarations on the UI toolsAlso:
webmcp.schema.json(generated from the built bundle viascripts/emit-webmcp-schema.mjs, newnpm run webmcp:schema) +webmcp.evals.json(11 cases in the Chrome Labs evals format) — runnable vianpx webmcp-evals local -t webmcp.schema.json -e webmcp.evals.json/mcppage now documents the browser WebMCP toolsVerified:
astro checkclean, eslint clean, full build +check-integritypass, and a stubbed-browser harness confirmed unchanged behavior on all previously-working paths (search ranking, short-page reads, checklist navigation) plus the new pagination/truncation/structured-error/signal paths.Regression coverage: five tests exercise the generated browser bundle for independent cancellation, already-aborted calls, cancelled topic reads, network retries, and listener cleanup. CI runs them after the build. Local build, Astro check, lint, formatting, and Agent Skill integrity checks pass.