Skip to main content
Glama
severity1

terraform-cloud-mcp

get_assessment_json_output

Retrieve JSON execution plans from Terraform Cloud assessments to analyze planned resource changes in machine-readable format for infrastructure management.

Instructions

Retrieve the JSON execution plan from an assessment result.

Gets the JSON representation of the plan execution details from an assessment, providing a machine-readable format of the planned resource changes.

API endpoint: GET /api/v2/assessment-results/{assessment_result_id}/json-output

Args: assessment_result_id: The ID of the assessment result to retrieve JSON output for (format: "asmtres-xxxxxxxx")

Returns: The complete JSON formatted plan with resource changes, metadata, and planned actions. The redirect is automatically followed.

Note: This endpoint requires admin level access to the workspace and cannot be accessed with organization tokens.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assessment_result_idYes

Implementation Reference

  • The main handler function for the 'get_assessment_json_output' tool. It validates the assessment_result_id using Pydantic models and performs an API request to the Terraform Cloud endpoint for JSON output, following redirects.
    @handle_api_errors
    async def get_assessment_json_output(assessment_result_id: str) -> APIResponse:
        """Retrieve the JSON execution plan from an assessment result.
    
        Gets the JSON representation of the plan execution details from an assessment,
        providing a machine-readable format of the planned resource changes.
    
        API endpoint: GET /api/v2/assessment-results/{assessment_result_id}/json-output
    
        Args:
            assessment_result_id: The ID of the assessment result to retrieve JSON output for (format: "asmtres-xxxxxxxx")
    
        Returns:
            The complete JSON formatted plan with resource changes, metadata,
            and planned actions. The redirect is automatically followed.
    
        Note:
            This endpoint requires admin level access to the workspace and cannot be accessed
            with organization tokens.
    
        See:
            docs/tools/assessment_results.md for reference documentation
        """
        # Validate parameters
        params = AssessmentOutputRequest(assessment_result_id=assessment_result_id)
    
        # Make API request with text acceptance since it may be a large JSON file
        return await api_request(
            f"assessment-results/{params.assessment_result_id}/json-output",
            accept_text=True,
        )
  • Pydantic input schema models used for validating the assessment_result_id parameter in the tool handler. AssessmentOutputRequest is instantiated for validation.
    class AssessmentResultRequest(APIRequest):
        """Request model for retrieving assessment result details.
    
        Used to validate the assessment result ID parameter for API requests.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/assessment-results#show-assessment-result
    
        See:
            docs/models/assessment_result.md for reference
        """
    
        assessment_result_id: str = Field(
            ...,
            # No alias needed as field name matches API parameter
            description="The ID of the assessment result to retrieve",
            pattern=r"^asmtres-[a-zA-Z0-9]{8,}$",  # Standard assessment result ID pattern
        )
    
    
    class AssessmentOutputRequest(AssessmentResultRequest):
        """Request model for retrieving assessment result outputs.
    
        Extends the base AssessmentResultRequest for specialized outputs like
        JSON plan, schema, and log output.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/assessment-results#retrieve-the-json-output-from-the-assessment-execution
    
        See:
            docs/models/assessment_result.md for reference
        """
    
        pass  # Uses the same validation as the parent class
  • The registration of the 'get_assessment_json_output' tool using FastMCP's mcp.tool() decorator in the main server file.
    mcp.tool()(assessment_results.get_assessment_json_output)
Behavior4/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 effectively describes key traits: it's a read operation ('Retrieve'), mentions that redirects are automatically followed, specifies admin-level access requirements, and notes the machine-readable JSON output format. This covers safety, authentication, and response behavior adequately for a retrieval tool.

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, starting with the core purpose. Each sentence adds value: explaining the output format, specifying the API endpoint, detailing parameters and returns, and noting access requirements. There is no wasted text, and the information is organized logically for quick comprehension.

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

Completeness4/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 largely complete. It covers purpose, usage, parameters, returns, and behavioral notes like access requirements. However, it lacks details on error handling or response structure specifics, which could be useful for a tool returning JSON data, leaving minor gaps.

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

Parameters5/5

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

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains that assessment_result_id is 'The ID of the assessment result to retrieve JSON output for' and specifies the required format ('asmtres-xxxxxxxx'), providing crucial context not present in the schema. This fully compensates for the schema's lack of descriptions.

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 specific action ('Retrieve the JSON execution plan') and resource ('from an assessment result'), distinguishing it from sibling tools like get_assessment_result_details or get_assessment_log_output by focusing on the JSON output format. It uses precise terminology like 'machine-readable format of the planned resource changes' to clarify the purpose.

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: to obtain JSON-formatted plan details from an assessment result. It mentions admin-level access requirements and notes that organization tokens cannot be used, which helps guide usage. However, it does not explicitly state when to choose this over alternatives like get_assessment_result_details or get_plan_json_output, missing explicit sibling differentiation.

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