run
Execute TypeScript snippets against the Node SDK in a sandbox to query and manage AI-native Postgres databases; type-checking catches errors before any API call and console logs are captured.
Instructions
Run a TypeScript snippet against the SDK in a sandbox. r is the Node SDK client (@run402/sdk/node); call docs for its reference. The code is the body of an async function: await r chains, and the value of the last expression (or a return) is the result, e.g. (await r.projects.list()).projects.map((p) => p.id). It is type-checked against the SDK before anything runs: a type error comes back with its line and TypeScript's message, and makes no call. No filesystem, process, fetch, timers, or imports; console is captured. Returns { status, value, value_ref, shown, total, logs, logs_ref, calls, duration_ms, wallet, error? }; a large value is stored whole and expand_result pages it. Operations that return or consume a one-time secret (grant keys, Handoff and Invite Keys, project credentials, wallet keys) refuse with SECRET_REQUIRES_CLI naming the exact CLI command to hand the person. Any other operation is a run snippet against r.
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": {
"code": "<code>"
},
"name": "run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | TypeScript or JavaScript, run as the body of an async function: top-level await works, and the value of an explicit return or of the last expression statement is the result. `r` is the Node SDK client (`@run402/sdk/node`): await any chain, e.g. `(await r.projects.list()).projects.map(p => p.id)` or `await r.project("prj_…").functions.list()`. The snippet is type-checked against the SDK before anything runs, and a type error makes no call; then types are stripped: no enum, no parameter properties. No filesystem, process, fetch, timers, or imports; `console` is captured. | |
| timeout_seconds | No | Deadline for the whole run, 60 s by default and at most 300. An SDK call in flight at the deadline completes on its own; the result lists every call that completed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logs | No | ||
| calls | No | ||
| error | No | ||
| shown | No | ||
| total | No | ||
| value | No | ||
| status | Yes | ||
| wallet | No | ||
| logs_ref | No | ||
| value_ref | No | ||
| type_check | No | ||
| value_kind | No | ||
| duration_ms | No | ||
| logs_dropped | No | ||
| value_window | No | ||
| calls_dropped | No |