Skip to main content
Glama

list_variable_sets

Retrieve a paginated list of variable sets in a Terraform Cloud organization to manage and reuse variables across multiple workspaces efficiently.

Instructions

List variable sets in an organization.

Retrieves a paginated list of all variable sets in a Terraform Cloud organization. Variable sets allow you to reuse variables across multiple workspaces.

API endpoint: GET /organizations/{organization}/varsets

Args: organization: The name of the organization 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 variable sets with their configuration and metadata

See: docs/tools/variables.md#list-variable-sets for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationYes
page_numberNo
page_sizeNo

Implementation Reference

  • The main execution logic for the 'list_variable_sets' tool. Makes a paginated GET request to the Terraform Cloud API endpoint /organizations/{organization}/varsets using the VariableSetListRequest model for parameters.
    async def list_variable_sets( organization: str, page_number: int = 1, page_size: int = 20, ) -> APIResponse: """List variable sets in an organization. Retrieves a paginated list of all variable sets in a Terraform Cloud organization. Variable sets allow you to reuse variables across multiple workspaces. API endpoint: GET /organizations/{organization}/varsets Args: organization: The name of the organization 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 variable sets with their configuration and metadata See: docs/tools/variables.md#list-variable-sets for reference documentation """ request = VariableSetListRequest( organization=organization, page_number=page_number, page_size=page_size, ) params = query_params(request) return await api_request( f"organizations/{organization}/varsets", method="GET", params=params )
  • Pydantic model defining the input schema (query parameters) for the list_variable_sets tool, including organization, page_number, and page_size with validation.
    class VariableSetListRequest(APIRequest): """Request model for listing variable sets. Used for GET /organizations/:organization/varsets endpoint. Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets See: docs/models/variables.md for reference """ organization: str = Field( ..., description="The organization name", min_length=1, ) page_number: int = Field( 1, description="The page number to return", ge=1, ) page_size: int = Field( 20, description="The number of items per page", ge=1, le=100, )
  • Registers the list_variable_sets function as an MCP tool in the server.
    mcp.tool()(variables.list_variable_sets)

Other Tools

Related 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