Skip to main content

Module webmcp

Module webmcp 

Source
Expand description

WebMCP tool discovery and execution.

WebMCP is a protocol where websites expose structured tool definitions to AI agents via navigator.modelContext. When a site supports WebMCP, the tools are explicitly defined with typed parameters and return values — the highest-reliability execution path.

WebMCP requires a browser context (the tools live in the page’s JS), but unlike DOM scraping, the tool contract is explicit and machine-readable.

Discovery is opportunistic: Cortex checks for WebMCP only when a browser context is already open (Layer 3 fallback or ACT). It never opens a browser just to check for WebMCP.

Structs§

WebMcpResult
Result of executing a WebMCP tool.
WebMcpTool
A tool exposed by a web page via the WebMCP protocol.

Functions§

discover_webmcp_tools
Discover WebMCP tools available on the current page.
execute_webmcp_tool
Execute a WebMCP tool on the current page.
find_tool_by_name
Find a matching WebMCP tool by name from a list of discovered tools.
find_tools_for_opcode
Find WebMCP tools that match an opcode category.
might_have_webmcp
Check if a page likely supports WebMCP by scanning its HTML source.