Skip to content

WebMCP audit fixes: spec page corrections, typed tool defs, budgets, evals - #261

Merged
jdevalk merged 2 commits into
mainfrom
webmcp-audit-fixes
Oct 16, 2026
Merged

jdevalk merged 2 commits into
mainfrom
webmcp-audit-fixes

Conversation

@jdevalk

@jdevalk jdevalk commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

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, not destructiveHint (not a WebMCP annotation)
  • dropped mode: 'summarize' (not in the spec)
  • verification: execute() can resolve any JSON-serialisable value; executeTool() serialises it, and an MCP { content: [...] } envelope is not required
  • documents untrustedContentHint + debugging, and the opt-in-only rule
  • summary now names document.modelContext as the current surface

Implementation (src/lib/webmcp.ts):

  • tool metadata is typed data checked against webmcp-types at build time (new devDependency) — a renamed annotation is now a build error; helpers/execute are emitted verbatim via Function.toString()
  • list_topics: paginated (page/page_size, default 10) instead of dumping all 177 topics (~53k chars, 35x the recommended budget)
  • 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 surfacing as unhandled rejections
  • execute() forwards the AbortSignal to topic fetches; the shared manifest fetch is independent, with cancellation handled per caller
  • title on all five tools; structured errors { error, code, retryable?, suggestion? }; removed the forbidden readOnlyHint: false declarations on the UI tools

Also:

  • webmcp.schema.json (generated from the built bundle via scripts/emit-webmcp-schema.mjs, new npm run webmcp:schema) + webmcp.evals.json (11 cases in the Chrome Labs evals format) — runnable via npx webmcp-evals local -t webmcp.schema.json -e webmcp.evals.json
  • /mcp page now documents the browser WebMCP tools
  • eslint override for the verbatim-emitted helpers (same precedent as the byte-frozen BaseLayout script)

Verified: astro check clean, eslint clean, full build + check-integrity pass, 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.

…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)
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Deploying specification-website with  Cloudflare Pages  Cloudflare Pages

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

View logs

@jdevalk
jdevalk merged commit 24d5b49 into main Oct 16, 2026
9 checks passed
@jdevalk
jdevalk deleted the webmcp-audit-fixes branch October 16, 2026 07:02
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