execute
Run multi-step JavaScript in a sandboxed QuickJS WASM VM with shell, Python, and file operations, plus optional timeouts and output limits.
Instructions
Run multi-step JavaScript inside a sandboxed Pi 1.0 QuickJS WASM VM with Claude Code $ shell and file ergonomics. Input code is raw JavaScript (async body: top-level await & return work; no markdown fences). Optional line 1 directive: // @options: {"max_output_tokens": 4000, "timeout_ms": 60000}. Globals: $`cmd ${arg}` (.text(), .json(), .lines(), .nothrow(), .cwd(), .timeout(), .env(), $.pwsh), read(path, opts?), readJson(path), write(path, content, opts?), edit(path, oldText, newText, opts?), ls(dir?), glob(pattern, opts?), grep(pattern, opts?), bash(cmd, opts?), pwsh(cmd, opts?), python(code, opts?)/py(...), tools.(args), ALL_TOOLS, searchTools(q, opts?), describeTool(name), describeNamespace(ns), text(val), image(val), console., exit(), store(k, v)/load(k), mcp.{listServers,connect,disconnect,call,listResources,readResource}. All file/shell/mcp globals are async (always await). Only text()/console. or returned output reaches context.
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": "execute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory override (defaults to active workspace root). | |
| code | Yes | Raw JavaScript script body (top-level await and return supported; no markdown fences). | |
| timeoutMs | No | Execution deadline in ms (default 60000, max 300000). | |
| maxOutputChars | No | Max inline characters before overflowing to a temp file (default 8000). |