list_workspace_variables
Retrieve all Terraform and environment variables configured for a specific workspace to manage infrastructure configuration and settings.
Instructions
List all variables for a workspace.
Retrieves all variables (both Terraform and environment) configured for a specific workspace.
API endpoint: GET /workspaces/{workspace_id}/vars
Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx")
Returns: List of workspace variables with their configuration and values
See: docs/tools/variables.md#list-workspace-variables for reference documentation
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"workspace_id": "<workspace_id>"
},
"name": "list_workspace_variables"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_id | Yes |
Implementation Reference
- The main handler function for the 'list_workspace_variables' tool. It makes a GET request to the Terraform Cloud API endpoint /workspaces/{workspace_id}/vars to retrieve all variables in the specified workspace.
@handle_api_errors async def list_workspace_variables(workspace_id: str) -> APIResponse: """List all variables for a workspace. Retrieves all variables (both Terraform and environment) configured for a specific workspace. API endpoint: GET /workspaces/{workspace_id}/vars Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx") Returns: List of workspace variables with their configuration and values See: docs/tools/variables.md#list-workspace-variables for reference documentation """ endpoint = f"workspaces/{workspace_id}/vars" return await api_request(endpoint, method="GET") - terraform_cloud_mcp/server.py:125-125 (registration)Registration of the 'list_workspace_variables' tool in the MCP server using the mcp.tool() decorator.
mcp.tool()(variables.list_workspace_variables)