browser_evaluate
Execute JavaScript in the current page and return JSON-serializable results, optionally targeting a specific element by ref for DOM inspection or data extraction.
Instructions
逃生舱:在页面里执行 JS 并返回 JSON 可序列化结果。传函数字符串如 () => document.title 或 () => {...};带 ref 时在该元素上执行((el, ) => el.value)。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"js": "<js>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | Yes | 函数字符串,如 `() => document.querySelector('#app')?.innerText.slice(0,2000)` | |
| ref | No | 在该元素上执行,回调第一个参数是元素 |