An Osaurus plugin for interacting with macOS Calendar.app via EventKit (native framework) and AppleScript (for UI control).
This plugin provides fast and reliable calendar access using Apple's native EventKit framework for fetching, searching, and creating events. It uses AppleScript only for opening specific events in the Calendar application.
Permissions are required. The application using this plugin (e.g., Osaurus) requires two distinct permissions:
-
Calendars Access (Full Access):
- Why: Required for
get_events,search_events, andcreate_eventto read/write the database directly (fast). - How: System Settings > Privacy & Security > Calendars > Toggle ON for your app.
- Host App Requirement:
Info.plistmust includeNSCalendarsFullAccessUsageDescription(macOS 14+) orNSCalendarsUsageDescription.
- Why: Required for
-
Automation (Apple Events):
- Why: Required only for
open_eventto control the Calendar app UI. - How: System Settings > Privacy & Security > Automation > Expand your app > Toggle ON for "Calendar".
- Host App Requirement:
Info.plistmust includeNSAppleEventsUsageDescription.
- Why: Required only for
Get calendar events in a specified date range using EventKit (fast).
Parameters:
limit(optional): Maximum number of events to return (default: 10)fromDate(optional): Start date in ISO format (default: today)toDate(optional): End date in ISO format (default: 7 days from now)
Example:
{
"limit": 5,
"fromDate": "2024-01-15",
"toDate": "2024-01-22"
}Search for calendar events that match the search text (case-insensitive title match).
Parameters:
searchText(required): Text to search for in event titleslimit(optional): Maximum number of events to return (default: 10)fromDate(optional): Start date in ISO format (default: today)toDate(optional): End date in ISO format (default: 30 days from now)
Example:
{
"searchText": "meeting",
"limit": 10
}Create a new calendar event.
Parameters:
title(required): Title of the eventstartDate(required): Start date/time in ISO format (e.g.,2024-01-15T09:00:00Z)endDate(required): End date/time in ISO format (e.g.,2024-01-15T10:00:00Z)location(optional): Location of the eventnotes(optional): Notes/description for the eventisAllDay(optional): Whether this is an all-day event (default: false)calendarName(optional): Name of the calendar to add the event to (default: first available calendar)
Example:
{
"title": "Team Standup",
"startDate": "2024-01-15T09:00:00Z",
"endDate": "2024-01-15T09:30:00Z",
"location": "Conference Room A",
"notes": "Daily sync meeting"
}Open a specific calendar event in the Calendar app.
Parameters:
eventId(required): ID of the event to open (obtained fromget_eventsorsearch_events)
Example:
{
"eventId": "ABC123-DEF456-GHI789"
}-
Build:
swift build -c release cp .build/release/libosaurus-calendar.dylib ./libosaurus-calendar.dylib
-
Install locally:
osaurus tools install .
codesign --force --options runtime --timestamp \
--sign "Developer ID Application: Your Name (TEAMID)" \
.build/release/libosaurus-calendar.dylibosaurus tools package osaurus.calendar 0.1.0This creates osaurus.calendar-0.1.0.zip for distribution.
All event-related tools return events in this format:
{
"id": "unique-event-id",
"title": "Event Title",
"location": "Event Location",
"notes": "Event notes/description",
"startDate": "2024-01-15 09:00:00",
"endDate": "2024-01-15 10:00:00",
"calendarName": "Work",
"isAllDay": false,
"url": "https://example.com"
}{
"success": true,
"message": "Event \"Team Standup\" created successfully.",
"eventId": "ABC123-DEF456-GHI789"
}