debugger-evaluate
Execute JavaScript in the app runtime via CDP to read state, call functions, or test logic. Returns a serializable result with device context.
Instructions
Execute arbitrary JavaScript in the app's JS runtime via CDP — Hermes on iOS / Android, 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 debugger-connect (iOS simulator UDID, Android logicalDeviceId, or Chromium device id). | |
| expression | Yes | JavaScript expression to evaluate in the app runtime |