Skip to main content
Glama
severity1

terraform-cloud-mcp

assign_variable_set_to_workspaces

Assign a Terraform Cloud variable set to multiple workspaces to make shared variables available for infrastructure management.

Instructions

Assign a variable set to one or more workspaces.

Makes the variables in a variable set available to the specified workspaces. Variables from variable sets take precedence over workspace variables if the variable set has priority enabled.

API endpoint: POST /varsets/{varset_id}/relationships/workspaces

Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx") workspace_ids: List of workspace IDs (format: ["ws-xxxxxxxx", ...])

Returns: Empty response with HTTP 204 status code if successful

See: docs/tools/variables.md#assign-variable-set-to-workspaces for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
varset_idYes
workspace_idsYes

Implementation Reference

  • The handler function that implements the tool logic: assigns a variable set to specified workspaces by constructing a relationships payload and making a POST request to the Terraform Cloud API endpoint /varsets/{varset_id}/relationships/workspaces.
    async def assign_variable_set_to_workspaces(
        varset_id: str, workspace_ids: List[str]
    ) -> APIResponse:
        """Assign a variable set to one or more workspaces.
    
        Makes the variables in a variable set available to the specified workspaces.
        Variables from variable sets take precedence over workspace variables if
        the variable set has priority enabled.
    
        API endpoint: POST /varsets/{varset_id}/relationships/workspaces
    
        Args:
            varset_id: The ID of the variable set (format: "varset-xxxxxxxx")
            workspace_ids: List of workspace IDs (format: ["ws-xxxxxxxx", ...])
    
        Returns:
            Empty response with HTTP 204 status code if successful
    
        See:
            docs/tools/variables.md#assign-variable-set-to-workspaces for reference documentation
        """
        # Build relationships payload
        relationships_data = []
        for workspace_id in workspace_ids:
            relationships_data.append({"id": workspace_id, "type": "workspaces"})
    
        payload = {"data": relationships_data}
        endpoint = f"varsets/{varset_id}/relationships/workspaces"
        return await api_request(endpoint, method="POST", data=payload)
  • Registers the assign_variable_set_to_workspaces tool with the MCP server using mcp.tool decorator, configured with write permissions (write_tool_config).
    mcp.tool(**write_tool_config)(variables.assign_variable_set_to_workspaces)
Behavior3/5

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

Annotations provide readOnlyHint=false (indicating mutation), and the description adds useful behavioral context: it explains precedence rules ('Variables from variable sets take precedence over workspace variables if the variable set has priority enabled') and mentions the API endpoint and HTTP 204 response. However, it doesn't cover other behavioral aspects like error conditions, permissions needed, or rate limits.

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

Conciseness5/5

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

The description is efficiently structured with a clear purpose statement upfront, followed by key behavioral details, parameter explanations, return information, and a reference link. Every sentence adds value without redundancy.

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 mutation tool with no output schema and minimal annotations, the description provides good context: purpose, behavior, parameters, and response. It could be more complete by mentioning error cases or prerequisites, but it covers the essentials well given the complexity.

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 compensates well by explaining both parameters: 'varset_id' as 'The ID of the variable set' with format example, and 'workspace_ids' as 'List of workspace IDs' with format example. This adds significant meaning beyond the bare schema.

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 ('Assign a variable set to one or more workspaces') and resource ('variable set', 'workspaces'), distinguishing it from sibling tools like 'assign_variable_set_to_projects' and 'unassign_variable_set_from_workspaces' by specifying the target resource type.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (to make variables available to workspaces with precedence rules) but doesn't explicitly mention when not to use it or name alternatives like 'assign_variable_set_to_projects' for different targets.

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