WebMCP 类
实验性 WebMCP 类为 WebMCP API 提供 API。
更多详情请参阅 WebMCP 指南。
签名
export declare class WebMCP extends EventEmitter<{
toolsadded: WebMCPToolsAddedEvent;
toolsremoved: WebMCPToolsRemovedEvent;
toolinvoked: WebMCPToolCall;
toolresponded: WebMCPToolCallResult;
}>
继承自: EventEmitter<{ toolsadded: WebMCPToolsAddedEvent; toolsremoved: WebMCPToolsRemovedEvent; toolinvoked: WebMCPToolCall; toolresponded: WebMCPToolCallResult; }>
备注
此类的构造函数被标记为内部使用。第三方代码不应直接调用构造函数,也不应创建继承 WebMCP 类的子类。
示例
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}`);
}
方法
|
方法 |
修饰符 |
说明 |
|---|---|---|
|
获取页面定义的所有 WebMCP 工具。 |