Skip to main content
Glama

execute_code

Run code in a secure, isolated sandbox across multiple languages, install libraries, and capture generated visualizations for safe execution of LLM-generated code.

Instructions

Execute code in a secure sandbox environment and automatic visualization capture.

Args:
    code: The code to execute
    language: Programming language (python, javascript, java, cpp, go, r, ruby)
    libraries: List of libraries/packages to install
    timeout: Execution timeout in seconds (default: 30)

Returns:
    List of content items including execution results and any generated visualizations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
timeoutNo
languageNopython
librariesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose that execution runs in a 'secure sandbox' and that visualizations are captured automatically, which is useful. However, it omits statefulness (does code persist between calls?), filesystem/network access, resource or rate limits, and failure behavior for any code-execution tool where these matter.

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 one-line summary followed by a compact Args/Returns block; every line earns its place. The phrase 'and automatic visualization capture' is slightly awkward but conveys real information. No wasted sentences.

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

Completeness3/5

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

Parameter semantics are fully covered and an output schema exists, so return values needn't be spelled out (though the description helpfully does). What's missing is behavioral context that annotations would normally supply — sandbox isolation details, persistence, and limits — leaving a code-execution tool under-specified on the safety/state dimension.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate and largely does: it documents all four params, enumerates the accepted languages (python, javascript, java, cpp, go, r, ruby), and states the timeout default of 30 seconds. It doesn't explain the format of the libraries list beyond 'list of libraries/packages', a minor gap.

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: 'Execute code in a secure sandbox environment', plus a notable secondary behavior ('automatic visualization capture'). An agent can tell it apart from get_supported_languages and get_language_details, which are clearly informational siblings. No explicit sibling naming, so not a 5.

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 guidance, no prerequisites, and no mention of the sibling tools (e.g. consult get_supported_languages first to validate the language argument). Usage is only implicit from the verb 'Execute code'. Comparable to the MID calibration where absence of when-to-use scored 2.

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