Skip to main content
Glama
severity1

terraform-cloud-mcp

list_runs_in_organization

Retrieve and filter run history across all workspaces in a Terraform Cloud organization for auditing, monitoring deployments, and tracking specific runs by commit or author.

Instructions

List runs across all workspaces in an organization

Retrieves run history across all workspaces in an organization with powerful filtering. Useful for organization-wide auditing, monitoring deployments across teams, or finding specific runs by commit or author.

API endpoint: GET /organizations/{organization}/runs

Args: organization: The organization name page_number: Page number to fetch (default: 1) page_size: Number of results per page (default: 20) filter_operation: Filter by operation type filter_status: Filter by status filter_source: Filter by source filter_status_group: Filter by status group filter_timeframe: Filter by timeframe filter_agent_pool_names: Filter by agent pool names filter_workspace_names: Filter by workspace names search_user: Search by VCS username search_commit: Search by commit SHA search_basic: Basic search across run attributes

Returns: List of runs across workspaces with metadata and pagination details

See: docs/tools/run.md for reference documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationYes
page_numberNo
page_sizeNo
filter_operationNo
filter_statusNo
filter_sourceNo
filter_status_groupNo
filter_timeframeNo
filter_agent_pool_namesNo
filter_workspace_namesNo
search_userNo
search_commitNo
search_basicNo

Implementation Reference

  • The main execution handler for the 'list_runs_in_organization' tool. It validates inputs using the Pydantic model, builds query parameters, and performs the API request to list runs across all workspaces in the specified organization.
    async def list_runs_in_organization(
        organization: str,
        page_number: int = 1,
        page_size: int = 20,
        filter_operation: Optional[str] = None,
        filter_status: Optional[str] = None,
        filter_source: Optional[str] = None,
        filter_status_group: Optional[str] = None,
        filter_timeframe: Optional[str] = None,
        filter_agent_pool_names: Optional[str] = None,
        filter_workspace_names: Optional[str] = None,
        search_user: Optional[str] = None,
        search_commit: Optional[str] = None,
        search_basic: Optional[str] = None,
    ) -> APIResponse:
        """List runs across all workspaces in an organization
    
        Retrieves run history across all workspaces in an organization with powerful filtering.
        Useful for organization-wide auditing, monitoring deployments across teams, or finding
        specific runs by commit or author.
    
        API endpoint: GET /organizations/{organization}/runs
    
        Args:
            organization: The organization name
            page_number: Page number to fetch (default: 1)
            page_size: Number of results per page (default: 20)
            filter_operation: Filter by operation type
            filter_status: Filter by status
            filter_source: Filter by source
            filter_status_group: Filter by status group
            filter_timeframe: Filter by timeframe
            filter_agent_pool_names: Filter by agent pool names
            filter_workspace_names: Filter by workspace names
            search_user: Search by VCS username
            search_commit: Search by commit SHA
            search_basic: Basic search across run attributes
    
        Returns:
            List of runs across workspaces with metadata and pagination details
    
        See:
            docs/tools/run.md for reference documentation
        """
        # Create request using Pydantic model for validation
        request = RunListInOrganizationRequest(
            organization=organization,
            page_number=page_number,
            page_size=page_size,
            filter_operation=filter_operation,
            filter_status=filter_status,
            filter_source=filter_source,
            filter_status_group=filter_status_group,
            filter_timeframe=filter_timeframe,
            filter_agent_pool_names=filter_agent_pool_names,
            filter_workspace_names=filter_workspace_names,
            search_user=search_user,
            search_commit=search_commit,
            search_basic=search_basic,
        )
    
        # Use the unified query params utility function
        params = query_params(request)
    
        # Make API request
        return await api_request(
            f"organizations/{organization}/runs", method="GET", params=params
        )
  • Pydantic model (RunListInOrganizationRequest) that defines and validates all input parameters for the list_runs_in_organization tool, including organization name, pagination, and various filtering options.
    class RunListInOrganizationRequest(APIRequest):
        """Request parameters for listing runs in an organization.
    
        These parameters map to the query parameters in the runs API.
        The endpoint returns a paginated list of runs across all workspaces in an organization,
        with options for filtering by workspace name, status, and other criteria.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#list-runs-in-an-organization
    
        See:
            docs/models/run.md for reference
        """
    
        organization: str = Field(
            ...,
            description="The organization name",
            min_length=3,
            pattern=r"^[a-z0-9][-a-z0-9_]*[a-z0-9]$",
        )
        page_number: Optional[int] = Field(1, ge=1, description="Page number to fetch")
        page_size: Optional[int] = Field(
            20, ge=1, le=100, description="Number of results per page"
        )
        filter_operation: Optional[str] = Field(
            None,
            description="Filter runs by operation type, comma-separated",
            max_length=100,
        )
        filter_status: Optional[str] = Field(
            None, description="Filter runs by status, comma-separated", max_length=100
        )
        filter_source: Optional[str] = Field(
            None, description="Filter runs by source, comma-separated", max_length=100
        )
        filter_status_group: Optional[str] = Field(
            None, description="Filter runs by status group", max_length=50
        )
        filter_timeframe: Optional[str] = Field(
            None, description="Filter runs by timeframe", max_length=50
        )
        filter_agent_pool_names: Optional[str] = Field(
            None,
            description="Filter runs by agent pool names, comma-separated",
            max_length=100,
        )
        filter_workspace_names: Optional[str] = Field(
            None,
            description="Filter runs by workspace names, comma-separated",
            max_length=250,
        )
        search_user: Optional[str] = Field(
            None, description="Search for runs by VCS username", max_length=100
        )
        search_commit: Optional[str] = Field(
            None, description="Search for runs by commit SHA", max_length=40
        )
        search_basic: Optional[str] = Field(
            None,
            description="Basic search across run ID, message, commit SHA, and username",
            max_length=100,
        )
  • The MCP tool registration decorator that exposes the list_runs_in_organization handler as an MCP tool.
    mcp.tool()(runs.list_runs_in_organization)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It mentions 'powerful filtering' and 'pagination details', which are useful behavioral traits. However, it lacks details on rate limits, authentication requirements, error handling, or whether this is a read-only operation (though 'List' implies reading). The API endpoint hint adds some technical context but not full behavioral disclosure.

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

Conciseness4/5

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

The description is well-structured with a clear purpose statement, usage context, API endpoint, parameter list, return info, and reference link. It's appropriately sized for a tool with 13 parameters, though the 'Args' section is somewhat verbose but necessary given the parameter count. Every section adds value.

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 the complexity (13 parameters, no output schema, no annotations), the description is moderately complete. It covers purpose, usage, parameters, and returns, but lacks details on output structure (beyond 'List of runs with metadata'), error cases, or authentication. For a tool with many filtering options, more guidance on parameter usage would be helpful.

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 an 'Args' section that lists all 13 parameters with brief explanations, adding significant meaning beyond the bare schema. However, it doesn't explain parameter formats (e.g., what values 'filter_operation' accepts) or interactions between filters, leaving some gaps.

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 verb 'List' and resource 'runs across all workspaces in an organization', specifying the scope as organization-wide. It distinguishes from the sibling tool 'list_runs_in_workspace' by emphasizing the broader organizational scope rather than workspace-specific runs.

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 for when to use this tool: 'organization-wide auditing, monitoring deployments across teams, or finding specific runs by commit or author.' It implies this is for cross-workspace analysis but does not explicitly state when NOT to use it or name alternatives like 'list_runs_in_workspace' as a direct comparison.

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