get_workspace_details
Retrieve detailed workspace information by ID or organization and workspace name. Useful for checking settings, configurations, and status in Terraform Cloud environments.
Instructions
Get details for a specific workspace, identified either by ID or by org name and workspace name.
Retrieves comprehensive information about a workspace including its configuration, VCS settings, execution mode, and other attributes. This is useful for checking workspace settings before operations or determining the current state of a workspace.
The workspace can be identified either by its ID directly, or by the combination of organization name and workspace name.
API endpoint:
GET /workspaces/{workspace_id} (when using workspace_id)
GET /organizations/{organization}/workspaces/{workspace_name} (when using org+name)
Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx") organization: The name of the organization (required if workspace_id not provided) workspace_name: The name of the workspace (required if workspace_id not provided)
Returns: Comprehensive workspace details including settings, configuration and status
See: docs/tools/workspace.md for reference documentation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organization | No | ||
| workspace_id | No | ||
| workspace_name | No |
Implementation Reference
- The main handler function that executes the tool's logic: validates inputs, constructs the appropriate Terraform Cloud API endpoint, and retrieves workspace details.@handle_api_errors async def get_workspace_details( workspace_id: str = "", organization: str = "", workspace_name: str = "" ) -> APIResponse: """Get details for a specific workspace, identified either by ID or by org name and workspace name. Retrieves comprehensive information about a workspace including its configuration, VCS settings, execution mode, and other attributes. This is useful for checking workspace settings before operations or determining the current state of a workspace. The workspace can be identified either by its ID directly, or by the combination of organization name and workspace name. API endpoint: - GET /workspaces/{workspace_id} (when using workspace_id) - GET /organizations/{organization}/workspaces/{workspace_name} (when using org+name) Args: workspace_id: The ID of the workspace (format: "ws-xxxxxxxx") organization: The name of the organization (required if workspace_id not provided) workspace_name: The name of the workspace (required if workspace_id not provided) Returns: Comprehensive workspace details including settings, configuration and status See: docs/tools/workspace.md for reference documentation """ # Ensure we have either workspace_id OR both organization and workspace_name if not workspace_id and not (organization and workspace_name): raise ValueError( "Either workspace_id OR both organization and workspace_name must be provided" ) # Determine API path based on provided parameters if workspace_id: path = f"workspaces/{workspace_id}" else: path = f"organizations/{organization}/workspaces/{workspace_name}" # Make API request return await api_request(path, method="GET")
- terraform_cloud_mcp/server.py:54-54 (registration)Registers the get_workspace_details handler as an MCP tool using the mcp.tool() decorator.mcp.tool()(workspaces.get_workspace_details)