Evaluate JS
eval_jsEvaluate JavaScript in a running React Native app's runtime and return results, including awaited promises. Run long work as background jobs and collect output later.
Instructions
Evaluate JavaScript in the app's runtime and return the result. Statements are allowed, and a promise result is awaited (await fetch(...), AsyncStorage.getItem(...)) — pass the promise itself, not await (Hermes has no async/await in evaluated code). Pass background: true for work that outlives one tool call (a long measurement, a snippet that samples for 30s) and collect the result with get_job.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| label | No | Name for a background job, shown by get_job. | |
| background | No | Start the evaluation and return a job id immediately instead of waiting for the result. | |
| timeout_ms | No | How long to wait for a promise result (default 10000; background jobs default to 600000). |