Skip to main content
Glama
severity1

terraform-cloud-mcp

create_variable_set

Create a new variable set to manage Terraform variables across multiple workspaces and projects in your organization.

Instructions

Create a new variable set in an organization.

Creates a new variable set which can be used to manage variables across multiple workspaces and projects.

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

Args: organization: The name of the organization name: The name to give the variable set

params: Additional variable set parameters (optional):
    - description: Description of the variable set
    - global: Whether this is a global variable set
    - priority: Whether this variable set takes priority over workspace variables

Returns: The created variable set with its configuration and metadata

See: docs/tools/variables.md#create-variable-set for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationYes
nameYes
paramsNo

Implementation Reference

  • The main async handler function that executes the tool logic: creates a variable set by constructing a request payload and calling the Terraform Cloud API.
    @handle_api_errors
    async def create_variable_set(
        organization: str,
        name: str,
        params: Optional[VariableSetParams] = None,
    ) -> APIResponse:
        """Create a new variable set in an organization.
    
        Creates a new variable set which can be used to manage variables across
        multiple workspaces and projects.
    
        API endpoint: POST /organizations/{organization}/varsets
    
        Args:
            organization: The name of the organization
            name: The name to give the variable set
    
            params: Additional variable set parameters (optional):
                - description: Description of the variable set
                - global: Whether this is a global variable set
                - priority: Whether this variable set takes priority over workspace variables
    
        Returns:
            The created variable set with its configuration and metadata
    
        See:
            docs/tools/variables.md#create-variable-set for reference documentation
        """
        param_dict = params.model_dump(exclude_none=True) if params else {}
        request = VariableSetCreateRequest(
            organization=organization, name=name, **param_dict
        )
    
        payload = create_api_payload(
            resource_type="varsets", model=request, exclude_fields={"organization"}
        )
    
        return await api_request(
            f"organizations/{organization}/varsets", method="POST", data=payload
        )
  • Pydantic model defining optional parameters (name, description, global, priority) for variable set creation and updates.
    class VariableSetParams(APIRequest):
        """Parameters for variable set operations without routing fields.
    
        This model provides all optional parameters for creating or updating variable
        sets, separating configuration parameters from routing information.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets
    
        See:
            docs/models/variables.md for reference
        """
    
        name: Optional[str] = Field(
            None,
            description="Variable set name",
            min_length=1,
            max_length=90,
        )
        description: Optional[str] = Field(
            None,
            description="Description of the variable set",
            max_length=512,
        )
        global_: Optional[bool] = Field(
            None,
            alias="global",
            description="Whether this is a global variable set",
        )
        priority: Optional[bool] = Field(
            None,
            description="Whether this variable set takes priority over workspace variables",
        )
  • Pydantic model for the full create request, including required organization and name fields, embedding optional params.
    class VariableSetCreateRequest(APIRequest):
        """Request model for creating variable sets.
    
        Used for POST /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,
        )
        name: str = Field(
            ...,
            description="Variable set name",
            min_length=1,
            max_length=90,
        )
        params: Optional[VariableSetParams] = Field(
            None,
            description="Additional variable set parameters",
        )
  • Registers the create_variable_set handler as an MCP tool with write permissions configuration.
    mcp.tool(**write_tool_config)(variables.create_variable_set)
Behavior3/5

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

Annotations provide readOnlyHint=false (indicating a write operation), which aligns with the 'Create' action. The description adds useful context about what gets created (variable set with configuration/metadata) and mentions the API endpoint, but doesn't disclose behavioral traits like authentication requirements, rate limits, or error conditions beyond what annotations already indicate.

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 with clear sections (purpose, API endpoint, args, returns, see). It's appropriately sized and front-loaded with the core purpose. The 'See' reference could be considered slightly extraneous but doesn't significantly detract from conciseness.

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

Completeness4/5

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

For a creation tool with no output schema and 0% schema description coverage, the description provides substantial context: clear purpose, parameter documentation, return value description, and API endpoint. It adequately covers what the tool does and what to expect, though it could benefit from more behavioral details like error cases or permissions required.

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?

With 0% schema description coverage, the description carries full burden. It clearly documents all 3 parameters (organization, name, params) and provides meaningful details about the params subfields (description, global, priority). This significantly compensates for the lack of schema descriptions, though it doesn't cover all possible parameter constraints.

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

Purpose5/5

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

The description clearly states the specific action ('Create a new variable set') and resource ('in an organization'), and distinguishes it from siblings by explaining its unique purpose ('manage variables across multiple workspaces and projects'). It goes beyond just restating the name/title.

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 context by mentioning variable management across workspaces and projects, but doesn't explicitly state when to use this tool versus alternatives like 'create_workspace_variable' or 'update_variable_set'. No explicit when-not-to-use guidance or prerequisite information is provided.

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