Skip to main content
Version: 25.3.0

WebMCPTool 类

🌐 WebMCPTool class

表示页面上可用的已注册 WebMCP 工具。

🌐 Represents a registered WebMCP tool available on the page.

语法

🌐 Signature

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

Extends: EventEmitter<{ toolinvoked: WebMCPToolCall; }>

附注

🌐 Remarks

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

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

属性

🌐 Properties

属性

🌐 Property

修饰符

🌐 Modifiers

类型

🌐 Type

描述

🌐 Description

annotations

optional

Protocol.WebMCP.Annotation

该工具的可选注释。

🌐 Optional annotations for the tool.

description

string

工具描述。

🌐 Tool description.

formElement

readonly

Promise<ElementHandle<HTMLFormElement> | undefined>

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

🌐 The corresponding ElementHandle when tool was registered via a form.

frame

框架

框架了该工具的定义。

🌐 Frame the tool was defined for.

inputSchema

optional

object

该工具输入参数的模式。

🌐 Schema for the tool's input parameters.

location

optional

控制台消息位置

定义该工具的源位置(如果有的话)。

🌐 Source location that defined the tool (if available).

name

string

工具名称。

🌐 Tool name.

方法

🌐 Methods

方法

🌐 Method

修饰符

🌐 Modifiers

描述

🌐 Description

execute(input)

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

🌐 Executes tool with input parameters, matching tool's inputSchema.