browser_evaluate
Evaluate JavaScript expressions on a webpage or specific element, returning the execution result for browser automation tasks.
Instructions
Evaluate JavaScript expression on page or element.
Args:
function: JavaScript function to execute. Format:
'() => { /* code */ }' or
'(element) => { /* code */ }' when element is provided
element: Human-readable element description (optional)
ref: Exact target element reference for element-scoped evaluation (optional)
Returns:
Result of the JavaScript evaluation
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 |
|---|---|---|---|
| function | Yes | ||
| element | No | ||
| ref | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |