Skip to main content
Glama
runwhen-contrib

RunWhen Platform MCP

run_script_and_wait

Run a script, wait for it to finish, and get the full output in one call. Supports Python tasks/SLIs and Bash scripts with secret variable injection.

Instructions

Execute a script and wait for results (combines run + poll + output).

This is a convenience tool that runs a script, polls until completion, and returns the full output — all in one call. Use this instead of calling run_script + get_run_status + get_run_output separately.

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.

Bash scripts must NOT include main "$@" at the bottom. The runner sources the script and invokes main() itself with FD 3 wired to a run_output.json file. A trailing main "$@" triggers a preflight invocation with FD 3 read-only and produces misleading "Bad file descriptor" errors.

secret_vars entries are injected as env vars whose VALUE is a FILE PATH on the runner — not the secret value itself. kubectl/KUBECONFIG and gcloud/GOOGLE_APPLICATION_CREDENTIALS work unchanged. For tokens/ passwords the script must cat "$VAR" (bash) or open(os.environ["VAR"]).read() (python) to get the actual value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptNoThe full script source code (raw text).
env_varsNoEnvironment variables for the script.
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 (env var name to workspace secret key).
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'.
runtime_var_overridesNoPer-run override values for script variables (name → value). Merged into envVars at test time. Overrides win on name collision.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Although no annotations exist, the description thoroughly discloses behavioral aspects: it polls until completion, returns full output, explains the script contract requirements, warns about the Bash 'main "$@"' pitfall, details secret_vars behavior (value is a file path, not the secret itself), and specifies the mutual exclusivity of script parameters.

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?

The description is longer than average but every sentence is informative. It is well-structured: starts with purpose, then contract, then parameter guidance, then warnings. Slightly verbose but justified by the tool's complexity.

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 a tool with 12 parameters, a required workspace_name, and an output schema (not detailed in description), the description is remarkably complete. It covers script contract, parameter selection, environment variables, secrets, runtime overrides, and location. No significant gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 100% schema description coverage, the description adds critical meaning beyond the schema: it clarifies the mutual exclusivity of script parameters, recommends script_gzip_base64 for large scripts, explains that secret_vars values are file paths, and describes runtime_var_overrides merging with env_vars. This adds significant value for proper usage.

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 'Execute a script and wait for results (combines run + poll + output).' It explicitly distinguishes from sibling tools run_script, get_run_status, and get_run_output by saying 'Use this instead of calling ... separately.' The verb 'execute' and resource 'script' are specific, and the scope 'wait for results' is well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises when to use this tool: as a convenience wrapper over the separate run-poll-output steps. It also gives alternatives (the individual calls) and provides important prerequisites: the script must follow the RunWhen contract with specific return types for Python/Bash tasks and SLIs.

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/runwhen-contrib/runwhen-platform-mcp'

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