Skip to main content
Glama

Run Script

run_script
Destructive

Executes Python or Bash scripts from supplied code and returns stdout/stderr; supports timeout, virtual environment, and working directory.

Instructions

Write and execute a Python or Bash script, returning its output.

Writes the code to a temporary file, executes it via python3/bash, and returns stdout/stderr. The temp file is deleted after execution. Requires CYBERSEC_MCP_ALLOW_SCRIPTS=1. This is an explicit full-code execution opt-in: scripts run outside the MCP policy layer and are not constrained by CYBERSEC_MCP_ALLOW_EXTERNAL. Their only OS isolation is the launch mode: the Kata VM by default, none in --local mode.

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": "run_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe script source code to execute.
venvNoOptional Python venv name from ~/.ctf-venvs/ (e.g. "pwntools"). Allows using a different Python with specific packages installed. Ignored for language="bash". If not set, uses the MCP server's Python.
timeoutNoMaximum execution time in seconds (default 120, max 300).
languageNo"python" (default) or "bash".python
working_dirNoWorking directory for the script (default: system temp dir).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A4.1/5.0
Behavior5/5

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

The description goes well beyond the annotations: it discloses temp-file creation and deletion, the python3/bash execution path, the env-var gate, policy-layer bypass, and that OS isolation is Kata VM by default but none in --local mode. This is exactly the security and side-effect context an agent needs for a code-execution tool, and it is consistent with destructiveHint=true and openWorldHint=true.

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 action is front-loaded in the first clause, followed by execution mechanics, the gating requirement, and the isolation caveats. Every sentence carries distinct, non-redundant information; nothing is filler.

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 five parameters, full schema coverage, an output schema, and destructive/open-world annotations, the description supplies the missing pieces: prerequisite configuration, execution mechanism, cleanup behavior, and isolation limitations. An agent has everything needed to invoke it safely.

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 every parameter (code, venv, timeout, language, working_dir) is already documented in the schema. The description confirms the python/bash language choice and temp-file execution model but adds no per-parameter meaning beyond that, so the baseline 3 applies.

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: 'Write and execute a Python or Bash script, returning its output,' which tells an agent exactly what the tool does. It does not differentiate itself from siblings like run_tool or run_pipeline, leaving the agent to infer which execution tool to pick.

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?

Useful preconditions are given (requires CYBERSEC_MCP_ALLOW_SCRIPTS=1, ignores ALLOW_EXTERNAL), and 'explicit full-code execution opt-in' implies when this is appropriate. However, there is no explicit when-to-use-this-vs-alternatives guidance against the closely related run_tool and run_pipeline siblings.

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