Skip to main content
Glama

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

NameRequiredDescriptionDefault
varsNoVariables exposed inside the script as `input`.
skillNoName of a saved script (kernel_code_skill_list) to run instead of `script`.
scriptNoJavaScript 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`.
timeoutMsNoWall-clock timeout.

Output Schema

NameRequiredDescriptionDefault
logsYes
resultNo
durationMsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.6.0
    • changedInput schema / properties / script / description
      Previous value: -"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`."New value: +"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`."
    • addedInput schema / properties / skill
      Added value: +{
      +  "description": "Name of a saved script (kernel_code_skill_list) to run instead of `script`.",
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "script"
      -]
  2. First observedv0.5.1

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so substantially: it names the sandbox constraints (no FS, no network, no require, 5s default wall-clock) and enumerates available globals. It leaves gaps on failure behavior — what happens on timeout, how errors from nested `tool()` calls surface, and whether nested calls are rate-limited or permission-scoped.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action and composition rationale, then sandbox limits, then the helper list and example. Dense but every clause carries information; the example and helper enumeration are justified for a scripting tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained, and the description covers execution model, sandbox, globals, and persistence. For a 4-param orchestration tool with nested objects, the remaining gap is error/timeout semantics rather than anything structural.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, and the description adds little the schema doesn't already say — `input` as the vars object, `skill` vs `script`, and the 5s timeout all appear in the schema. The only marginal addition is the save/list workflow around `skill`, which the schema already hints at by naming kernel_code_skill_list.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (run a small JS script) plus its distinguishing capability: calling other kernel tools via `tool(name, args)` to compose calls in one inference round. That separates it from the sibling skill-management and agent tools without needing to inspect any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete when-to-use conditions with examples (list-then-filter, create-then-run) and points at the saved-script path via kernel_code_skill_save / kernel_code_skill_list. It stops short of explicit when-not guidance, e.g. when a single direct tool call is preferable or when a script would exceed sandbox limits.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools