Skip to main content
Glama

run_python

Execute Python code snippets in a secure sandboxed environment with configurable timeouts, memory limits, and network restrictions. Returns the output of the executed code.

Instructions

Ejecuta un fragmento de código Python y devuelve su salida.

El código corre en un subproceso separado con:

  • Timeout configurable (por defecto 10 segundos).

  • Sin acceso a red (variables de entorno anuladas).

  • Límite de memoria de 256 MB en Linux.

  • El módulo sys.exit() termina el proceso sin errores.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesCódigo Python a ejecutar.
timeoutNoTiempo máximo de ejecución en segundos (máximo 60).
stdinNoTexto a pasar como entrada estándar al programa.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so excellently. It clearly describes the execution environment: separate subprocess, configurable timeout, no network access, memory limits, and how sys.exit() is handled. This provides crucial behavioral context beyond what the input schema covers.

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?

The description is perfectly structured and concise. The first sentence states the core purpose, followed by bullet points detailing the execution environment. Every sentence earns its place by providing essential information without redundancy. The information is front-loaded with the most important details first.

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?

Given that this is a code execution tool with security implications, the description provides excellent completeness. With no annotations but an output schema present, the description thoroughly covers the execution environment constraints (timeout, network access, memory limits) and behavioral characteristics. This is complete enough for an agent to understand the tool's capabilities and limitations.

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?

The schema description coverage is 100%, so the baseline is 3. The description doesn't add specific parameter semantics beyond what's already in the schema descriptions. It mentions timeout configuration generally but doesn't provide additional details about the code, timeout, or stdin parameters beyond what the schema already documents.

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?

The description clearly states the tool's purpose with specific verb+resource: 'Ejecuta un fragmento de código Python y devuelve su salida' (Executes a Python code fragment and returns its output). It distinguishes from sibling tools like run_js (JavaScript execution) and memory_* tools (memory operations). The description is specific about what the tool does without being tautological.

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?

The description provides clear context about when to use this tool: for executing Python code in a sandboxed environment. It implicitly distinguishes from run_js for JavaScript execution and memory_* tools for memory operations. However, it doesn't explicitly state when NOT to use it or mention specific alternatives beyond what's obvious from sibling names.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YoshiLoL0526/mcp-toolkit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server