Skip to content

Add reminder update, delete, and list management tools - #271

Merged
mattt merged 15 commits into
mattt:mainfrom
bradhallett:reminders-edit-delete
Oct 13, 2026
Merged

mattt merged 15 commits into
mattt:mainfrom
bradhallett:reminders-edit-delete

Conversation

@bradhallett

@bradhallett bradhallett commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #140

What

  • reminders_update edits an existing reminder by identifier with the same properties as reminders_create plus a completed flag. Omitted properties are unchanged; null clears an optional property (notes, URL, start, due, alarms). An unmatched list name is an error rather than a silent default, mirroring contacts_update's partial-update semantics.
  • reminders_delete removes a reminder by identifier, with destructiveHint/idempotentHint annotations matching events_delete.
  • reminders_lists_create, reminders_lists_rename, and reminders_lists_delete manage lists; reminders_lists now returns an identifier for targeting, delete refuses subscribed or immutable lists, and an ambiguous list name (several lists share it) is an error pointing at the identifier instead of an arbitrary first match.
  • reminders_create gains url and start properties, and its alarms parameter accepts relative, absolute, and proximity configurations like events_create — bare minutes-before integers still work, so existing callers are unaffected.

EventKit accepts EKCalendarItem.location on reminders but the Reminders store does not persist it, so it is intentionally not exposed.

Hardening

  • reminders_update resolves and validates everything — target list included — before mutating anything: EventKit retains unsaved mutations in its shared store, so a validation error thrown after apply would otherwise be committed by the next successful save of anything.
  • Numbers arrive as integers or integral doubles depending on the client library; every integer parameter accepts both (converting with Int(exactly:) so a schema-legal but out-of-range value errors instead of trapping), and alarm minutes scale in Double for the same reason.
  • The update tool does not advertise priority's create-time default of none: omission means leave unchanged, and a default-applying client would otherwise wipe priorities it never meant to touch. Likewise the shared list description is split per tool — create documents its unmatched-name fallback to the default list, update states the name must match an existing list.

Testing

  • swift format lint --strict and xcodebuild -scheme iMCP build pass.
  • Exercised against the live Reminders store on macOS 27.2 via a script mirroring each tool's EventKit calls: created a reminder with URL, start date, and all three alarm kinds and confirmed every field round-trips; resolved it back via calendarItem(withIdentifier:); toggled isCompleted both ways (completion date set/cleared); deleted it; created, renamed, and deleted a list. 18/18 checks passed.

reminders_update edits an existing reminder by identifier with the same
properties as reminders_create plus completion state; omitted properties
are unchanged and null clears them. reminders_delete removes a reminder.
reminders_lists_create, reminders_lists_rename, and reminders_lists_delete
manage lists, which now expose an identifier. reminders_create also gains
URL and start-date properties, and its alarms parameter accepts relative,
absolute, and proximity alarms like events_create.

EventKit accepts EKCalendarItem.location on reminders but the store does
not persist it, so it is not exposed.

Fixes mattt#140
- Alarms accept bare integers again (minutes before due), so callers
  written against the original schema keep working; unparseable alarm
  configurations are now an error instead of being silently dropped
- Proximity alarms take a free-text location, geocoded with Maps, as an
  alternative to explicit coordinates
- Numeric alarm fields accept whole numbers for latitude, longitude,
  and radius alike
- Nullable properties (notes, url, start, due, alarms) accept null in
  their schemas, matching the documented clear-on-null behavior
- List lookup by name errors when several lists share the name instead
  of acting on an arbitrary match
- Alarm objects now require "type": without it, absolute and proximity
  configurations were schema-valid but routed as relative and rejected
  with an error about minutes the caller never sent
- A proximity alarm's radius falls back to the documented 200 m instead
  of EKStructuredLocation's zero-radius default, which never triggers
- reminders_update resolves and validates everything before mutating
  the reminder, and moves the list change after apply: EventKit keeps
  unsaved mutations in its shared store, so a failed call could
  otherwise be committed by the next successful save
- The "list" argument accepts a list identifier, so the ambiguous-name
  error's instruction is no longer a dead end for create and update
- An integral-double minutes value (30.0) is accepted like JSON Schema's
  integer does; an unknown alarm sound throws instead of silently
  arming a silent alarm
- reminders_update checks list modifiability before mutating anything:
  the reminder's list (or the move target) is known up front, and
  throwing after apply would leave unsaved mutations in the shared
  store for the next successful save to commit
- The bare alarm form accepts an integral double (30.0), like the
  object form already did; both convert with Int(exactly:) so a
  schema-legal but out-of-range value errors instead of trapping
- The update tool no longer advertises priority's create-time default
  of "none": omitting a property means leave unchanged, and a client
  honoring the advertised default would wipe priorities untouched
- OrderedDictionary.merging calls uniquingKeysWith as (existing,
  incoming); the closures passed (new, old), so the update tool's
  priority entry — added to drop create's default — was discarded and
  the default kept being advertised. Swap the argument order at all
  three call sites
- Alarm minutes convert to Double before scaling by 60: a
  schema-legal Int64 like 9_223_372_036_854_775_807 passed Int(exactly:)
  but trapped in minutes * 60, killing the process — and Int.min also
  trapped on the leading negation
- The shared list description is neutral; create documents its
  unmatched-name fallback to the default list and update documents
  that the name must match an existing list

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Input validation gaps and inaccurate open-world annotations should be corrected before approval.

4 open findings
What changed in this PR

Adds full reminder and reminder-list management, plus richer reminder properties and alarm types.

Changes:

  • Adds reminder update and deletion tools.
  • Adds reminder-list creation, rename, and deletion.
  • Adds URLs, start dates, and structured alarms.
File Description
README.md Documents expanded reminder capabilities.
App/​Services/​Reminders.swift Implements reminder/list management and richer alarms.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
Validate every supplied create/update property instead of treating
wrong-typed values as omitted: title, notes, url, start, due, priority
(including enum membership), completed, alarms, and list now throw
before anything is mutated. Explicit proximity-alarm coordinates are
checked against geographic ranges, negative radii are rejected (zero
stays the system-default request), and the schemas advertise the same
bounds. Create/update are marked openWorldHint because proximity
alarms can geocode through Maps.
due and start already normalize date-only values to local midnight, and
the alarm configurations advertise parity with events_create, whose
builder does the same — but the absolute branch rejected them. Accept
date-only datetimes as midnight on that same rule.
@bradhallett

Copy link
Copy Markdown
Contributor Author

Self-review follow-up in f4eb283: a date-only absolute alarm datetime is now treated as local midnight, the same rule due/start already follow and the one events_create's alarm builder uses — the body promises parity with events_create, but the absolute branch was rejecting date-only values instead.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
enum: EKReminderPriority.allCases.map { .string($0.stringValue) }
"title": .string(description: "New title for the reminder list"),
],
required: ["title"],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b560ffd: both reminders_lists_rename and reminders_lists_delete advertise .allOf([object, .anyOf([required identifier, required name])]), so clients see that one selector is mandatory — matching what the handler already enforced.

Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
bradhallett and others added 4 commits October 13, 2026 07:34
A present-but-malformed list identifier fell through to the name
fallback, so {identifier: 123, name: \"Work\"} deleted the named list
instead of rejecting the preferred selector; both selectors now reject
a present value of the wrong shape before any resolution. Nested alarm
objects get the same treatment the top level already had: a non-string
type no longer folds into the relative default, unknown keys are
rejected per the advertised additionalProperties: false, a string
radius no longer silently becomes the 200 m default, an unsupported
proximity string no longer folds into .enter, non-string sound and
emailAddress are errors, and mixing the location query and coordinate
variants is rejected. URLs must be absolute (carry a scheme), matching
the .uri format the schema already advertises, and reminders_create
now rejects update-only properties like completed because inputSchema
is advertised, not enforced. The rename and delete list schemas carry
an anyOf requirement for identifier or name so a request carrying
neither is advertised as invalid, which the handler already enforced.
Apple's documentation for EKStructuredLocation.radius says
to set it to 0 to use the default radius, and gives no value for that default.
An absent radius now stays 0 instead of becoming 200 meters,
and the alarm schemas no longer advertise a 200-meter default.
Present values are validated as before.
The MCP specification requires type "object" at the root of a tool's
inputSchema. The allOf schemas for reminders_lists_rename and
reminders_lists_delete encoded with only an allOf key at the root,
and the JSONSchema package cannot add anyOf to an object schema.
Both tools return to a top-level object schema
with the same properties, required keys, and additionalProperties,
and their descriptions now state that identifier or name is required.
The handler still rejects a request that has neither.
Alarm parsing and building are now separate steps.
apply parses every alarm configuration without I/O, then builds the alarms,
so the Maps search for a proximity alarm's location runs
only after every check passes:
radius, proximity, sound, and emailAddress on the same alarm,
and every check on the other alarms in the request.
Error messages and codes are unchanged,
and the alarms are built in the same order with the same properties.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several new handlers do not enforce their advertised schemas, and list selector requirements are not represented in those schemas.

3 open findings
4 resolved since last review

🧠 Review effort: Balanced

Comment thread App/Services/Reminders.swift Resolved
Comment thread App/Services/Reminders.swift Resolved
reminders_delete, reminders_lists_create, reminders_lists_rename,
and reminders_lists_delete advertise additionalProperties: false but
never enforced it at runtime, so a typo key rode along while the
request still deleted or created what it named. Each handler now
rejects unknown keys before resolving or touching anything, matching
the schema exactly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Relative-alarm validation has two unresolved cases that can cause failed saves and retained unsaved mutations.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Comment on lines +903 to +905
switch newDue {
case .set(let components): reminder.dueDateComponents = components
case .clear: reminder.dueDateComponents = nil
@mattt

mattt commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Thanks, @bradhallett. You've been turning these around faster than I can review them. I appreciate it.

We ended up fixing some of the same findings in parallel this morning, so here's where things stand to avoid more double work:

I'll push those shortly and let you know. Thanks again!

@mattt

mattt commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@bradhallett Those are up now:

  • Add reminder update, delete, and list management tools #271: if EventKit rejects the save in reminders_update, the reminder is rolled back, so the shared store doesn't hold the changes for a later save. I didn't add a "relative alarms need a due date" check. Apple doesn't document that rule, and it would change reminders_create from what's on main.
  • Add recurrence and completion details to reminders #272: the comment on value(for:) now says a rule round-trips only when every value is representable. I also ran your ordinal change through a round-trip check for every weekday from -54 to 54, and it all lines up.

One more thing I noticed but haven't verified: EKError.Code has reminderAlarmContainsEmailOrUrl, which suggests EventKit might reject email alarms on reminders. That shouldn't hold up this PR or 1.7.0 — if it turns out to be a problem, it can go in a patch release.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A failed list rename can leave an unintended pending mutation in the shared EventKit store.

2 open findings
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reset shared event store after saveCalendar failure

App/​Services/​Reminders.swift:772

If saveCalendar throws, this title mutation remains on the calendar held by the shared EKEventStore; a later successful commit can therefore persist a rename that this call reported as failed. The reminder update path explicitly rolls back for the same reason, but EKCalendar has no item-level rollback, so reset the store on failure before propagating the error.

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It introduces substantial destructive EventKit behavior validated primarily through manual live-store testing.

2 open findings

🧠 Review effort: Balanced

@mattt
mattt merged commit 8b15286 into mattt:main Oct 13, 2026
2 checks passed
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.

Ability to edit and remove reminders

3 participants