Skip to main content
Glama
severity1

terraform-cloud-mcp

list_organizations

Retrieve a paginated list of Terraform Cloud organizations with search filters for name or email to manage access and resources.

Instructions

List organizations with filtering options

Retrieves a paginated list of organizations the current user has access to, with options to search by name or email address.

API endpoint: GET /organizations

Args: page_number: Page number to fetch (default: 1) page_size: Number of results per page (default: 20) q: Search query to filter by name and email query_email: Search query to filter by email only query_name: Search query to filter by name only

Returns: List of organizations with metadata and pagination information

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_numberNo
page_sizeNo
qNo
query_emailNo
query_nameNo

Implementation Reference

  • The main handler function that executes the list_organizations tool. It creates a request model, builds query parameters, and calls the Terraform Cloud API GET /organizations endpoint.
    @handle_api_errors
    async def list_organizations(
        page_number: int = 1,
        page_size: int = 20,
        q: Optional[str] = None,
        query_email: Optional[str] = None,
        query_name: Optional[str] = None,
    ) -> APIResponse:
        """List organizations with filtering options
    
        Retrieves a paginated list of organizations the current user has access to,
        with options to search by name or email address.
    
        API endpoint: GET /organizations
    
        Args:
            page_number: Page number to fetch (default: 1)
            page_size: Number of results per page (default: 20)
            q: Search query to filter by name and email
            query_email: Search query to filter by email only
            query_name: Search query to filter by name only
    
        Returns:
            List of organizations with metadata and pagination information
    
        See:
            docs/tools/organization.md for reference documentation
        """
        request = OrganizationListRequest(
            page_number=page_number,
            page_size=page_size,
            q=q,
            query_email=query_email,
            query_name=query_name,
        )
    
        # Get all query parameters - now automatically handles query_email and query_name
        params = query_params(request)
    
        return await api_request("organizations", params=params)
  • Pydantic model defining the input schema/validation for the list_organizations tool parameters: page_number, page_size, q, query_email, query_name.
    class OrganizationListRequest(APIRequest):
        """Request parameters for listing organizations.
    
        These parameters map to the query parameters in the organizations API.
        The endpoint returns a paginated list of organizations that the authenticated
        user has access to, along with their details.
    
        Reference: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/organizations#list-organizations
    
        See:
            docs/models/organization.md for reference
        """
    
        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"
        )
        q: Optional[str] = Field(
            None, description="Search query for name and email", max_length=100
        )
        query_email: Optional[str] = Field(
            None, description="Search query for email", max_length=100
        )
        query_name: Optional[str] = Field(
            None, description="Search query for name", max_length=100
        )
  • Registration of the list_organizations tool using FastMCP's mcp.tool() decorator.
    mcp.tool()(organizations.list_organizations)
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 discloses key behavioral traits: pagination behavior, search/filtering capabilities, and that it returns metadata with pagination info. However, it doesn't mention rate limits, authentication requirements, error conditions, or whether results are sorted. The description adds useful context but leaves gaps in behavioral understanding.

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 clear sections (purpose, parameters, returns, reference). Every sentence adds value, though the 'See:' reference could be integrated more smoothly. It's appropriately sized for a tool with 5 parameters and no annotations.

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?

Given the tool's moderate complexity (5 parameters, no output schema, no annotations), the description provides good coverage. It explains what the tool does, all parameters, and the return format. The main gap is lack of output schema details, but the description compensates by describing the return structure. For a list/read tool, this is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/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 explaining all 5 parameters in detail. It clarifies that 'q' searches both name and email, while 'query_email' and 'query_name' are specific filters. It also explains default values and the pagination parameters' purpose, adding significant value 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 ('List organizations'), resource ('organizations'), and scope ('the current user has access to'). It distinguishes this tool from siblings like 'get_organization_details' (which gets a single organization) and 'create_organization' (which creates rather than lists).

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

Usage Guidelines3/5

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

The description implies usage for retrieving multiple organizations with filtering, but doesn't explicitly state when to use this versus alternatives like 'get_organization_details' for single organizations or 'list_projects' for different resources. It mentions the API endpoint but doesn't provide contextual guidance about prerequisites or constraints.

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