Skip to main content
Glama
severity1

terraform-cloud-mcp

list_variable_sets

Retrieve variable sets in a Terraform Cloud organization to reuse variables across multiple workspaces. Lists paginated sets with configuration and metadata.

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 asynchronous handler function that executes the list_variable_sets tool. It constructs a VariableSetListRequest, generates query parameters, and makes a GET request to the Terraform Cloud API endpoint /organizations/{organization}/varsets.
    @handle_api_errors
    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 and validation for the list_variable_sets tool parameters: organization (required str), page_number (int >=1, default 1), page_size (int 1-100, default 20). Used internally in the handler.
    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,
        )
  • Registration of the list_variable_sets tool in the MCP server using FastMCP's mcp.tool() decorator, importing from terraform_cloud_mcp.tools.variables.
    mcp.tool()(variables.list_variable_sets)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only partially discloses behavior. It states the tool retrieves a paginated list and includes pagination parameters, which is helpful. However, it doesn't cover critical aspects like whether this is a read-only operation (implied but not stated), rate limits, authentication needs, or error conditions, leaving significant gaps for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized, with a clear purpose statement upfront, followed by parameter details and return information. The API endpoint and reference link are useful but could be considered slightly extraneous; overall, most sentences earn their place without waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 3 parameters with 0% schema coverage, the description is moderately complete. It covers the purpose, parameters, and paginated return, but lacks details on output structure (e.g., what fields are in the list), error handling, or behavioral constraints, which are important for a list tool in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, which it does effectively. It explains all three parameters: 'organization' as the organization name, 'page_number' with default 1, and 'page_size' with default 20 and max 100. This adds clear meaning beyond the basic schema, though it doesn't detail format constraints (e.g., string patterns for organization).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'List variable sets in an organization' and specifies it retrieves a paginated list, which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_variable_set' (which retrieves a single variable set) or 'list_variables_in_variable_set' (which lists variables within a set), missing full sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning variable sets allow reuse across workspaces, suggesting this tool is for viewing available sets. However, it lacks explicit guidance on when to use this versus alternatives like 'get_variable_set' for a specific set or 'list_variables_in_variable_set' for details within a set, and provides no exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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