get_plan_details
Retrieve detailed information about a specific Terraform Cloud plan, including status, logs, resource changes, and timestamps, using the plan ID.
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 main asynchronous handler function that validates the plan_id using PlanRequest model and fetches the 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}")
- Pydantic-based input schema model PlanRequest that validates the plan_id parameter with regex pattern for Terraform Cloud 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 )
- terraform_cloud_mcp/server.py:83-83 (registration)Tool registration line where get_plan_details from the plans module is registered as an MCP tool using the FastMCP decorator.mcp.tool()(plans.get_plan_details)