Package-level declarations
Types
Serves a day's agenda as JSON — the shape read_calendar returns, up to 100 events. droidmcp://calendar/today is listed so clients can attach it directly; any other day is droidmcp://calendar/{date} with a yyyy-MM-dd date. Needs READ_CALENDAR; without it the listing is empty and reads fail as not found. Hidden while read_calendar is gated off.
Provider for the calendar tool module. Wires up ReadCalendarTool, SearchEventsTool, ListCalendarsTool, CreateEventTool, UpdateEventTool and DeleteEventTool, which read/write events via CalendarContract.
Inserts a new event into CalendarContract.Events via ContentResolver. Requires WRITE_CALENDAR (plus READ_CALENDAR for the default-calendar lookup). start/end are parsed strictly as yyyy-MM-dd HH:mm (device timezone; impossible dates and trailing text are rejected) and end must be after start. When calendar_id is omitted it falls back to the primary calendar, else the first visible calendar with at least contributor access (see CalendarSupport.findWritableCalendarId). Output: event_id (the inserted row id, may be null if the URI lacks a numeric segment), plus echoed title, start, and end.
Deletes the CalendarContract.Events row identified by event_id. Requires WRITE_CALENDAR (plus READ_CALENDAR for the lookup). For a recurring event the id names the whole series, so every occurrence is deleted, not a single instance.
Lists the device's calendars via ContentResolver on CalendarContract.Calendars, so a model can pass a calendar_id to create_event. Requires READ_CALENDAR. Output: calendars (list of {id, name, account_name, account_type, color, writable, visible, is_default}) and count. writable means at least contributor access; is_default marks the calendar create_event uses when calendar_id is omitted (CalendarSupport.findWritableCalendarId). color is #RRGGBB. Param writable_only (default false) drops read-only calendars such as holidays and birthdays.
Reads calendar events in a date range via ContentResolver on CalendarContract.Instances, so recurring events are expanded into their individual occurrences and multi-day events that began before start_date but are still running are included. An instance is returned when it overlaps the window [start_date 00:00, end_date + 1 day 00:00). (The provider drops a soft-deleted event's instance rows itself, so no DELETED filter is needed — Instances doesn't expose that column.) Requires READ_CALENDAR.
Searches calendar events whose TITLE or DESCRIPTION contains query (SQL LIKE substring; %, _ and \ in query match literally), via ContentResolver on CalendarContract.Events, newest first. Requires READ_CALENDAR. Output: events (list of {id, title, start, end, location, description, all_day} with times formatted yyyy-MM-dd HH:mm — device timezone for timed events, UTC for all-day events, which the provider stores at UTC-midnight boundaries), count, and the echoed query, capped at limit (1–100, default 10). Recurring events appear once (their base row), not per occurrence.
Updates an existing CalendarContract.Events row identified by event_id, writing only the fields the caller supplies (title, description, location, start, end, all_day). Requires WRITE_CALENDAR (plus READ_CALENDAR for the lookup).