get_assessment_json_schema
Retrieve the JSON schema of a Terraform Cloud assessment result to access resource and configuration details. Requires admin access to the workspace.
Instructions
Retrieve the JSON schema file from an assessment result.
Gets the JSON schema representation of the provider schema used during the assessment, providing information about available resources and their configuration options.
API endpoint: GET /api/v2/assessment-results/{assessment_result_id}/json-schema
Args: assessment_result_id: The ID of the assessment result to retrieve schema for (format: "asmtres-xxxxxxxx")
Returns: The JSON schema file containing provider information. 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 that implements the tool logic. It validates the assessment_result_id using AssessmentOutputRequest model, then calls the Terraform Cloud API to fetch the JSON schema from the /json-schema endpoint, handling redirects and accepting text response.@handle_api_errors async def get_assessment_json_schema(assessment_result_id: str) -> APIResponse: """Retrieve the JSON schema file from an assessment result. Gets the JSON schema representation of the provider schema used during the assessment, providing information about available resources and their configuration options. API endpoint: GET /api/v2/assessment-results/{assessment_result_id}/json-schema Args: assessment_result_id: The ID of the assessment result to retrieve schema for (format: "asmtres-xxxxxxxx") Returns: The JSON schema file containing provider information. 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-schema", accept_text=True, )
- terraform_cloud_mcp/server.py:109-109 (registration)Registers the get_assessment_json_schema tool with the FastMCP server using the mcp.tool() decorator.mcp.tool()(assessment_results.get_assessment_json_schema)
- terraform_cloud_mcp/server.py:21-21 (registration)Imports the assessment_results module containing the get_assessment_json_schema function for registration.from terraform_cloud_mcp.tools import assessment_results