Puppeteer 中文文档v25.8.0

WebMCPTool 类

表示页面上一个已注册的 WebMCP 工具。

签名

export declare class WebMCPTool extends EventEmitter<{
    toolinvoked: WebMCPToolCall;
}>

继承自: EventEmitter<{ toolinvoked: WebMCPToolCall; }>

备注

此类的构造函数被标记为内部使用。第三方代码不应直接调用构造函数,也不应创建继承 WebMCPTool 类的子类。

属性

属性

修饰符

类型

说明

annotations

optional

Protocol.WebMCP.Annotation

工具的可选注释。

description

string

工具描述。

formElement

readonly

Promise<ElementHandle<HTMLFormElement> | undefined>

当工具通过表单注册时对应的 ElementHandle。

frame

Frame

定义该工具所在的框架。

inputSchema

optional

object

工具输入参数的架构。

location

optional

ConsoleMessageLocation

定义该工具的源代码位置(如果可用)。

name

string

工具名称。

方法

方法

修饰符

说明

execute(input)

使用输入参数执行工具,并与工具的 inputSchema 匹配。