Open
Conversation
Bridge BAP with the W3C WebMCP standard by adding a discovery/discover protocol method that detects tools exposed by websites via declarative HTML attributes (form[toolname]) and the imperative navigator.modelContext API. WebMCP tools are also available through the existing observe flow via an opt-in includeWebMCPTools parameter. - New protocol types: WebMCPTool, DiscoveryDiscoverParams/Result - Server: progressive feature detection with graceful fallback - Client SDK: discoverTools() method - MCP bridge: discover_tools tool + observe integration - Docs: BAP vs WebMCP comparison, README section, adoption guide update
Add docs/browser-tools-guide.md — a fact-based decision guide comparing BAP with Playwright MCP and Playwright CLI, including reproducible benchmark data, architecture overview, and recommendation flowchart. - README: add discover_tools to tools table, add "Choosing a Browser Tool" section - docs/webmcp-comparison.md: add "Decision Guide: When to Use What" section - TODO-ADOPTION.md: mark benchmark table item done, add comparison framing anti-pattern
- README "Why BAP?" now cites benchmark result (73% fewer calls) instead of unverified "40x fewer tokens" - README CLI docs link: 26 commands → 23 commands - webmcp-comparison.md ecosystem row: 26 → 23 commands
Replace inflated "73% fewer tool calls" and "40x token reduction" claims with verified numbers from the reproducible benchmark suite. Three-variant model: BAP Standard (observe-first, apples-to-apples) uses ~15% fewer calls than Playwright. BAP Fused (optimization layer) uses ~37% fewer. Add "Where Playwright Wins" section covering latency, element disambiguation, setup simplicity, and ecosystem.
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
discovery/discoverprotocol method that bridges BAP with the W3C WebMCP standardform[toolname]) and the imperativenavigator.modelContextAPIagent/observeflow via opt-inincludeWebMCPToolsparameterdiscover_toolsMCP tool for AI agents to discover page-exposed toolsChanges
Protocol (
packages/protocol)discovery.tstypes:WebMCPToolSource,WebMCPToolSchema,DiscoveryDiscoverParams/ResultAgentObserveParamswithincludeWebMCPToolsandAgentObserveResultwithwebmcpToolsdiscovery/discovertoBAPMethodSchemaenumServer (
packages/server-playwright)discoverWebMCPTools()helper with progressive feature detection (declarative + imperative, try-catch, graceful degradation)handleDiscoveryDiscover()handler + dispatch casehandleAgentObserve()to optionally include WebMCP toolsClient SDK (
packages/client)discoverTools(pageId?, options?)method onBAPClientMCP Bridge (
packages/mcp)discover_toolstool definition + handlerincludeWebMCPToolsparam added toobservetoolDocs
docs/browser-tools-guide.md— fact-based decision guide: BAP vs Playwright MCP vs Playwright CLI with reproducible benchmark data, architecture overview, and recommendation flowchartdocs/webmcp-comparison.md— full BAP vs WebMCP comparison + "Decision Guide: When to Use What" sectiondiscover_toolsto tools table, "Choosing a Browser Tool" section, WebMCP decision guide linkTODO-ADOPTION.md— adoption plan with messaging guide; marked benchmark table item as doneTests (5 new test files, all passing)
Test plan
pnpm build— all 7 packages build cleanlypnpm typecheck— no type errors (10 tasks)pnpm test— 450 tests pass, 0 failurespnpm lint— 0 errors (3 pre-existing warnings)discover_toolson a regular page → empty array