Skip to content

Add delete_event functionality with series deletion option and tests#1

Open
iancanderson wants to merge 1 commit intoOmar-V2:mainfrom
iancanderson:delete-events
Open

Add delete_event functionality with series deletion option and tests#1
iancanderson wants to merge 1 commit intoOmar-V2:mainfrom
iancanderson:delete-events

Conversation

@iancanderson
Copy link
Copy Markdown

This pull request introduces the ability to delete either a single occurrence or all future occurrences of a recurring event in the calendar management system. It includes updates to the delete_event method, a new async function for deleting events, and corresponding tests.

@Omar-V2
Copy link
Copy Markdown
Owner

Omar-V2 commented Mar 10, 2025

Hey, thank you so much for your contribution, really appreciate it! I've left a couple comments below:

  • Could you also update the integration tests in tests/test_calendar_manage_integration.py to test the new delete event functionality?
  • Could you add pytest-asyncio to the dev dependencies? uv add --dev pytest-asyncio
  • I briefly tried out the delete event functionality and it didn't work entirely as intended (see this chat for reference)
  • I tried asking it to delete a specific event in the series and it deleted the wrong one, after I tried deleting a different event in the series and it thought it had deleted it but it actually didn't.
  • This may possibly be a bug in the original delete_event function that I wrote, if that's the case let me know and I can fix, but some new integration tests should help identify the issue.

tamm referenced this pull request in tamm/mcp-ical Nov 12, 2025
…tching

This PR addresses the issues identified in PR #1 by implementing a more robust
solution for deleting recurring event occurrences with proper timezone handling.

Key improvements:

1. **Timezone-aware occurrence matching**
   - New find_event_occurrence() method with exact datetime matching
   - Automatic UTC fallback for naive datetimes (common in LLM-constructed dates)
   - Uses ±1 minute search window followed by exact datetime equality check
   - Prevents wrong occurrence deletion issues from PR #1

2. **Flexible deletion modes**
   - Delete single occurrence: occurrence_date only (default)
   - Delete from occurrence forward: occurrence_date + delete_entire_series=True
   - Delete entire series: delete_entire_series=True only
   - Delete non-recurring event: event_id only (unchanged behavior)

3. **Comprehensive test coverage**
   - test_delete_non_recurring_event: Basic deletion case
   - test_delete_recurring_event_entire_series: Delete all occurrences
   - test_delete_recurring_event_single_occurrence: Delete one specific occurrence
   - test_delete_recurring_event_from_occurrence_forward: Delete from occurrence onward
   - All tests verify expected behavior with occurrence counts

4. **Enhanced MCP tool documentation**
   - CRITICAL warnings about using exact datetimes from list_events
   - Clear usage examples for all deletion scenarios
   - Explanation of timezone importance to prevent user errors

Fixes the two main issues from PR #1:
- Wrong occurrence being deleted (timezone matching problem)
- Events appearing deleted but not actually being removed (matching failure)

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

Co-Authored-By: Claude <noreply@anthropic.com>
bradwindy pushed a commit to bradwindy/mcp-ical that referenced this pull request Dec 16, 2025
…on-with-timezone-handling

Add robust recurring event deletion with timezone-aware occurrence matching
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.

2 participants