Skip to main content
Glama
runwhen-contrib

RunWhen Platform MCP

Commit Slx

commit_slx

Commits a tested script as an SLX to the workspace Git repo, generating a RunWhen runbook task or SLI for automation.

Instructions

Commit a tested script as an SLX to the workspace Git repo.

Skills:

  • runwhen-skill://build-runwhen-task (authoring workflow)

  • runwhen-skill://discover-secrets (secret_vars mapping)

  • runwhen-skill://discover-locations (location selection)

  • runwhen-skill://configure-hierarchy (hierarchy/resource_path)

Creates a new SLX with the script as a Task (runbook) and/or SLI. The script should already be tested via run_script or run_script_and_wait.

This writes slx.yaml + runbook.yaml (for tasks) or slx.yaml + sli.yaml (for SLIs) to the workspace repository.

Script-source parameter matrix (provide exactly one task variant; SLI variants mirror the names):

Variant

Best for

Mode

script

Small scripts <~5KB, readable

any

script_base64

Any size; safe JSON escaping

any

script_gzip_base64

>5KB; 3-5x denser than b64

any

script_path

Local file, raw text

stdio only

script_base64_path

Local file with base64 blob

stdio only

For very large scripts (combined task+SLI >~50KB) prefer publishing as a registry codebundle and using deploy_registry_codebundle.

To commit BOTH a task AND an SLI on the same SLX:

  1. Custom SLI script (preferred): set task_type="task" and provide a separate lightweight sli_script that emits ONE float between 0 and 1 (e.g. failing_pods / total_pods). The SLI script MUST be its own small probe — DO NOT duplicate the task body. The server rejects identical task+SLI content.

  2. Cron-scheduler SLI: set task_type="task" and provide cron_schedule with a cron expression (e.g. "0 */2 * * *"). The SLI will trigger the task's runbook on that schedule. No sli_script needed.

Output contracts (the two scripts are NOT interchangeable):

  • Task (interpreter, task_type='task'): returns/writes a List[Dict] of issues with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.

  • SLI (sli_interpreter, implied task_type='sli'): returns/writes ONE float between 0 and 1.

Script-content footguns:

  • 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, producing misleading "Bad file descriptor" errors. Just define main() and stop there.

  • secret_vars entries are injected at runtime as env vars whose VALUE is a FILE PATH on the runner — not the secret value itself. Tools that read paths natively (kubectl/KUBECONFIG, 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
dataNo'logs-bulk', 'config', or 'logs-stacktrace'.logs-bulk
tagsNoResource tags ({name, value} dicts).
aliasYesHuman-readable display name (e.g. 'Pod Health Check').
accessNo'read-write' or 'read-only'.read-write
branchNoGit branch to commit to.main
ownersNoOwner emails (defaults to current user).
scriptNoThe full script source code (not base64).
env_varsNoEnvironment variables baked into the SLX config.
locationNoRunner location (use get_workspace_locations).
slx_nameYesShort SLX name (lowercase-kebab-case, e.g. 'k8s-pod-health').
hierarchyNoTag names for hierarchical grouping.
image_urlNoIcon URL for the SLX.
statementYesSLX statement (e.g. 'All pods should be running').
task_typeNo'task' (runbook) or 'sli' (indicator).task
sli_scriptNoOptional SLI script (returns float 0-1).
task_titleNoHuman-readable task title.
interpreterNo'bash' or 'python'.bash
script_pathNoLocal file path for main script. **stdio mode only.** Mutually exclusive with the other script_* params.
secret_varsNoSecret mappings baked into the SLX config.
runtime_varsNoPer-run task parameters that the END USER fills in when invoking the committed task (e.g. log queries, time windows, filters). Distinct from env_vars (set once by the task author — cluster, namespace, context) and secret_vars (credentials injected as file paths). Task-only — never valid for SLIs. Each entry requires: name (str), description (str), default (str), validation (dict with type='regex'+'pattern' or type='enum'+'values'). Names must be unique and must not overlap with env_vars or secret_vars.
cron_scheduleNoCron expression to schedule the task (e.g. '0 */2 * * *').
resource_pathNoResource path for search indexing.
script_base64NoUTF-8 main script as standard base64.
codebundle_refNoGit ref for the codebundle (auto-resolved if omitted).
commit_messageNoCustom commit message.
workspace_nameYesThe workspace to commit to (e.g. 't-oncall').
sli_interpreterNoInterpreter for the SLI script.
sli_script_pathNoLocal file path for SLI script. **stdio mode only.** Mutually exclusive with the other sli_script_* params.
interval_secondsNoFor SLIs, how often to run in seconds.
sli_script_base64NoUTF-8 SLI script as standard base64.
script_base64_pathNoLocal file path to a file containing the base64-encoded main script. **stdio mode only.**
script_gzip_base64NoUTF-8 main script as base64(gzip(...)). Best inline option for scripts >5KB — 3-5x denser than 'script_base64'.
sli_interval_secondsNoHow often the SLI runs in seconds.
sli_script_base64_pathNoLocal file path to a file containing the base64-encoded SLI script. **stdio mode only.**
sli_script_gzip_base64NoUTF-8 SLI script as base64(gzip(...)). Best inline option for SLI scripts that exceed simple-metric size.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries full disclosure and does so richly: exact files written, output contracts for task vs SLI, a server-side rejection rule (identical task+SLI content), and two behavioral footguns (bash trailing main "$@" causing FD 3 errors; secret_vars injected as file paths rather than values). This is the kind of context an agent cannot get from the schema.

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?

Long, but front-loaded with the purpose and organized into scannable sections, tables, and bullets that each carry load for a 35-parameter tool. Some prose (e.g. repeated SLI-variant explanations) could be tightened, but the density is largely justified by the operation'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?

Given a 35-param mutation tool with no annotations and an output schema (so return values need not be explained), the description is complete: it covers prerequisites, variant selection, dual-commit recipes, output contracts, and runtime footguns, leaving no obvious gap an agent would need to call it correctly.

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 coverage is 100%, so the schema baseline is 3, but the description adds real meaning beyond it: the script-source matrix (size/density/mode trade-offs), the runtime_vars vs env_vars vs secret_vars distinction, and which variants are stdio-only. It stops short of documenting a few params directly (branch, owners, interval_seconds), leaving that to the schema.

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?

States a specific verb+resource ('Commit a tested script as an SLX to the workspace Git repo') and clarifies what gets written (slx.yaml + runbook.yaml/sli.yaml). Clearly distinguishes itself from commit siblings like run_script and deploy_registry_codebundle, whose relationship is spelled out.

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?

Explicit prerequisites ('script should already be tested via run_script or run_script_and_wait'), a decision matrix mapping each script-source variant to a use case and mode, an alternative path for large scripts (registry codebundle + deploy_registry_codebundle), and two named recipes for committing task+SLI together.

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