get_assessment_json_output
Retrieve the JSON execution plan from an assessment result in Terraform Cloud, providing a machine-readable format of planned resource changes and actions.
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
| Name | Required | Description | Default |
|---|---|---|---|
| assessment_result_id | Yes |
Implementation Reference
- The handler function for the 'get_assessment_json_output' tool. It validates the assessment_result_id using AssessmentOutputRequest, then makes an API request to retrieve the JSON output from the Terraform Cloud assessment result endpoint, following redirects and accepting text response for the potentially large JSON file.@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, )
- terraform_cloud_mcp/server.py:106-110 (registration)Registration of the assessment results tools, including 'get_assessment_json_output', using FastMCP's mcp.tool() decorator in the main server file.# Register assessment results tools mcp.tool()(assessment_results.get_assessment_result_details) mcp.tool()(assessment_results.get_assessment_json_output) mcp.tool()(assessment_results.get_assessment_json_schema) mcp.tool()(assessment_results.get_assessment_log_output)
- terraform_cloud_mcp/server.py:13-24 (helper)Imports of all tools modules, including assessment_results which contains the get_assessment_json_output handler.from terraform_cloud_mcp.tools import account from terraform_cloud_mcp.tools import workspaces from terraform_cloud_mcp.tools import runs from terraform_cloud_mcp.tools import organizations from terraform_cloud_mcp.tools import plans from terraform_cloud_mcp.tools import applies from terraform_cloud_mcp.tools import projects from terraform_cloud_mcp.tools import cost_estimates from terraform_cloud_mcp.tools import assessment_results from terraform_cloud_mcp.tools import state_versions from terraform_cloud_mcp.tools import state_version_outputs from terraform_cloud_mcp.tools import variables