browser_evaluate
Execute JavaScript code directly in a web page's context to retrieve data like page titles, URLs, element counts, or storage contents for web automation and testing.
Instructions
Execute JavaScript in the page context and return the result.
Examples:
"document.title"
"window.location.href"
"document.querySelectorAll('a').length"
"JSON.stringify(localStorage)"
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": {
"script": "<script>"
},
"name": "browser_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | JavaScript code to execute in the page context |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |