Skip to main content
Glama
severity1

terraform-cloud-mcp

update_variable_set

Modify Terraform Cloud variable set configurations like name, description, global scope, or priority settings to adapt infrastructure management parameters.

Instructions

Update an existing variable set.

Modifies the settings of a variable set. Only specified attributes will be updated; unspecified attributes remain unchanged.

API endpoint: PATCH /varsets/{varset_id}

Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx")

params: Variable set parameters to update (optional):
    - name: New name for the variable set
    - description: New 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 updated variable set with all current settings and configuration

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
varset_idYes
paramsNo

Implementation Reference

  • The async handler function implementing the core logic for the 'update_variable_set' tool. It validates input using VariableSetParams, constructs the API payload, and performs a PATCH request to update the variable set in Terraform Cloud.
    @handle_api_errors
    async def update_variable_set(
        varset_id: str,
        params: Optional[VariableSetParams] = None,
    ) -> APIResponse:
        """Update an existing variable set.
    
        Modifies the settings of a variable set. Only specified attributes will be
        updated; unspecified attributes remain unchanged.
    
        API endpoint: PATCH /varsets/{varset_id}
    
        Args:
            varset_id: The ID of the variable set (format: "varset-xxxxxxxx")
    
            params: Variable set parameters to update (optional):
                - name: New name for the variable set
                - description: New 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 updated variable set with all current settings and configuration
    
        See:
            docs/tools/variables.md#update-variable-set for reference documentation
        """
        param_dict = params.model_dump(exclude_none=True) if params else {}
        request = VariableSetUpdateRequest(varset_id=varset_id, **param_dict)
    
        payload = create_api_payload(
            resource_type="varsets", model=request, exclude_fields={"varset_id"}
        )
    
        return await api_request(f"varsets/{varset_id}", method="PATCH", data=payload)
  • Pydantic schema model 'VariableSetParams' used for input validation of optional parameters (name, description, global, priority) passed to the update_variable_set handler.
    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",
        )
  • Tool registration line where 'update_variable_set' is registered as an MCP tool with write permissions configuration (enabled only if not in read-only mode).
    mcp.tool(**write_tool_config)(variables.update_variable_set)
  • Internal Pydantic request model 'VariableSetUpdateRequest' constructed in the handler, including varset_id validation and embedding VariableSetParams.
    class VariableSetUpdateRequest(APIRequest):
        """Request model for updating variable sets.
    
        Used for PATCH /varsets/:varset_id endpoint.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/variable-sets
    
        See:
            docs/models/variables.md for reference
        """
    
        varset_id: str = Field(
            ...,
            description="The variable set ID",
            pattern=r"^varset-[a-zA-Z0-9]{16}$",
        )
        params: Optional[VariableSetParams] = Field(
            None,
            description="Variable set parameters to update",
        )
Behavior3/5

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

Annotations provide readOnlyHint=false, indicating a mutation operation. The description adds context: it specifies a PATCH endpoint, explains partial updates ('Only specified attributes will be updated; unspecified attributes remain unchanged'), and mentions the return format ('The updated variable set with all current settings and configuration'). However, it lacks details on permissions, rate limits, or error conditions. No contradiction with annotations exists.

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

Conciseness3/5

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

The description is structured with a purpose statement, behavioral note, API endpoint, Args, Returns, and See reference. However, it includes redundant elements like the API endpoint (which may be internal) and a reference link that doesn't add immediate value. The 'Args' section is helpful but could be more integrated. It's front-loaded but has some fluff.

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 2 parameters, 0% schema coverage, no output schema, and annotations only covering readOnlyHint, the description does a decent job. It explains parameters and return values, but lacks context on error handling, authentication, or how this fits with sibling tools. For a mutation tool with minimal structured data, it's adequate but has clear gaps in operational guidance.

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. It provides a detailed 'Args' section explaining 'varset_id' format and listing 'params' sub-parameters (name, description, global, priority) with brief explanations. This adds significant meaning beyond the bare schema, though it doesn't cover all nuances like string length limits or null handling. With 0% coverage, this is strong but not exhaustive.

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: 'Update an existing variable set' and 'Modifies the settings of a variable set.' It specifies the verb ('update', 'modifies') and resource ('variable set'), making the action clear. However, it doesn't explicitly differentiate from sibling tools like 'update_variable_in_variable_set' or 'create_variable_set', which would require a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions 'Only specified attributes will be updated; unspecified attributes remain unchanged,' which is a behavioral detail but not usage guidance. There's no mention of prerequisites, when to choose this over 'create_variable_set' or 'update_variable_in_variable_set', or any exclusions.

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