Skip to main content
Glama
wpfleger96

PagerDuty MCP Server

by wpfleger96

get_schedules

Fetch PagerDuty schedules by IDs, filters, or search queries. Retrieve schedule details, overrides, and time-bound data for effective team and incident management.

Instructions

Get PagerDuty schedules by filters or get details for a specific schedule ID.

Args: schedule_id (str): The schedule ID to retrieve details for (optional, cannot be used with query or limit). query (str): Filter schedules whose names contain the search query (optional). Not used if schedule_id is provided. limit (int): Limit the number of results returned (optional). Not used if schedule_id is provided. since (str): Start time for overrides/final schedule details (ISO8601, optional). Only used if schedule_id is provided. Defaults to 2 weeks before 'until' if 'until' is given. until (str): End time for overrides/final schedule details (ISO8601, optional). Only used if schedule_id is provided. Defaults to 2 weeks after 'since' if 'since' is given.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryNo
schedule_idNo
sinceNo
untilNo

Implementation Reference

  • Handler function for the 'get_schedules' tool. Dispatches to list_schedules or show_schedule helpers based on whether a specific schedule_id is provided. Includes input validation and documentation.
    @mcp.tool()
    def get_schedules(
        *,
        schedule_id: Optional[str] = None,
        query: Optional[str] = None,
        limit: Optional[int] = None,
        since: Optional[str] = None,
        until: Optional[str] = None,
    ) -> Dict[str, Any]:
        """Get PagerDuty schedules by filters or get details for a specific schedule ID.
    
        Args:
            schedule_id (str): The schedule ID to retrieve details for (optional, cannot be used with query or limit).
            query (str): Filter schedules whose names contain the search query (optional). Not used if `schedule_id` is provided.
            limit (int): Limit the number of results returned (optional). Not used if `schedule_id` is provided.
            since (str): Start time for overrides/final schedule details (ISO8601, optional). Only used if `schedule_id` is provided. Defaults to 2 weeks before 'until' if 'until' is given.
            until (str): End time for overrides/final schedule details (ISO8601, optional). Only used if `schedule_id` is provided. Defaults to 2 weeks after 'since' if 'since' is given.
        """
        if schedule_id is not None:
            if query is not None or limit is not None:
                raise ValueError(
                    "When `schedule_id` is provided, other filters (query, limit) cannot be used. See `docs://tools` for more information."
                )
            return schedules.show_schedule(
                schedule_id=schedule_id, since=since, until=until
            )
        else:
            return schedules.list_schedules(query=query, limit=limit)
  • Helper function called by get_schedules to list schedules matching the query and limit parameters using the PagerDuty API.
    def list_schedules(
        *, query: Optional[str] = None, limit: Optional[int] = None
    ) -> Dict[str, Any]:
        """List existing PagerDuty schedules. Returns all schedules that match the given search criteria. Exposed in `get_schedules`.
    
        Args:
            query (str): Filter schedules 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 schedules with their configuration and team assignments.
    
        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(SCHEDULES_URL, params=params)
            parsed_response = [parse_schedule(result=result) for result in response]
            return utils.api_response_handler(
                results=parsed_response, resource_name="schedules"
            )
        except Exception as e:
            utils.handle_api_error(e)
  • Helper function called by get_schedules to retrieve detailed information for a specific schedule, including overrides over a time range, using the PagerDuty API.
    def show_schedule(
        *, schedule_id: str, since: Optional[str] = None, until: Optional[str] = None
    ) -> Dict[str, Any]:
        """Get detailed information about a given schedule, including its configuration and current state. Exposed in `get_schedules`.
    
        Args:
            schedule_id (str): The ID of the schedule to get
            since (str): Start of date range in ISO8601 format (optional). Default is 1 month ago
            until (str): End of date range in ISO8601 format (optional). Default is now
    
        Returns:
            See the "Standard Response Format" section in `tools.md` for the complete standard response structure.
            The response will contain a single schedule with detailed configuration and team information.
    
        Raises:
            See the "Error Handling" section in `tools.md` for common error scenarios.
        """
    
        if not schedule_id:
            raise ValueError("schedule_id cannot be empty")
    
        pd_client = create_client()
    
        params = {}
        if since:
            utils.validate_iso8601_timestamp(since, "since")
            params["since"] = since
        if until:
            utils.validate_iso8601_timestamp(until, "until")
            params["until"] = until
    
        try:
            response = pd_client.jget(f"{SCHEDULES_URL}/{schedule_id}", params=params)
            try:
                schedule_data = response["schedule"]
            except KeyError:
                raise RuntimeError(
                    f"Failed to fetch schedule {schedule_id}: Response missing 'schedule' field"
                )
    
            return utils.api_response_handler(
                results=parse_schedule(result=schedule_data), resource_name="schedule"
            )
        except Exception as e:
            utils.handle_api_error(e)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses some behavioral traits like the dual functionality modes and default time ranges ('Defaults to 2 weeks before/after'), but lacks information on permissions, rate limits, pagination, error handling, or response format. For a tool with 5 parameters and no annotations, this leaves significant gaps in understanding its behavior.

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 followed by detailed parameter explanations. Every sentence earns its place by providing essential information. It could be slightly more concise by combining some conditional statements, but overall it's efficient and front-loaded with the core 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 5 parameters, 0% schema coverage, no annotations, and no output schema, the description does an excellent job with parameter semantics but lacks completeness regarding behavioral aspects. It doesn't describe what the tool returns (schedule objects, error responses), authentication requirements, or system constraints. For a moderately complex tool with rich parameter interactions, more context would be helpful.

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 providing detailed semantics for all 5 parameters. It explains each parameter's purpose, optionality, interdependencies (e.g., schedule_id vs. query/limit), conditional usage (since/until only with schedule_id), and format requirements (ISO8601 for dates). This adds substantial 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 tool's purpose with specific verbs ('Get PagerDuty schedules by filters' and 'get details for a specific schedule ID'), identifies the resource (PagerDuty schedules), and distinguishes it from siblings by focusing on schedules rather than users, incidents, or other resources. The dual functionality (list vs. detail) is explicitly articulated.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use parameters, including conditional logic (e.g., 'cannot be used with query or limit', 'Not used if schedule_id is provided', 'Only used if schedule_id is provided'). It clearly delineates between two usage modes: filtering multiple schedules vs. retrieving details for a single schedule, helping the agent choose appropriate parameters.

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