Evaluate JavaScript in the app
evaluate_jsExecute JavaScript inside your live React Native app to inspect state (Redux, Zustand, globals) or trigger actions. Awaits promises automatically with configurable timeout.
Instructions
Execute a JavaScript expression inside the running React Native app and return the result. Use to inspect state (Redux/Zustand stores, globals) or trigger behavior. Promises are awaited via polling (Hermes limitation), up to timeoutMs. This can mutate app state — prefer read-only expressions when verifying. Requires Metro running.
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": {
"expression": "<expression>"
},
"name": "evaluate_js"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetId | No | Runtime target id (from list_runtime_targets) | |
| timeoutMs | No | Promise wait budget (default 5000) | |
| expression | Yes | A JS expression (wrap multi-statement code in an IIFE) | |
| awaitPromise | No | Await a returned Promise via polling (default true) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | ||
| preview | No | String preview when the value is not fully serializable | |
| exception | No | ||
| truncated | No | ||
| resultType | Yes |