diff --git a/src/apple_eventkit_mcp/eventkit_store.py b/src/apple_eventkit_mcp/eventkit_store.py index 89510a9..5b3985a 100644 --- a/src/apple_eventkit_mcp/eventkit_store.py +++ b/src/apple_eventkit_mcp/eventkit_store.py @@ -596,11 +596,21 @@ def _components_to_iso(self, components: NSDateComponents) -> Optional[str]: return None def _calendar_to_dict(self, calendar: EventKit.EKCalendar) -> dict: - """Convert EKCalendar to dictionary.""" + """Convert EKCalendar to dictionary. + + Includes the calendar's source (account) so callers can + disambiguate same-named calendars across accounts and route + by account (e.g. "all iCloud calendars" vs "all Google"). + """ + source = calendar.source() return { "id": calendar.calendarIdentifier(), "title": calendar.title(), "type": str(calendar.type()), + "source": { + "title": source.title() if source else None, + "type": str(source.sourceType()) if source else None, + }, "allows_modifications": calendar.allowsContentModifications(), } @@ -609,6 +619,8 @@ def _event_to_dict(self, event: EventKit.EKEvent) -> dict: notes = event.notes() or "" clean_notes, tags = decode_tags(notes) + cal = event.calendar() + cal_source = cal.source() if cal else None return { "id": event.calendarItemIdentifier(), "external_id": event.calendarItemExternalIdentifier(), @@ -618,7 +630,8 @@ def _event_to_dict(self, event: EventKit.EKEvent) -> dict: "location": event.location(), "notes": clean_notes, "tags": tags, - "calendar": event.calendar().title() if event.calendar() else None, + "calendar": cal.title() if cal else None, + "calendar_source": cal_source.title() if cal_source else None, "is_all_day": event.isAllDay(), "url": str(event.URL()) if event.URL() else None, "has_recurrence": event.hasRecurrenceRules(),