session_evaluate
Run JavaScript in the page's own context and get its completion value as JSON, strings, or undefined. Use for custom checks, computed styles, or data extraction not covered by other tools.
Instructions
Run JavaScript in the page's own context and return its completion value. Use it for what the other tools do not cover — reading computed styles, walking a data structure the page holds, or checking a condition too specific for session_wait. Objects come back as formatted JSON, strings as themselves, and an expression with no value as "undefined". End the code with the expression you want back; a trailing statement returns nothing useful.
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": {
"code": "<code>"
},
"name": "session_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript to run in the page's own context. Its completion value is returned, so end with the expression you want back | |
| tabId | No | Tab to run in; uses the active tab when omitted |