evaluate
Execute a JavaScript expression in the current page context and return the serializable result as JSON for extracting data or testing logic.
Instructions
Execute a JavaScript expression in the page context and return the result as JSON. The expression may return any serialisable value.
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": "evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | JavaScript expression or statement block to evaluate. Wrap multi-statement code in an IIFE if a return value is needed. |