browser_evaluate
Execute JavaScript in the current page context to retrieve or manipulate data, returning the result to support web automation and testing.
Instructions
Execute JavaScript in page context. Supports both function form "() => expression" and direct expression "document.title". Returns the evaluation result.
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 | JavaScript code to execute. Can be a function like "() => document.title" or a direct expression like "document.title". For complex logic, use function form like "() => { const x = 1; return x + 1; }" |