Skip to main content
Glama

get_assessment_json_schema

Retrieve the JSON schema from Terraform Cloud assessment results to understand available resources and configuration options used during infrastructure evaluation.

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

TableJSON Schema
NameRequiredDescriptionDefault
assessment_result_idYes

Implementation Reference

  • The main async handler function for the 'get_assessment_json_schema' tool. It validates the assessment_result_id using AssessmentOutputRequest and performs an API GET request to /assessment-results/{id}/json-schema, returning the JSON schema with accept_text=True to handle large files.
    @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, )
  • Pydantic input schema models used for validation in the handler. AssessmentOutputRequest (lines 58-70) inherits from AssessmentResultRequest (lines 39-56), defining 'assessment_result_id' with regex pattern '^asmtres-[a-zA-Z0-9]{8,}$' for the tool input.
    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
  • Registration of the 'get_assessment_json_schema' tool in the FastMCP server using the mcp.tool() decorator.
    mcp.tool()(assessment_results.get_assessment_json_schema)

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