browser_evaluate
Run JavaScript expressions on a web page or specified element to extract data, test behavior, or produce computed output; save results to a file when needed.
Instructions
Evaluate JavaScript expression on page or element
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": {
"function": "<function>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Exact target element reference from the page snapshot | |
| element | No | Human-readable element description used to obtain permission to interact with the element | |
| filename | No | Filename to save the result to. If not provided, result is returned as text. | |
| function | Yes | () => { /* code */ } or (element) => { /* code */ } when element is provided | |
| sessionId | No | Target session ID. Omit to use the active session. |