Skip to main content
Glama

get_cost_estimate_details

Retrieve detailed cost estimation information, including resource counts, monthly costs, and status, for a specific Terraform Cloud cost estimate using its unique ID.

Instructions

Get details for a specific cost estimate.

Retrieves comprehensive information about a cost estimate including its current status, resource counts, monthly cost estimations, and relationship to other resources.

API endpoint: GET /cost-estimates/{cost_estimate_id}

Args: cost_estimate_id: The ID of the cost estimate to retrieve details for (format: "ce-xxxxxxxx")

Returns: Cost estimate details including status, timestamps, resource counts, and monthly cost estimations

Note: There is no endpoint to list cost estimates. You can find the ID for a cost estimate in the relationships.cost-estimate property of a run object.

See: docs/tools/cost_estimate.md for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cost_estimate_idYes

Implementation Reference

  • The async handler function that implements the tool logic: validates input with CostEstimateRequest model and calls the Terraform Cloud API to retrieve cost estimate details.
    @handle_api_errors async def get_cost_estimate_details(cost_estimate_id: str) -> APIResponse: """Get details for a specific cost estimate. Retrieves comprehensive information about a cost estimate including its current status, resource counts, monthly cost estimations, and relationship to other resources. API endpoint: GET /cost-estimates/{cost_estimate_id} Args: cost_estimate_id: The ID of the cost estimate to retrieve details for (format: "ce-xxxxxxxx") Returns: Cost estimate details including status, timestamps, resource counts, and monthly cost estimations Note: There is no endpoint to list cost estimates. You can find the ID for a cost estimate in the `relationships.cost-estimate` property of a run object. See: docs/tools/cost_estimate.md for reference documentation """ # Validate parameters params = CostEstimateRequest(cost_estimate_id=cost_estimate_id) # Make API request return await api_request(f"cost-estimates/{params.cost_estimate_id}")
  • Pydantic input schema model CostEstimateRequest that validates the cost_estimate_id parameter (must match pattern ^ce-[a-zA-Z0-9]{16}$). Used in the handler for parameter validation.
    class CostEstimateRequest(APIRequest): """Request model for retrieving a cost estimate. Used to validate the cost estimate ID parameter for API requests. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/cost-estimates#show-a-cost-estimate See: docs/models/cost_estimate.md for reference """ cost_estimate_id: str = Field( ..., # No alias needed as field name matches API parameter description="The ID of the cost estimate to retrieve", pattern=r"^ce-[a-zA-Z0-9]{16}$", # Standard cost estimate ID pattern )
  • Tool registration in the MCP server using the FastMCP mcp.tool() decorator, importing from tools.cost_estimates.
    # Register cost estimates tools mcp.tool()(cost_estimates.get_cost_estimate_details)

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/severity1/terraform-cloud-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server