Skip to main content
Version: Next

WebMCP class

The experimental WebMCP class provides an API for the WebMCP API.

See the WebMCP guide for more details.

Signature

export declare class WebMCP extends EventEmitter<{
toolsadded: WebMCPToolsAddedEvent;
toolsremoved: WebMCPToolsRemovedEvent;
toolinvoked: WebMCPToolCall;
toolresponded: WebMCPToolCallResult;
}>

Extends: EventEmitter<{ toolsadded: WebMCPToolsAddedEvent; toolsremoved: WebMCPToolsRemovedEvent; toolinvoked: WebMCPToolCall; toolresponded: WebMCPToolCallResult; }>

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the WebMCP class.

Example

await page.goto('https://www.example.com');
const tools = page.webmcp.tools();
for (const tool of tools) {
console.log(`Tool found: ${tool.name} - ${tool.description}`);
}

Methods

Method

Modifiers

Description

tools()

Gets all WebMCP tools defined by the page.