debugger-evaluate
Execute JavaScript in the app runtime to read state, call functions, and test logic. Returns results as JSON with device context.
Instructions
Execute arbitrary JavaScript in the app's JS runtime via CDP — Hermes on iOS / Android / Vega, V8 on Chromium. Returns the evaluation result as a JSON-serializable value, along with deviceName, appName, and logicalDeviceId for context. Use when you need to read app state, call app functions, or test logic at runtime. The result is serialized by value, so cyclic objects (many RN runtime values — fiber nodes, navigation refs, global — are cyclic) fail with a serialization error rather than returning silently. Fails if the expression throws or the runtime is not connected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Metro server port (ignored for Chromium) | |
| device_id | Yes | Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id. | |
| expression | Yes | JavaScript expression to evaluate in the app runtime |