kernel_code_run
Run a sandboxed JavaScript script to compose multiple kernel tool calls in one round, enabling list-then-filter or create-then-run workflows without separate inference steps.
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. A script that worked can be kept with kernel_code_skill_save and run again with { skill: "<name>", vars } (kernel_code_skill_list shows the saved ones).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "kernel_code_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vars | No | Variables exposed inside the script as `input`. | |
| skill | No | Name of a saved script (kernel_code_skill_list) to run instead of `script`. | |
| script | No | 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`. Omit it to run a saved script by `skill`. | |
| timeoutMs | No | Wall-clock timeout. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logs | Yes | ||
| result | No | ||
| durationMs | Yes |