Skip to content

Conversation

@dmcclure-pdt
Copy link
Collaborator

Description

This PR adds schedule creation and update support to the PagerDuty MCP server, enabling users to create and manage complex on-call schedules directly through the MCP interface. The implementation follows the PagerDuty API specification for schedule operations, allowing for configuration of:

  • Basic schedule properties (name, description, timezone)
  • Schedule layers with rotation turn lengths
  • Multiple users in each rotation layer
  • Time-based restrictions for schedule layers (daily and weekly)
  • Starting dates and rotation virtual start settings
  • Schedule updates with special handling for layer management

Issue number: #XXX (replace with actual issue number if applicable)

Type of change

  • New feature (non-breaking change which adds functionality)
  • Fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation only

Checklist

  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented
  • Changes generate no new warnings
  • PR title follows conventional commit semantics

Additional Notes

Feature Overview

  • Added create_schedule tool for schedule creation operations
  • Added update_schedule tool for schedule updates
  • Implemented ScheduleCreateRequest, ScheduleUpdateRequest, and related models
  • Added helper functions for working with schedule layers
  • Included proper validation for schedule parameters and restrictions
  • Updated tool registration in __init__.py
  • Added comprehensive tests for the new functionality

Testing

  • Tested with various complex schedule scenarios:
    • 24x7x365 rotations
    • Weekly rotations with multiple users
    • Follow-the-Sun global support schedules
    • Business hours vs after-hours schedules
    • Holiday and PTO coverage with overrides
    • Schedules with daily and weekly restrictions
Test Prompts

The following test prompts were used to verify the functionality:

# Test Case 1: Create Schedule
using the pagerduty-mcp, Create a new on-call schedule with the following details:
  - Name: "Engineering Team Rotation"
  - Description: "Weekly rotation for engineering team"
  - Time Zone: "America/New_York"
  - Layer Name: "Primary On-Call"
  - Rotation start date: January 1, 2026, at 9:00 AM ET
  - Rotation length: 7 days (604800 seconds)
  - Add four team members to the schedule
  - Add a daily restriction that only runs from 9 AM to 5 PM (8 hours)
# Test Case 2: Update Schedule Properties
using the pagerduty-mcp, update the schedule with these changes:
  - Rename to "Engineering Team Primary Rotation"
  - Update description to "Weekly rotation schedule for primary engineering contacts"
  - Add a new user to the rotation after user 2
  - Change the rotation length to 3 days (259200 seconds)
  - Add a weekend restriction (no on-call assignments on weekends)
  - Keep the 9 AM to 5 PM weekday restriction
# Test Case 3: Basic Property Update
using the pagerduty-mcp, Update the schedule with these changes:
  - Rename to "Engineering Team Primary Rotation (Updated)"
  - Update description to "Weekly rotation for engineering team with weekend coverage"
  - Keep all existing layers intact

Schedule Update Patterns

The implementation includes special handling for schedule updates, which have unique behavior in the PagerDuty API:

  1. Basic property updates (name, description, timezone) can be done without affecting schedule layers by using an empty schedule_layers=[] parameter
  2. Layer updates require providing all layers that should be present in the final schedule
  3. Helper functions are available to analyze differences between existing and desired layers

dmcclure-pdt and others added 17 commits July 29, 2025 09:30
- Add Golden Template for extending PagerDuty MCP Server
- Add detailed requirements for schedule creation feature

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Provides step-by-step instructions for implementing the schedule creation feature, including:
- Model definitions
- Tool implementation
- Testing strategy
- Git workflow guidance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…le restrictions

The PagerDuty API requires start_day_of_week values for all restriction types,
even for daily_restriction where it's not logically needed. This change:

1. Updates ScheduleLayerRestriction model to require start_day_of_week with default=1
2. Improves create_schedule to ensure this field is always provided
3. Adds documentation explaining this API requirement

This fixes the issue where schedule creation with restrictions would fail with
'Start day of week must be in 1, 2, 3, 4, 5, 6, 7...' error.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Added create_schedule function to the tools table in README.md to document its availability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add update_schedule function to update existing schedules
- Add ScheduleUpdateRequest model for validation
- Add helper function get_layer_differences for comparing layers
- Update README.md with new tools
- Add proper validation for schedule parameters and restrictions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@kyub
Copy link

kyub commented Oct 21, 2025

👍 for this. This functionality is a requirement for us to make use of the PagerDuty MCP.

@kyub
Copy link

kyub commented Oct 29, 2025

@imjaroiswebdev Can this PR be merged please?

@imjaroiswebdev
Copy link
Collaborator

Hi @kyub, thank you for sharing how interested you are in leveraging this feature. This PR will get merged hopefully before the end of this same week.

@kyub
Copy link

kyub commented Oct 29, 2025

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants