force_execute_run
Cancel prior runs to prioritize immediate execution of a specific Terraform run, unlocking the workspace for urgent tasks. Use this tool to manage run queues effectively.
Instructions
Forcefully execute a run by canceling all prior runs
Prioritizes a specific run by canceling other queued runs to unlock the workspace, equivalent to clicking "Run this plan now" in the UI. Use this when a run is stuck in the pending queue but needs immediate execution due to urgency or priority over other queued runs.
API endpoint: POST /runs/{run_id}/actions/force-execute
Args: run_id: The ID of the run to execute (format: "run-xxxxxxxx")
Returns: Status update confirming the run has been promoted to active status, with information about which runs were canceled to allow execution
See: docs/tools/run.md for reference documentation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| run_id | Yes |
Implementation Reference
- The primary handler function implementing the logic for the 'force_execute_run' tool. It performs a POST request to the Terraform Cloud API endpoint to force-execute the specified run by canceling prior queued runs.@handle_api_errors async def force_execute_run(run_id: str) -> APIResponse: """Forcefully execute a run by canceling all prior runs Prioritizes a specific run by canceling other queued runs to unlock the workspace, equivalent to clicking "Run this plan now" in the UI. Use this when a run is stuck in the pending queue but needs immediate execution due to urgency or priority over other queued runs. API endpoint: POST /runs/{run_id}/actions/force-execute Args: run_id: The ID of the run to execute (format: "run-xxxxxxxx") Returns: Status update confirming the run has been promoted to active status, with information about which runs were canceled to allow execution See: docs/tools/run.md for reference documentation """ # Make API request return await api_request(f"runs/{run_id}/actions/force-execute", method="POST")
- terraform_cloud_mcp/server.py:72-72 (registration)Registers the 'force_execute_run' tool with the MCP server using the write_tool_config for permissions and annotations.mcp.tool(**write_tool_config)(runs.force_execute_run)
- terraform_cloud_mcp/server.py:39-42 (helper)Configuration dictionary applied to write-enabled tools like 'force_execute_run' during registration, controlling whether the tool is enabled based on read-only mode and setting read-only hint annotation.write_tool_config = { "enabled": not read_only_mode, "annotations": {"readOnlyHint": False} }