Skip to main content
Glama
runwhen-contrib

RunWhen Platform MCP

Run Script

run_script

Execute a script on a specified RunWhen runner for testing, returning a run ID to monitor execution and retrieve results.

Instructions

Execute a script on a RunWhen runner for testing.

Sends the script to the workspace's runner at the specified location. Returns a run ID that can be used with get_run_status and get_run_output to monitor execution and retrieve results.

The script must follow the RunWhen contract:

  • Python task: define main() returning List[Dict] with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.

  • Python SLI: define main() returning a float 0-1.

  • Bash task: define main() writing issue JSON array to FD 3 (>&3).

  • Bash SLI: define main() writing a metric float to FD 3.

Provide exactly one of: script | script_base64 | script_gzip_base64 | script_path (stdio) | script_base64_path (stdio). Use script_gzip_base64 for scripts >5KB to maximise transport headroom.

Use validate_script first to check compliance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptNoThe full script source code (raw text).
env_varsNoEnvironment variables (e.g. {'NAMESPACE': 'default'}).
locationNoRunner location (use get_workspace_locations).
run_typeNo'task' or 'sli'.task
interpreterNo'bash' or 'python'.bash
script_pathNoLocal file path to read the script from. **stdio mode only.** Mutually exclusive with the other script_* params.
secret_varsNoSecret mappings (e.g. {'kubeconfig': 'kubeconfig'}).
script_base64NoUTF-8 script as standard base64. Prefer over inline 'script' when JSON-escaping multiline content is error-prone.
workspace_nameYesThe workspace to run in (e.g. 't-oncall').
script_base64_pathNoLocal file path to a file containing the base64-encoded script. **stdio mode only.**
script_gzip_base64NoUTF-8 script as base64(gzip(...)). Best inline option for scripts >5KB — 3-5x denser than 'script_base64'. Encode with: base64.b64encode(gzip.compress(script.encode())).decode().

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/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 substantial work: it discloses the async return contract (run ID + which tools consume it), the runner/location requirement, and the mandatory RunWhen script contract for four execution modes. It omits auth/permission requirements and any timeout or failure behavior.

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 with purpose, then follow-up tools, then the contract block, then transport guidance — a logical order. The contract enumeration is dense but each line is load-bearing; only minor tightening is possible.

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?

For an 11-parameter mutation-style tool with an output schema, the description covers the essentials an agent needs: execution semantics, prerequisite validation, transport encoding selection, and the required script contract. Return format details are rightly delegated to the output schema.

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 100%, so baseline is 3; the description exceeds it by consolidating a mutual-exclusivity rule ('provide exactly one of script | script_base64 | script_gzip_base64 | script_path | script_base64_path') and by recommending gzip for >5KB. It adds the RunWhen contract semantics (task vs SLI, Python vs Bash) that the schema fields alone do not convey.

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?

Specific verb+resource: 'Execute a script on a RunWhen runner for testing', with an explicit statement that it returns a run ID for polling via get_run_status/get_run_output. It distinguishes itself implicitly from the sibling run_script_and_wait by framing execution as async/monitorable, but never names that sibling to draw the line explicitly.

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?

Gives clear context ('for testing') and an explicit prerequisite ('Use validate_script first to check compliance'). It also routes encoding choice ('use script_gzip_base64 for scripts >5KB'). It lacks explicit guidance on when to prefer this over run_script_and_wait, which is the closest alternative.

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