Skip to main content
Glama

run_script

Execute custom Python or Bash scripts to automate security tasks, returning stdout/stderr with configurable timeout 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 are not OS-sandboxed and are not constrained by CYBERSEC_MCP_ALLOW_EXTERNAL.

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: it discloses temp-file creation, interpreter choice, stdout/stderr return, automatic cleanup, required environment variable, and lack of OS sandboxing. It also clarifies that the allow-external gate does not constrain this tool, which is exactly the behavioral context an agent needs.

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?

Four sentences with a front-loaded summary followed by essential behavioral and security details. No filler or redundant restatement of the schema.

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?

The description, combined with a fully documented 5-parameter schema and an output schema, covers execution mechanics, cleanup, return content, security constraints, and opt-in requirements. Nothing critical is missing for an agent to call this tool correctly.

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 the schema already documents all five parameters in detail. The description adds global execution context but no per-parameter meaning beyond the schema, matching the baseline of 3.

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 opens with a clear verb-object statement ('Write and execute a Python or Bash script, returning its output') that identifies the exact operation and resource. It also distinguishes run_script from sibling tools by emphasizing full-code script execution via python3/bash rather than prebuilt tool or pipeline execution.

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 for when to use the tool: when arbitrary Python or Bash code must be written and executed, with an explicit security opt-in. It does not explicitly name alternatives like run_tool or state when not to use run_script, so it misses the top tier, but the intended usage is unmistakable.

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