Skip to main content
Glama
severity1

terraform-cloud-mcp

assign_variable_set_to_projects

Apply variable sets to Terraform Cloud projects to make variables available across all workspaces within those projects.

Instructions

Assign a variable set to one or more projects.

Makes the variables in a variable set available to all workspaces within the specified projects.

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

Args: varset_id: The ID of the variable set (format: "varset-xxxxxxxx") project_ids: List of project IDs (format: ["prj-xxxxxxxx", ...])

Returns: Empty response with HTTP 204 status code if successful

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
varset_idYes
project_idsYes

Implementation Reference

  • The handler function that implements the tool logic: assigns a variable set to projects by POSTing relationships to the Terraform Cloud API endpoint.
    @handle_api_errors
    async def assign_variable_set_to_projects(
        varset_id: str, project_ids: List[str]
    ) -> APIResponse:
        """Assign a variable set to one or more projects.
    
        Makes the variables in a variable set available to all workspaces within
        the specified projects.
    
        API endpoint: POST /varsets/{varset_id}/relationships/projects
    
        Args:
            varset_id: The ID of the variable set (format: "varset-xxxxxxxx")
            project_ids: List of project IDs (format: ["prj-xxxxxxxx", ...])
    
        Returns:
            Empty response with HTTP 204 status code if successful
    
        See:
            docs/tools/variables.md#assign-variable-set-to-projects for reference documentation
        """
        # Build relationships payload
        relationships_data = []
        for project_id in project_ids:
            relationships_data.append({"id": project_id, "type": "projects"})
    
        payload = {"data": relationships_data}
        endpoint = f"varsets/{varset_id}/relationships/projects"
        return await api_request(endpoint, method="POST", data=payload)
  • Registers the 'assign_variable_set_to_projects' tool in the MCP server with write permissions configuration.
    mcp.tool(**write_tool_config)(variables.assign_variable_set_to_projects)
Behavior3/5

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

Annotations indicate readOnlyHint=false (mutation operation), which the description confirms with 'Assign'. The description adds useful behavioral context about the API endpoint format and the empty 204 response, but doesn't mention authentication requirements, rate limits, or error conditions beyond success indication.

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 purpose statement, effect explanation, API endpoint reference, parameter details, return value, and documentation link. Every sentence serves a distinct purpose with zero redundant information.

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 2 parameters and no output schema, the description provides comprehensive information about what the tool does, parameter formats, and expected response. The main gap is lack of error handling information or prerequisites, but the documentation link partially compensates.

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 fully compensates by providing clear parameter explanations: varset_id format ('varset-xxxxxxxx') and project_ids format (array of 'prj-xxxxxxxx'). This adds significant value beyond the bare schema, though it doesn't explain where to obtain these IDs.

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 projects') and the resource involved ('variable set', 'projects'). It distinguishes from sibling tools like 'assign_variable_set_to_workspaces' by specifying the target resource type (projects vs workspaces).

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 ('Makes the variables in a variable set available to all workspaces within the specified projects'), but doesn't explicitly mention when NOT to use it or name specific alternatives like 'assign_variable_set_to_workspaces' for workspace-level assignments.

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