Skip to main content
Glama
severity1

terraform-cloud-mcp

get_current_state_version

Retrieve the current Terraform state version for a workspace to access input state details and download URLs for infrastructure operations.

Instructions

Get the current state version for a workspace.

Retrieves the current state version for a workspace, which is the input state when running terraform operations.

API endpoint: GET /workspaces/:workspace_id/current-state-version

Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx")

Returns: The current state version including details and download URLs

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idYes

Implementation Reference

  • The handler function that retrieves the current state version for a given workspace ID using the Terraform Cloud API endpoint GET /workspaces/:workspace_id/current-state-version. It validates input with CurrentStateVersionRequest model and uses api_request utility.
    @handle_api_errors
    async def get_current_state_version(workspace_id: str) -> APIResponse:
        """Get the current state version for a workspace.
    
        Retrieves the current state version for a workspace, which is the input
        state when running terraform operations.
    
        API endpoint: GET /workspaces/:workspace_id/current-state-version
    
        Args:
            workspace_id: The ID of the workspace (format: "ws-xxxxxxxx")
    
        Returns:
            The current state version including details and download URLs
    
        See:
            docs/tools/state_versions.md for reference documentation
        """
        # Validate parameters
        params = CurrentStateVersionRequest(workspace_id=workspace_id)
    
        # Make API request
        return await api_request(f"workspaces/{params.workspace_id}/current-state-version")
  • Pydantic model for input validation of the workspace_id parameter, ensuring it matches the ws-xxxxxxxx pattern.
    class CurrentStateVersionRequest(APIRequest):
        """Request model for retrieving a workspace's current state version.
    
        Used to validate the workspace ID parameter for current state version API requests.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/state-versions#get-current-state-version
    
        See:
            docs/models/state_versions.md for reference
        """
    
        workspace_id: str = Field(
            ...,
            description="The ID of the workspace to retrieve the current state version for",
            pattern=r"^ws-[a-zA-Z0-9]{16}$",  # Standard workspace ID pattern
        )
  • Tool registration using FastMCP's mcp.tool() decorator, importing from tools.state_versions.
    mcp.tool()(state_versions.get_current_state_version)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that this is a read operation ('Get', 'Retrieves'), which is helpful, but lacks details on behavioral traits like authentication requirements, rate limits, error conditions, or whether it's idempotent. The API endpoint mention adds some context, but overall, the behavioral disclosure is minimal for a tool with no annotation coverage.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by clarifying details, API endpoint, Args, Returns, and a See reference. Each section earns its place without redundancy, and the structure is logical and easy to parse. No sentences are wasted.

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 the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It explains the parameter and return value at a high level, but without annotations or output schema, it lacks details on response structure, error handling, or prerequisites. For a read-only tool, this is adequate but not fully comprehensive.

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?

With 0% schema description coverage and only 1 parameter, the description compensates well by explaining the 'workspace_id' parameter in the Args section: 'The ID of the workspace (format: "ws-xxxxxxxx")'. This adds crucial semantic meaning beyond the bare schema, specifying the format and purpose. However, it doesn't cover edge cases or examples, preventing a perfect score.

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

Purpose4/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: 'Get the current state version for a workspace' and specifies it retrieves the input state for Terraform operations. It uses specific verbs ('Get', 'Retrieves') and identifies the resource ('state version for a workspace'). However, it doesn't explicitly differentiate from sibling tools like 'get_state_version' or 'list_state_versions', which is why it doesn't achieve a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions retrieving the 'current' state version but doesn't clarify when to choose this over 'get_state_version' (which might fetch a specific version) or 'list_state_versions' (which lists multiple). There are no explicit when/when-not instructions or named alternatives, leaving usage context implied at best.

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