kernel_code_run
Run short sandboxed JavaScript scripts that call other tools via tool(name, args), combining list-then-filter or create-then-run workflows in one inference round.
Instructions
Run a small JS script that can call other kernel tools via tool(name, args). Use this to compose multiple tool calls in ONE inference round (e.g. list-then-filter, create-then-run). Sandbox: no FS, no network, no require, 5s default wall-clock. Available helpers: tool(name, args) (async), log(msg), input (the vars object). Example: const r = await tool("kernel_tasks_list", {}); return r.tasks.length.
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": {
"script": "<script>"
},
"name": "kernel_code_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vars | No | Variables exposed inside the script as `input`. | |
| script | Yes | JavaScript source. Available globals: `tool(name, args)` (async — calls any kernel tool), `log(msg)`, `input` (the `vars` object below). Return a value from the script body to expose it as `result`. | |
| timeoutMs | No | Wall-clock timeout. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logs | Yes | ||
| result | No | ||
| durationMs | Yes |