跳到正文
所有工具

web_eval

网页自动化 · macOS · Windows

效果: 执行. 状态: 受限可用.

“受限可用”表示工具可能取决于版本、平台、权限、账户或配置,并不表示它在所有安装中都已启用。

macOS

用途

在网页会话中运行任意 JavaScript,并返回最后一个表达式的值,该值必须是普通的 JSON 值(异步代码不会被等待:请返回 JSON.stringify(...),或存储结果并在第二次调用中读取)。需要 confirm=true;不传时只会得到代码预览,不会运行任何内容。当 LMCP 处于只读模式时禁用。高级用户工具——页面可能注入恶意代码,因此日常使用请优先选择 web_find / web_read / web_extract。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构 — macOS
{
  "properties": {
    "confirm": {
      "description": "Must be true to run the code. Without it, returns a preview and runs nothing.",
      "type": "boolean"
    },
    "js": {
      "description": "JavaScript to evaluate on the page; the last expression's value is returned.",
      "type": "string"
    },
    "session": {
      "description": "Session name (default 'default').",
      "type": "string"
    }
  },
  "required": [
    "js"
  ],
  "type": "object"
}

文档示例

web_eval 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "confirm": false,
  "js": "document.title",
  "session": "demo-browser"
}

Windows

用途

在网页会话中运行任意 JavaScript,并返回最后一个表达式的值。需要 confirm=true;不传时只会得到代码预览,不会运行任何内容。高级用户工具——页面可能注入恶意代码,因此日常使用请优先选择 web_find / web_read / web_extract。

必填输入

输入名称会严格保持工具要求的形式。下方可展开的架构中保留英文规范技术定义。

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构 — Windows
{
  "properties": {
    "confirm": {
      "description": "Must be true to run the code. Without it, returns a preview and runs nothing.",
      "type": "boolean"
    },
    "js": {
      "description": "JavaScript to evaluate on the page; the last expression's value is returned.",
      "type": "string"
    },
    "session": {
      "description": "Session name (default 'default').",
      "type": "string"
    }
  },
  "required": [
    "js"
  ],
  "type": "object"
}

文档示例

web_eval 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "confirm": false,
  "js": "document.title",
  "session": "demo-browser"
}