Skip to main content
Glama

Run code in a kernel

rent_run_code
Destructive

Runs code on the Jupyter kernel of a code-interpreter-v1 sandbox and answers its rich results (text, images as base64, …), stdout, stderr and error. State persists between calls in one context_id; a context lives as long as the sandbox. timeout_s defaults to 50. Arguments not listed here go to the REST route as they are, which refuses them by name.

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": {
      "sandbox_id": "<sandbox_id>",
      "code": "<code>"
    },
    "name": "rent_run_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNo
codeYes
languageNoDefault python.
timeout_sNo
context_idNo
sandbox_idYesSandbox id (`lse_…`) from rent_create_sandbox or rent_list_sandboxes. It names the sandbox for its whole life and keeps answering rent_get_sandbox, with the final state, after it ends.

Output Schema

NameRequiredDescriptionDefault
errorYes
stderrYes
stdoutYes
resultsYes
execution_countYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior4/5

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

Annotations already flag a non-read-only, non-idempotent, destructive, open-world operation, and the description adds genuinely new behavior: kernel state persists across calls keyed by context_id, a context lives as long as the sandbox, timeout defaults to 50s, and unlisted arguments are rejected by name at the REST route. The last sentence is vague about which arguments are rejected, but overall it materially lowers the surprise factor of a destructive exec tool.

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 compact sentences, with the core action and return payload front-loaded and the persistence/timeout facts following. The trailing sentence about unlisted arguments going to the REST route is slightly convoluted but still earns its place as a failure-mode warning.

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?

With an output schema present, the description needn't enumerate return values, and it gives enough about persistence, timeout, and error surfacing for an agent to call this correctly against a destructive exec tool. The remaining gap is the undocumented `env` map, which matters for a code runner.

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 only 33%, so the description needs to compensate, and it does explain the meaningful semantics of context_id (persistence scope) and the timeout default. However, `env` (a nested string map) and `language` receive no explanatory treatment in the description, leaving the nested object undocumented outside the schema.

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?

States a specific verb and resource ('Runs code on the Jupyter kernel of a `code-interpreter-v1` sandbox') and even names the return shape (rich results, stdout, stderr, error). It does not distinguish itself from the sibling rent_exec, which on its face also executes something, so an agent must guess which executor applies.

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

Usage Guidelines2/5

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

There is no when-to-use / when-not-to-use statement and no reference to rent_exec or rent_start_process as alternatives. The only usage-adjacent content is that the sandbox must be a `code-interpreter-v1` type and that state persists via context_id, which is helpful framing but not selection guidance.

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