Skip to main content
Glama

Run guest code

relay_code

Execute inline JavaScript, TypeScript, or Python code as a single recorded operation in a disposable VM, with automatic evidence capture.

Instructions

Run inline guest code as this call's single recorded operation. Evidence is automatic, as for relay_exec, whose optional reason, step, snapshots and timeoutMs it shares. Requires code (up to 1 MiB) and language (javascript, typescript or python).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
stepNoOptional step record overrides; any field left out is derived from the call.
reasonNoOptional intent, retained as evidence. Default: derived from the call.
languageYes
snapshotsNoOptional. Consecutive keystrokes may form an explicit text group (first/member/last); only first gets a before-snapshot and only last an after-snapshot.
timeoutMsNoExecution timeout in milliseconds, default 120000, maximum 3600000. Independent of snapshot delay and lease TTL.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.1

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already signal readOnlyHint=false and openWorldHint=true; the description adds that evidence is automatic and that optional params are shared with relay_exec. However, for an arbitrary code runner it does not disclose side effects, result/output behavior, failure modes, or why openWorld semantics apply, leaving significant behavior implicit.

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?

Three short sentences front-load the core purpose and add the only required-input details; no filler. The relay_exec reference is compact but slightly dense, so it is not quite a perfect example of concision.

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

Completeness2/5

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

For an execution tool with no output schema, high complexity, and six parameters, the description omits what the tool returns or surfaces on success/failure, and offers no routing guidance against similar siblings. It is enough to attempt a call, but not enough to invoke correctly and interpret the result confidently.

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 67%, so the schema already documents reason, step, snapshots, and timeoutMs. The description adds that code is required up to 1 MiB and enumerates languages, but those values are largely mirrored by schema constraints (maxLength, enum); it does not explain the semantics of code beyond the name and title.

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

Purpose4/5

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

The first sentence states a concrete action and object ('Run inline guest code') and frames it as 'this call's single recorded operation', which is distinctive. It references relay_exec but does not explicitly differentiate from siblings like relay_script or relay_run, so full sibling separation is not achieved.

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

Usage Guidelines3/5

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

The description implies a use case—inline guest code in a single recorded operation—and points to relay_exec as a behavioral reference. It never states when to prefer relay_code over relay_exec, relay_script, or relay_run, and gives no exclusions or prerequisites beyond the required parameters.

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