Skip to main content
Glama
wpfleger96

PagerDuty MCP Server

by wpfleger96

get_teams

Retrieve PagerDuty teams by ID or filter results using name query and result limit, enabling efficient team management and data access.

Instructions

Get PagerDuty teams by filters or get details for a specific team ID.

Args: team_id (str): The team ID to retrieve (optional, cannot be used with any other filters). query (str): Filter teams whose names contain the search query (optional). Not used if team_id is provided. limit (int): Limit the number of results returned (optional). Not used if team_id is provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryNo
team_idNo

Implementation Reference

  • Handler function for the 'get_teams' MCP tool. Decorated with @mcp.tool() for registration. Dispatches to teams.show_team() or teams.list_teams() based on whether team_id is provided.
    @mcp.tool()
    def get_teams(
        *,
        team_id: Optional[str] = None,
        query: Optional[str] = None,
        limit: Optional[int] = None,
    ) -> Dict[str, Any]:
        """Get PagerDuty teams by filters or get details for a specific team ID.
    
        Args:
            team_id (str): The team ID to retrieve (optional, cannot be used with any other filters).
            query (str): Filter teams whose names contain the search query (optional). Not used if `team_id` is provided.
            limit (int): Limit the number of results returned (optional). Not used if `team_id` is provided.
        """
        if team_id is not None:
            disallowed_filters_present = query is not None or limit is not None
            if disallowed_filters_present:
                raise ValueError(
                    "When `team_id` is provided, other filters (like query, limit) cannot be used. See `docs://tools` for more information."
                )
    
            return teams.show_team(team_id=team_id)
    
        return teams.list_teams(query=query, limit=limit)
  • Helper function list_teams() called by the handler to list teams matching query and limit. Makes API call to /teams, parses responses, and formats output.
    def list_teams(
        *, query: Optional[str] = None, limit: Optional[int] = None
    ) -> Dict[str, Any]:
        """List teams in your PagerDuty account. Exposed as MCP server tool.
    
        Args:
            query (str): Filter teams whose names contain the search query (optional)
            limit (int): Limit the number of results returned (optional)
    
        Returns:
            See the "Standard Response Format" section in `tools.md` for the complete standard response structure.
            The response will contain a list of teams with their configuration and member information.
    
        Raises:
            See the "Error Handling" section in `tools.md` for common error scenarios.
        """
    
        pd_client = create_client()
    
        params = {}
        if query:
            params["query"] = query
        if limit:
            params["limit"] = limit
    
        try:
            response = pd_client.list_all(TEAMS_URL, params=params)
            parsed_response = [parse_team(result=team) for team in response]
            return utils.api_response_handler(
                results=parsed_response, resource_name="teams"
            )
        except Exception as e:
            utils.handle_api_error(e)
  • Helper function show_team() called by the handler to retrieve details for a specific team_id. Makes API call to /teams/{team_id}, parses response, and formats output.
    def show_team(*, team_id: str) -> Dict[str, Any]:
        """Get detailed information about a given team. Exposed as MCP server tool.
    
        Args:
            team_id (str): The ID of the team to get
    
        Returns:
            See the "Standard Response Format" section in `tools.md` for the complete standard response structure.
            The response will contain a single team with detailed configuration and member information.
    
        Raises:
            See the "Error Handling" section in `tools.md` for common error scenarios.
        """
    
        if team_id is None:
            raise ValueError("team_id must be specified")
    
        pd_client = create_client()
    
        try:
            response = pd_client.jget(f"{TEAMS_URL}/{team_id}")
            try:
                team_data = response["team"]
            except KeyError:
                raise RuntimeError(
                    f"Failed to fetch team {team_id}: Response missing 'team' field"
                )
    
            return utils.api_response_handler(
                results=parse_team(result=team_data), resource_name="team"
            )
        except Exception as e:
            utils.handle_api_error(e)
  • The @mcp.tool() decorator registers the get_teams function as an MCP tool.
    @mcp.tool()
    def get_teams(
        *,
        team_id: Optional[str] = None,
        query: Optional[str] = None,
        limit: Optional[int] = None,
    ) -> Dict[str, Any]:
        """Get PagerDuty teams by filters or get details for a specific team ID.
    
        Args:
            team_id (str): The team ID to retrieve (optional, cannot be used with any other filters).
            query (str): Filter teams whose names contain the search query (optional). Not used if `team_id` is provided.
            limit (int): Limit the number of results returned (optional). Not used if `team_id` is provided.
        """
        if team_id is not None:
            disallowed_filters_present = query is not None or limit is not None
            if disallowed_filters_present:
                raise ValueError(
                    "When `team_id` is provided, other filters (like query, limit) cannot be used. See `docs://tools` for more information."
                )
    
            return teams.show_team(team_id=team_id)
    
        return teams.list_teams(query=query, limit=limit)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool can retrieve teams by filters or specific ID, but lacks critical behavioral details: whether this is a read-only operation, any authentication requirements, rate limits, pagination behavior, or what happens when no results match. For a tool with 3 parameters and no annotation coverage, this is insufficient.

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: a clear purpose statement followed by a bullet-point Args section. Every sentence adds value—no redundancy or fluff. It's appropriately sized for a tool with 3 parameters and straightforward functionality.

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 no annotations, 0% schema coverage, and no output schema, the description does well on parameters but lacks behavioral context. It's complete enough for basic usage but misses details on authentication, error handling, or response format. For a read operation with sibling tools, this is minimally adequate but has clear gaps.

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 3 parameters: team_id retrieves specific details, query filters by name, limit controls result count. It clarifies parameter interactions (mutual exclusivity, conditional usage) and optional nature, 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.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get PagerDuty teams by filters or get details for a specific team ID.' It specifies the verb ('Get') and resource ('PagerDuty teams'), but doesn't explicitly differentiate from sibling tools like 'get_users' or 'get_services' beyond the resource type.

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 on when to use different parameters: team_id for specific details, query/limit for filtered lists, and notes mutual exclusivity ('cannot be used with any other filters'). However, it doesn't specify when to use this tool versus sibling tools like 'get_users' or 'get_services' for related data.

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

Related 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/wpfleger96/pagerduty-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server