Skip to main content
Glama

Ferrite Worker

run_code

Run a JavaScript or TypeScript program with only the access this request lends it. Use it when one short program can do the work of many separate calls, or when code from a model has to run safely; read list_capabilities first. Needs the worker's client token. Returns the program's value, its console lines, an exit code and the number of calls it made.

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": {
      "client_token": "<client_token>",
      "code": "<code>"
    },
    "name": "run_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
capsNowhat the program may use; everything left out is refused
codeYesthe body of an async function: return the result, and use await at the top level
langNots or typescript removes type annotations before the run; js when left out
inputNoany JSON value, available to the program as the global input
now_msNothe fixed time the program sees, in epoch milliseconds; the time of the request when left out
client_tokenYesthe worker's client token, issued by its operator; the program never sees it

Output Schema

NameRequiredDescriptionDefault
msYesalways 0, because a run cannot observe real time
okYestrue when the program finished without an error
logsYesconsole lines, in order
outputYesthe value the program returned
roundsYesstretches of execution, one more than tool_calls
stderrYesan uncaught error and its stack, or the reason a run was refused
stdoutYesother output of the engine
exit_codeYes0 for success; get_limits explains the others
tool_callsYescalls the program made to stores, files and hosts
execution_stateNoonly after a deadline: whether any outside call had already completed

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Beyond the annotations, it discloses the sandboxing model (capability-scoped access, 'everything left out is refused' in the schema), the client-token requirement, and that the program never sees the token. Return shape is spelled out, though that partly duplicates the output schema. One mild tension: openWorldHint=false while egress_hosts implies outbound fetches — framed as an explicit allowlist, so not a true contradiction.

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

Conciseness5/5

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

Three dense sentences: purpose and scope first, usage conditions second, prerequisites and return contract last. No filler, and the most decision-relevant constraint is front-loaded.

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?

For a complex nested-capability execution tool it covers purpose, safety model, prerequisite lookup, and result contract, and an output schema exists to carry return details. It could be stronger on error behavior and on the consequences of omitting caps entries, but nothing essential to a correct call is missing.

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 nested caps/limits/store objects are already well documented. The description only adds the token parameter's role ('Needs the worker's client token') and the pointer to list_capabilities for egress host names; it adds little else about caps semantics that the schema doesn't already say.

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 JavaScript or TypeScript program') plus an unusual scoping constraint ('with only the access this request lends it'), which immediately separates it from the read-only introspection siblings. An agent knows this is the execution tool, not a capability/limits lookup.

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 two concrete selection conditions ('one short program can do the work of many separate calls', 'code from a model has to run safely') and a prerequisite ('read list_capabilities first'). It stops short of stating when not to use it (e.g., single trivial operations), but the guidance is actionable.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources