Skip to main content
Glama

exec_python

Destructive

Execute Python code snippets in a zero-trust sandbox with scrubbed environment variables, POSIX resource limits, and timeout SIGKILL for safe execution.

Instructions

Execute an isolated Python code snippet inside the sandbox with zero-trust scrubbed environment variables, POSIX resource limits, and process-group timeout SIGKILL.

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

Input Schema

NameRequiredDescriptionDefault
argsNoOptional command-line arguments passed to sys.argv.
codeYesPython code snippet to execute inside the isolated OS sandbox.
timeout_secondsNoOptional execution timeout in seconds (clamped by policy max_timeout_seconds).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, so the description's job is to add context, which it does well: scrubbed environment variables, POSIX resource limits, and process-group SIGKILL on timeout are concrete operational behaviors an agent needs to know. It stops short of saying what happens to state on disk or how output is captured.

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?

A single front-loaded sentence that opens with the verb and resource and then layers environment guarantees. Dense but every clause carries information; only the stacking of technical qualifiers makes it slightly heavy.

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?

For a destructive code-execution tool with no output schema, the description covers the sandbox and timeout story but says nothing about what is returned (stdout/stderr/exit code) or how failures surface. The annotations handle the safety profile, so this is adequate but leaves a meaningful gap about results.

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 args, code, and timeout_seconds are already documented in the schema. The description mentions the timeout/SIGKILL behavior, which loosely reinforces timeout_seconds, but adds no syntax or format detail beyond the schema. Baseline 3 applies when the schema carries the parameter burden.

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 an isolated Python code snippet inside the sandbox) and adds the execution environment details. It implicitly distinguishes itself from exec_command by scoping to Python code rather than arbitrary commands, but it never names the sibling or states the boundary explicitly.

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 or when-not-to-use guidance. The description never says whether to prefer this over exec_command for shell tasks, nor does it state any prerequisites or exclusions for running Python versus other execution paths.

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