list_state_version_outputs
Retrieve a paginated list of outputs for a specific Terraform state version, including name, value, and sensitivity details. Use this tool to manage and analyze Terraform Cloud infrastructure efficiently.
Instructions
List outputs for a state version.
Retrieves a paginated list of all outputs for a specific state version. These outputs include name, value, and sensitivity information.
API endpoint: GET /state-versions/:state_version_id/outputs
Args: state_version_id: The ID of the state version (format: "sv-xxxxxxxx") page_number: The page number to return (default: 1) page_size: The number of items per page (default: 20, max: 100)
Returns: Paginated list of state version outputs with name, value, and sensitivity information
See: docs/tools/state_version_outputs.md for reference documentation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page_number | No | ||
| page_size | No | ||
| state_version_id | Yes |
Implementation Reference
- The handler function that executes the list_state_version_outputs tool. It validates input using the schema model, builds query parameters, and makes an API request to retrieve paginated state version outputs from Terraform Cloud.@handle_api_errors async def list_state_version_outputs( state_version_id: str, page_number: int = 1, page_size: int = 20 ) -> APIResponse: """List outputs for a state version. Retrieves a paginated list of all outputs for a specific state version. These outputs include name, value, and sensitivity information. API endpoint: GET /state-versions/:state_version_id/outputs Args: state_version_id: The ID of the state version (format: "sv-xxxxxxxx") page_number: The page number to return (default: 1) page_size: The number of items per page (default: 20, max: 100) Returns: Paginated list of state version outputs with name, value, and sensitivity information See: docs/tools/state_version_outputs.md for reference documentation """ # Validate parameters params = StateVersionOutputListRequest( state_version_id=state_version_id, page_number=page_number, page_size=page_size, ) # Build query parameters using utility function query = query_params(params) # Make API request return await api_request( f"state-versions/{params.state_version_id}/outputs", params=query )
- Pydantic model defining the input schema for the list_state_version_outputs tool, including validation for state_version_id, page_number, and page_size.class StateVersionOutputListRequest(APIRequest): """Request parameters for listing state version outputs. Defines the parameters for the state version outputs listing API including pagination. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/state-version-outputs#list-state-version-outputs See: docs/models/state_version_outputs.md for reference """ state_version_id: str = Field( ..., description="The ID of the state version to list outputs for", pattern=r"^sv-[a-zA-Z0-9]{16}$", # Standard state version ID pattern ) page_number: Optional[int] = Field( 1, ge=1, description="Page number to fetch", ) page_size: Optional[int] = Field( 20, ge=1, le=100, description="Number of results per page", )
- terraform_cloud_mcp/server.py:120-120 (registration)Registration of the list_state_version_outputs tool using FastMCP's mcp.tool() decorator in the main server file.mcp.tool()(state_version_outputs.list_state_version_outputs)