debugger-evaluate
Evaluates JavaScript expressions in an app runtime to read state, call app functions, or test logic, returning JSON results.
Instructions
Run JavaScript in the app's runtime. React Native uses Hermes, including on Vega. Chromium uses V8. Returns the result serialized by value as JSON, with deviceName, appName, and logicalDeviceId. A returned Promise is awaited and its resolved value returned. Use when you need to read app state, including localStorage and sessionStorage on Chromium, call app functions, or test logic at runtime. Cyclic objects, which many RN runtime values are (fiber nodes, navigation refs, global), fail with a serialization error. Fails if the expression throws or the runtime is not connected. On React Native, a module that fails to load while the expression runs (e.g. a lazy react-native export whose native module the app lacks) fails the call with that module's error instead of opening the app's red box.
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": {
"device_id": "<device_id>",
"expression": "<expression>"
},
"name": "debugger-evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535. | |
| device_id | Yes | Device id used with debugger-connect. | |
| expression | Yes | JavaScript expression to evaluate in the app runtime |