Skip to main content
Glama
severity1

terraform-cloud-mcp

get_errored_state

Retrieve failed Terraform state files from Terraform Cloud to recover data after apply errors. Access state information when uploads fail during infrastructure deployment.

Instructions

Retrieve the errored state from a failed apply.

Gets information about a state file that failed to upload during an apply, providing access to the state data for recovery purposes.

API endpoint: GET /applies/{apply_id}/errored-state

Args: apply_id: The ID of the apply with a failed state upload (format: "apply-xxxxxxxx")

Returns: Information about the errored state including access details. The redirect to the state file is automatically followed.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apply_idYes

Implementation Reference

  • The main handler function that implements the tool logic: retrieves errored state from a failed Terraform Cloud apply by calling the API endpoint /applies/{apply_id}/errored-state, with input validation using ApplyErroredStateRequest model.
    @handle_api_errors
    async def get_errored_state(apply_id: str) -> APIResponse:
        """Retrieve the errored state from a failed apply.
    
        Gets information about a state file that failed to upload during an apply,
        providing access to the state data for recovery purposes.
    
        API endpoint: GET /applies/{apply_id}/errored-state
    
        Args:
            apply_id: The ID of the apply with a failed state upload (format: "apply-xxxxxxxx")
    
        Returns:
            Information about the errored state including access details.
            The redirect to the state file is automatically followed.
    
        See:
            docs/tools/apply.md for reference documentation
        """
        # Validate parameters
        params = ApplyErroredStateRequest(apply_id=apply_id)
    
        # Make API request - redirect handling happens automatically in the API client
        return await api_request(f"applies/{params.apply_id}/errored-state")
  • The tool registration line in the MCP server, applying the mcp.tool() decorator to the imported get_errored_state function from the applies module.
    mcp.tool()(applies.get_errored_state)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It usefully describes that the tool follows redirects automatically and provides access to state data for recovery, but lacks details about permissions needed, rate limits, error handling, or response format. It adequately covers the core behavior but misses operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose. Each sentence adds value: the first states what it does, the second elaborates context, the third gives API details, and subsequent sections clarify parameters, returns, and references. There is no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides adequate context for a simple read operation with one parameter. It covers purpose, usage, parameter details, and behavioral notes like redirect following, but lacks information on response structure, error cases, or authentication requirements, leaving some gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides the parameter name (apply_id) and clarifies its format ('apply-xxxxxxxx') and context ('The ID of the apply with a failed state upload'), adding meaningful semantics beyond the bare schema. However, it does not explain validation rules or provide examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Retrieve', 'Gets') and resources ('errored state from a failed apply', 'information about a state file that failed to upload'). It distinguishes itself from siblings by focusing on recovery of failed state uploads, unlike general state tools like get_state_version or download_state_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('from a failed apply', 'during an apply', 'for recovery purposes'), but does not explicitly state when not to use it or name specific alternatives. It implies usage for recovery scenarios without detailing prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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