Skip to content

Add exclude_calendars parameter to calendar_list_events and calendar_search_events - #5

Open
fmasi wants to merge 1 commit into
harriscarl:mainfrom
fmasi:feat/exclude-calendars
Open

Add exclude_calendars parameter to calendar_list_events and calendar_search_events#5
fmasi wants to merge 1 commit into
harriscarl:mainfrom
fmasi:feat/exclude-calendars

Conversation

@fmasi

@fmasi fmasi commented May 19, 2026

Copy link
Copy Markdown

Summary

Adds an optional exclude_calendars: list[str] | None parameter to calendar_list_events and calendar_search_events (and the underlying EventKitStore.get_events / search_events). When provided, calendars whose title() matches any entry (case-insensitive, exact match) are dropped from the EventKit fetch.

Closes #4.

Design notes

  • Server-side, not post-fetch. The exclusion is applied to the calendars list passed into predicateForEventsWithStartDate_endDate_calendars_, so excluded calendars are never fetched in the first place — no wasted serialization.
  • Mutually exclusive with calendar_name. When the caller specifies a single calendar via calendar_name, exclude_calendars is ignored (a single-include and an exclude list together would be incoherent). Documented in the docstring.
  • Backwards-compatible. Default is None, so existing callers see identical behavior.
  • Match-only-exact for v1. Per the issue's "case-insensitive exact match is fine for a first cut", no glob/wildcard support in this PR. Happy to add *@domain.com style globs as a follow-up if you want it.

Diff scope

Two files, 28 insertions / 3 deletions:

  • src/apple_eventkit_mcp/eventkit_store.py — add param to get_events and search_events; apply filter when calendar_name is unset
  • src/apple_eventkit_mcp/calendar_tools.py — surface the param on the two MCP tools, pass through to the store

Test plan

  • Existing callers (no exclude_calendars arg) behave identically
  • calendar_list_events(start, end, exclude_calendars=["Holidays in Canada"]) returns events from all calendars except that one
  • Mixed case works: exclude_calendars=["HOLIDAYS in canada"] still excludes
  • calendar_list_events(start, end, calendar_name="Wellbeing", exclude_calendars=["Wellbeing"]) returns Wellbeing events (single-include wins)
  • calendar_search_events(query="x", exclude_calendars=[...]) filters search scope the same way

No existing test suite to extend; smoke-tested locally against my real calendar.

🤖 Generated with Claude Code

Optional list[str]; calendars whose title matches any entry
(case-insensitive exact match) are dropped before fetching.
Ignored when calendar_name is set (single-include wins).
Default None preserves existing behavior.

Closes harriscarl#4

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Add exclude_calendars parameter to calendar_list_events and calendar_search_events

1 participant