Skip to main content
Glama

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

NameRequiredDescriptionDefault
varsNoVariables exposed inside the script as `input`.
scriptYesJavaScript 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`.
timeoutMsNoWall-clock timeout.

Output Schema

NameRequiredDescriptionDefault
logsYes
resultNo
durationMsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.1

TDQS

A4.2/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 load and does well: it enumerates sandbox limits (no FS, no network, no require, 5s default wall-clock) and the helper surface (tool, log, input), which is exactly the environmental context an agent needs. It stops short of failure semantics — what happens on timeout, whether tool side effects persist, or how errors surface in the result.

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 purpose, then constraints, then helpers, then a one-line example — a sensible order with almost no filler. The helper list and the example slightly overlap with the script parameter's own schema description, but the redundancy is cheap and aids scannability.

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

Completeness5/5

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

For a sandboxed code-execution tool with an output schema, a nested vars object, and no annotations, this covers everything an agent needs to construct a correct call: available globals, isolation model, timeout, and how to surface a value. Return-value shape is correctly left to the output schema.

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 coverage is 100% and the schema already documents vars, script, timeoutMs, the globals, and the return-to-result convention; the description largely restates that surface. Its genuinely additive content is the worked example showing await tool(...) with a concrete sibling and a returned expression. Baseline 3 is appropriate when the schema does the parameter-level work.

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 that can call other kernel tools via tool(name, args)') and immediately distinguishes itself from siblings by naming its composition role: 'compose multiple tool calls in ONE inference round'. An agent can tell this is an orchestrator rather than a data-fetching tool without opening the 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 a clear condition for use ('compose multiple tool calls in ONE inference round') and concrete patterns (list-then-filter, create-then-run). It does not name any exclusion or alternative — e.g. when a single direct tool call is preferable, or that kernel_code_read is the tool for inspecting existing code — so the agent must infer the boundary.

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