get_plan_details
Retrieve comprehensive Terraform Cloud plan details including status, logs, resource counts, and relationships for infrastructure management.
Instructions
Get details for a specific plan.
Retrieves comprehensive information about a plan including its current status, logs, resource counts, and relationship to other resources.
API endpoint: GET /plans/{plan_id}
Args: plan_id: The ID of the plan to retrieve details for (format: "plan-xxxxxxxx")
Returns: Plan details including status, timestamps, and resource change counts
See: docs/tools/plan.md for reference documentation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes |
Implementation Reference
- terraform_cloud_mcp/tools/plans.py:19-42 (handler)The async handler function that validates input using PlanRequest model and fetches plan details from the Terraform Cloud API endpoint /plans/{plan_id}.@handle_api_errors async def get_plan_details(plan_id: str) -> APIResponse: """Get details for a specific plan. Retrieves comprehensive information about a plan including its current status, logs, resource counts, and relationship to other resources. API endpoint: GET /plans/{plan_id} Args: plan_id: The ID of the plan to retrieve details for (format: "plan-xxxxxxxx") Returns: Plan details including status, timestamps, and resource change counts See: docs/tools/plan.md for reference documentation """ # Validate parameters params = PlanRequest(plan_id=plan_id) # Make API request return await api_request(f"plans/{params.plan_id}")
- terraform_cloud_mcp/server.py:83-83 (registration)Registers the get_plan_details tool with the MCP server using mcp.tool() decorator.mcp.tool()(plans.get_plan_details)
- Pydantic input schema model PlanRequest that validates the plan_id parameter with regex pattern for plan IDs.class PlanRequest(APIRequest): """Request model for retrieving a plan. Used to validate the plan ID parameter for API requests. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/plans#show-a-plan See: docs/models/plan.md for reference """ plan_id: str = Field( ..., # No alias needed as field name matches API parameter description="The ID of the plan to retrieve", pattern=r"^plan-[a-zA-Z0-9]{16}$", # Standard plan ID pattern )