browser_evaluate
Execute JavaScript expressions on a web page or target element using a provided function. Optionally reference an element to evaluate code in its context.
Instructions
Evaluate JavaScript expression on the page or on a specific 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 | Element reference — the function receives the element as first argument | |
| element | No | Human-readable element description | |
| function | Yes | JavaScript function to evaluate, e.g. '() => document.title' or '(el) => el.textContent' when ref is provided |