Skip to content

Tool Reference

The RunWhen Platform MCP server exposes tools in three groups: workspace intelligence, chat rules and commands, and task authoring (Tool Builder).

Workspace intelligence

These tools let you query your RunWhen workspace for issues, tasks, run sessions, and resources — or ask the AI assistant directly.

ToolDescription
workspace_chatAsk the RunWhen AI assistant about your infrastructure. The assistant can search issues, tasks, run sessions, resources, and the knowledge base. Supports graphs and Mermaid diagrams. Use persona_name to select an AI Assistant.
list_workspacesList all workspaces you have access to.
get_workspace_chat_configGet resolved chat rules and commands for a workspace (metadata only). Optional persona_name.
get_workspace_issuesGet current issues. Optional severity filter (1=critical, 2=high, 3=medium, 4=low).
get_workspace_slxsList SLXs (health checks and automation tasks) in the workspace.
get_run_sessionsGet recent run session results.
get_workspace_config_indexGet the full workspace configuration — resources, SLXs, and their relationships.
get_issue_detailsGet details for a specific issue by ID.
get_slx_runbookGet the runbook definition for an SLX, including tasks, configuration, and what it checks.
search_workspaceSearch tasks, resources, and configuration by keyword.

workspace_chat

This is the most powerful tool. It talks to the RunWhen AI assistant, which has access to 25+ internal tools. Use it for natural language questions about your infrastructure:

Using workspace chat, what's unhealthy in my production namespace?
Using workspace chat, show me a diagram of how my services connect.

The optional persona_name parameter selects which AI Assistant handles the request (e.g. eager-edgar, cautious-cathy). This matters for workspaces where your role is readandrunwithassistant — the persona determines which tasks the assistant can run.

Chat rules and commands

These tools manage the rules and slash-commands that customize your AI Assistants’ behavior.

ToolDescription
list_chat_rulesList chat rules. Filter by scope_type, scope_id, is_active.
get_chat_ruleGet a chat rule by ID (full content).
create_chat_ruleCreate a new chat rule.
update_chat_ruleUpdate an existing chat rule by ID.
list_chat_commandsList chat commands (slash-commands).
get_chat_commandGet a chat command by ID (full content).
create_chat_commandCreate a new chat command.
update_chat_commandUpdate an existing chat command by ID.

Scope types

Rules and commands can be scoped to different levels:

ScopeApplies to
platformAll workspaces across the platform
orgAll workspaces in an organization
workspaceA specific workspace
personaA specific AI Assistant
userA specific user

Task authoring — Tool Builder

These tools let you write, test, and deploy automation scripts as SLXs directly from your IDE.

ToolDescription
get_workspace_contextLoad the project’s RUNWHEN.md file with infrastructure conventions, naming patterns, and constraints. Call this before writing scripts.
validate_scriptCheck that a script follows the RunWhen contract (correct main() function, output format, etc.).
run_scriptSend a script to a RunWhen runner for execution. Returns a run_id for polling.
get_run_statusPoll the status of a script run (RUNNING, SUCCEEDED, FAILED).
get_run_outputGet parsed output from a completed run — issues, stdout, stderr.
run_script_and_waitConvenience tool that combines run_script + get_run_status + get_run_output in one call.
commit_slxCommit a tested script as an SLX to the workspace. Supports task-only, task + custom SLI, or task + cron-scheduled SLI.
delete_slxRemove an SLX from the workspace (via the sync/delete API).
get_workspace_secretsList available secret key names (e.g. kubeconfig, api-token).
get_workspace_locationsList runner locations where scripts can execute.
render_codecollection_skillRender a tested task as a private Custom Discovery CodeCollection bundle (generation rules + Jinja templates + SKILL_TEMPLATE.md + raw_script.{py,sh}). Writes to disk in stdio mode or returns files inline.
run_slxExecute an already-committed SLX’s runbook tasks on the runner. Use task_titles="*" (not display titles).
search_registrySearch the RunWhen CodeBundle Registry for reusable, production-tested automation. Always try this before writing a custom script.
get_registry_codebundleGet full details of a specific codebundle from the registry (config templates, env vars, deployment instructions).
deploy_registry_codebundleDeploy a registry codebundle as an SLX to a workspace (no inline script needed).
list_assistants / get_assistant / create_assistant / update_assistant / delete_assistantList, inspect, create, update, and delete AI Assistants (personas). An assistant’s short_name is the persona_name for workspace_chat.
list_knowledge_base_articles / get_knowledge_base_article / create_knowledge_base_article / update_knowledge_base_article / delete_knowledge_base_articleManage Knowledge Base articles (operational knowledge indexed into the Knowledge Overlay Graph).

Key parameters

run_script / run_script_and_wait:

ParameterTypeDescription
scriptstringFull script source code
locationstringRunner location (from get_workspace_locations)
interpreterstringbash or python
run_typestringtask or sli
env_varsobjectEnvironment variables (e.g. {"NAMESPACE": "default"})
secret_varsobjectSecret mappings — env var name to workspace secret key (e.g. {"kubeconfig": "kubeconfig"})

commit_slx:

ParameterTypeDescription
slx_namestringShort name in kebab-case (e.g. k8s-pod-health)
aliasstringHuman-readable display name
statementstringWhat should be true (e.g. “All pods should be running”)
scriptstringThe task script source code
task_titlestringHuman-readable task title
locationstringRunner location
interpreterstringbash or python
sli_scriptstringOptional custom SLI script (returns 0-1)
cron_schedulestringOptional cron expression to schedule the task
accessstringread-write or read-only
datastringlogs-bulk, config, or logs-stacktrace
resource_pathstringResource path for search indexing (auto-prefixed with custom/)
hierarchylist[string]Tag names for hierarchical grouping (e.g. ["platform", "workspace"])

render_codecollection_skill:

ParameterTypeDescription
bundle_namestringCodebundle directory name (kebab-case)
aliasstringHuman-readable SLX display name
statementstringSLX statement describing what should be true
workspace_namestringWorkspace used during testing (provenance)
scriptstringThe full script source code
interpreterstringbash or python
env_varsobjectEnvironment variables baked into the TaskSet config
secret_varsobjectSecret name → workspace secret key mappings
runtime_varslist[object]Per-run runtime variables (task-only)
accessstringread-write or read-only
datastringlogs-bulk, config, or logs-stacktrace
resource_pathstringResource path for search indexing (auto-prefixed with custom/)
hierarchylist[string]Tag names for hierarchical grouping
platformstringGeneration rule platform (default runwhen)
resource_typeslist[string]Resource types to match (default ["workspace"])
match_ruleslist[object]Match predicates for the generation rule
include_sliboolAlso emit an SLI template (requires sli_script)
sli_scriptstringSeparate SLI script (required when include_sli=True)
sli_interpreterstringInterpreter for the SLI script
output_dirstringWrite rendered files to this directory (stdio mode only)

See Tool Builder for the full authoring workflow and script contract, and the Author Custom Tasks with MCP guide for the GitOps CodeCollection flow.