@mgcrea/mcp-apple-reminders 1.30.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { M as BUILD_INFO, T as REMINDERS_SURFACE, a as loadConfig, r as createServer } from "./server-DPgwdN2o.js";
2
+ import { M as BUILD_INFO, T as REMINDERS_SURFACE, a as loadConfig, r as createServer } from "./server-BXLDwZCf.js";
3
3
  import { runStdioServer } from "@mgcrea/mcp-apple-core";
4
4
  //#region src/cli.ts
5
5
  const LOG_PREFIX = "apple-reminders-mcp";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AppBusyError as RemindersBusyError, AppNotRunningError as RemindersNotRunningError, AppleAutomationError, AppleAutomationError as AppleRemindersError, BuildInfo, DateKind, InvalidDateError, Logger, OsascriptRunner, ParsedDate, ReadOnlyMode, StoreFacts, SurfaceContext, parseBound, parseDate, toLocalIso } from "@mgcrea/mcp-apple-core";
2
2
  import { z } from "zod";
3
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { McpServer } from "@modelcontextprotocol/server";
4
4
  import { DatabaseSync } from "node:sqlite";
5
5
  //#region src/build-info.d.ts
6
6
  declare const BUILD_INFO: BuildInfo;
@@ -284,6 +284,18 @@ declare class ReminderStore {
284
284
  */
285
285
  subtasksOf(parentPk: number): IndexReminder[];
286
286
  lists(): IndexList[];
287
+ /**
288
+ * Total and incomplete reminders per list, keyed by the list's uuid, which
289
+ * is the id Apple Events gives the same list. Every live list is present,
290
+ * an empty one at zero; null when the columns the join needs are missing.
291
+ *
292
+ * Measured on a live store (2026-10-27): 1 ms, agreeing with Apple Events
293
+ * on all 12 lists, with tombstoned reminders and lists excluded.
294
+ */
295
+ listCounts(): Map<string, {
296
+ total: number;
297
+ incomplete: number;
298
+ }> | null;
287
299
  attachmentsOf(reminderPk: number): IndexAttachment[];
288
300
  /**
289
301
  * Alarms, recurrence and location for one reminder.
@@ -312,7 +324,8 @@ type ReminderAccount = {
312
324
  name: string | null;
313
325
  isDefault: boolean;
314
326
  listCount: number;
315
- reminderCount: number;
327
+ /** Null when Reminders cannot say, which on macOS 27 is always: see LIST_ACCOUNTS. */
328
+ reminderCount: number | null;
316
329
  };
317
330
  type ReminderList = {
318
331
  id: string | null;
@@ -451,6 +464,12 @@ declare class AppleRemindersClient {
451
464
  */
452
465
  lanes(): Promise<LaneStatus>;
453
466
  accounts(): Promise<ReminderAccount[]>;
467
+ /**
468
+ * Every list, with counts from the store when it is open — one query that
469
+ * agreed with Apple Events on every list measured — and from Reminders
470
+ * otherwise, in one chained event. A list the store does not hold reports
471
+ * null counts: unknown, not zero.
472
+ */
454
473
  lists(): Promise<ReminderList[]>;
455
474
  /** Drop the cache after a write, so the next read reflects it. */
456
475
  invalidate(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/dates.ts","../src/client/errors.ts","../src/client/locate.ts","../src/client/priority.ts","../src/client/ref.ts","../src/config.ts","../src/client/store.ts","../src/client/reminders.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;;KC4Bb,UAAU;;;;cCrCT,mBAAmB;;cAoBnB,8BAA8B;WACvB;EAElB,YAAY;;;cAUD,0BAA0B;WACnB;EAElB,YAAY,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCVf;KAQD,iBAAiB;EAAe;;KAEhC,eAAe;EACzB;;EAEA;;EAEA,YAAY;;EAEZ;EACA;;cAGW,uBAAoB;cAkCpB,cAAW;EACd;EAAgC;MACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;KClES;cAEC,yBAAyB;;cAMzB,kBAAe,MAAU;;;;;cAMzB,iBAAc,qCAAuC;;;;;;;cAiBrD,OAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC7BJ;KAKD;;EA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;KAIU;EACV;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;;KAiEU;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ,aAAa;;;;;;;;;;;;;;;;;;cAmBF;;WACF,QAAQ;WACR,QAAQ;EAOjB,YAAY,MAAM;EAclB,UAAU;;EAKV,SAAS;;;;;;;;EAoBH,SAAS,QAAQ;EAsCjB,YAAY,QAAQ;EAOpB,SAAS,QAAQ;;EAuCvB;EAkOM,cAAc,SAAS,kBAAkB,QAAQ;;;;;;;;EAgDjD,gBACJ,eACA;IAAQ;MAA6B,kBACpC,QAAQ;;;;;;;;;;;;;EAkCL,YAAY,cAAc,QAAQ;;EAsDlC,YAAY,mBAAmB;EAwC/B,eACJ,QAAQ;IAAmB;IAAc;MACxC,QAAQ;EAgBL,eAAe,aAAa,QAAQ,iBAAiB,QAAQ;EAS7D,kBACJ,gBACA,sBACC;IAAU;IAAa;IAAgB;;;;;;;;;EAuBpC,cACJ,gBACA,eACC;IAAU;IAAoB;IAAqB;IAAgB;;EAgChE,gBAAgB,iBAAiB;IAAU;IAAiB;;;;;cCj0BvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;EAEZ,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KC9B7C;;;;;EAKV;;;;;;;;;;;;cAaW,gBAAa,QAChB,WAAS,QACT,sBAAoB,KACvB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/dates.ts","../src/client/errors.ts","../src/client/locate.ts","../src/client/priority.ts","../src/client/ref.ts","../src/config.ts","../src/client/store.ts","../src/client/reminders.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;;KC4Bb,UAAU;;;;cCrCT,mBAAmB;;cAoBnB,8BAA8B;WACvB;EAElB,YAAY;;;cAUD,0BAA0B;WACnB;EAElB,YAAY,cAAc;;;;;;;;;;;;;;;;;;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ChB,WAAS,QACT,sBAAoB,KACvB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as parseDate, C as InvalidDateError, D as RemindersBusyError, E as ReminderNotFoundError, M as BUILD_INFO, O as RemindersNotRunningError, S as AppleRemindersError, T as REMINDERS_SURFACE, _ as toPriorityName, a as loadConfig, b as defaultContainerPath, c as introspect, d as decodeRef, f as encodeRef, g as rank, h as PRIORITY_NAMES, i as registerTools, j as toLocalIso, k as parseBound, l as openStore, m as uuidOf, n as SERVER_VERSION, o as AppleRemindersClient, p as refFromUuid, r as createServer, s as ReminderStore, t as SERVER_NAME, u as REF_VERSION, v as toPriorityValue, w as ListNotFoundError, x as locateStore, y as GROUP_CONTAINER } from "./server-DPgwdN2o.js";
1
+ import { A as parseDate, C as InvalidDateError, D as RemindersBusyError, E as ReminderNotFoundError, M as BUILD_INFO, O as RemindersNotRunningError, S as AppleRemindersError, T as REMINDERS_SURFACE, _ as toPriorityName, a as loadConfig, b as defaultContainerPath, c as introspect, d as decodeRef, f as encodeRef, g as rank, h as PRIORITY_NAMES, i as registerTools, j as toLocalIso, k as parseBound, l as openStore, m as uuidOf, n as SERVER_VERSION, o as AppleRemindersClient, p as refFromUuid, r as createServer, s as ReminderStore, t as SERVER_NAME, u as REF_VERSION, v as toPriorityValue, w as ListNotFoundError, x as locateStore, y as GROUP_CONTAINER } from "./server-BXLDwZCf.js";
2
2
  export { AppleRemindersClient, AppleRemindersError, BUILD_INFO, GROUP_CONTAINER, InvalidDateError, ListNotFoundError, PRIORITY_NAMES, REF_VERSION, REMINDERS_SURFACE, ReminderNotFoundError, ReminderStore, RemindersBusyError, RemindersNotRunningError, SERVER_NAME, SERVER_VERSION, createServer, decodeRef, defaultContainerPath, encodeRef, introspect, loadConfig, locateStore, openStore, parseBound, parseDate, rank, refFromUuid, registerTools, toLocalIso, toPriorityName, toPriorityValue, uuidOf };
@@ -3,7 +3,7 @@ import { readdirSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { z } from "zod";
6
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ import { McpServer } from "@modelcontextprotocol/server";
7
7
  //#region src/build-info.ts
8
8
  const pkg = readPackageIdentity(new URL("../package.json", import.meta.url), {
9
9
  name: "@mgcrea/mcp-apple-reminders",
@@ -12,8 +12,8 @@ const pkg = readPackageIdentity(new URL("../package.json", import.meta.url), {
12
12
  const BUILD_INFO = {
13
13
  name: pkg.name,
14
14
  version: pkg.version,
15
- gitCommit: "9c493e1",
16
- gitCommitDate: "2026-10-22T12:13:02+02:00"
15
+ gitCommit: "735f35d",
16
+ gitCommitDate: "2026-10-29T10:51:42+01:00"
17
17
  };
18
18
  //#endregion
19
19
  //#region src/client/errors.ts
@@ -351,20 +351,32 @@ function zip(keys, columns, count) {
351
351
  */
352
352
  function listTree(container, accountId, depth, out) {
353
353
  if (depth > 8) return out;
354
- var subs = [];
355
- try { subs = container.lists(); } catch (e) { return out; }
356
- for (var i = 0; i < subs.length; i++) {
357
- var l = subs[i];
358
- var id = prop(function () { return String(l.id()); }, null);
354
+ // Bulk reads, one event per property for the whole level rather than one
355
+ // per list: measured, an event costs ~0.2-1 s on Reminders however little
356
+ // it asks for, and the per-list walk was 17-29 s for twelve lists.
357
+ var c = container.lists;
358
+ var ids = prop(function () { return c.id(); }, null);
359
+ if (!ids) return out;
360
+ var names = prop(function () { return c.name(); }, []);
361
+ var colors = prop(function () { return c.color(); }, []);
362
+ var emblems = prop(function () { return c.emblem(); }, []);
363
+ // Which of these lists hold lists of their own, in one chained fetch, so
364
+ // only a group is walked into. Not documented to work: when it does not
365
+ // answer, every list is walked into, as before.
366
+ var nested = prop(function () { return c.lists.id(); }, null);
367
+ if (nested && nested.length !== ids.length) nested = null;
368
+ for (var i = 0; i < ids.length; i++) {
369
+ var id = ids[i] === null || ids[i] === undefined ? null : String(ids[i]);
359
370
  out.push({
360
371
  id: id,
361
- name: prop(function () { return String(l.name()); }, null),
372
+ name: names[i] === null || names[i] === undefined ? null : String(names[i]),
362
373
  accountId: accountId,
363
374
  depth: depth,
364
- color: prop(function () { return String(l.color()); }, null),
365
- emblem: prop(function () { return String(l.emblem()); }, null)
375
+ color: String(colors[i]),
376
+ emblem: String(emblems[i])
366
377
  });
367
- listTree(l, accountId, depth + 1, out);
378
+ var hasChildren = nested ? (nested[i] || []).length > 0 : true;
379
+ if (hasChildren && id !== null) listTree(c.byId(id), accountId, depth + 1, out);
368
380
  }
369
381
  return out;
370
382
  }
@@ -495,7 +507,9 @@ const LIST_ACCOUNTS = script(`
495
507
  name: prop(function () { return String(a.name()); }, null),
496
508
  isDefault: id !== null && id === defaultAccountId,
497
509
  listCount: prop(function () { return a.lists().length; }, 0),
498
- reminderCount: prop(function () { return a.reminders().length; }, 0)
510
+ // Answers "Can't get object." on a live Reminders (macOS 27), so this is
511
+ // null there: unknown, never a 0 nobody counted.
512
+ reminderCount: prop(function () { return a.reminders().length; }, null)
499
513
  });
500
514
  }
501
515
  return ok({ accounts: out, defaultAccountId: defaultAccountId, defaultListId: defaultListId });
@@ -514,23 +528,40 @@ const LIST_LISTS = script(`
514
528
  var accountName = prop(function () { return String(a.name()); }, null);
515
529
  var lists = listTree(a, accountId, 1, []);
516
530
  for (var j = 0; j < lists.length; j++) {
517
- var l = lists[j];
518
- l.accountName = accountName;
519
- l.isDefault = l.id !== null && l.id === defaultListId;
520
- // Counted per list, which is one Apple Event each — a handful, not one
521
- // per reminder. Split so a caller can see a list's live workload without
522
- // paging through years of finished items.
523
- var counts = prop(function () {
524
- var done = R.lists.byId(l.id).reminders.completed();
525
- var total = done.length, open = 0;
526
- for (var k = 0; k < done.length; k++) if (!done[k]) open++;
527
- return { total: total, incomplete: open };
528
- }, { total: null, incomplete: null });
529
- l.reminderCount = counts.total;
530
- l.incompleteCount = counts.incomplete;
531
- out.push(l);
531
+ lists[j].accountName = accountName;
532
+ lists[j].isDefault = lists[j].id !== null && lists[j].id === defaultListId;
533
+ out.push(lists[j]);
532
534
  }
533
535
  }
536
+
537
+ // Counts, unless the caller has them from the store. Every list's completed
538
+ // flags in one chained event (2.2 s measured, matching the store on 12 of 12
539
+ // lists), keyed by the flat R.lists ids; one event per list only when the
540
+ // chained form does not answer.
541
+ var counts = {};
542
+ if (p.withCounts) {
543
+ var flatIds = prop(function () { return R.lists.id(); }, []);
544
+ var flags = prop(function () { return R.lists.reminders.completed(); }, null);
545
+ if (!flags || flags.length !== flatIds.length) {
546
+ flags = [];
547
+ for (var f = 0; f < flatIds.length; f++) {
548
+ var fid = flatIds[f];
549
+ flags.push(prop(function () { return R.lists.byId(fid).reminders.completed(); }, null));
550
+ }
551
+ }
552
+ for (var k = 0; k < flatIds.length; k++) {
553
+ var done = flags[k];
554
+ if (!done) continue;
555
+ var open = 0;
556
+ for (var d = 0; d < done.length; d++) if (!done[d]) open++;
557
+ counts[String(flatIds[k])] = { total: done.length, incomplete: open };
558
+ }
559
+ }
560
+ for (var o = 0; o < out.length; o++) {
561
+ var c = out[o].id === null ? undefined : counts[out[o].id];
562
+ out[o].reminderCount = c ? c.total : null;
563
+ out[o].incompleteCount = c ? c.incomplete : null;
564
+ }
534
565
  return ok(out);
535
566
  `);
536
567
  /**
@@ -644,35 +675,37 @@ const GET_REMINDERS = script(`
644
675
  var out = [];
645
676
  for (var i = 0; i < p.ids.length; i++) {
646
677
  var id = String(p.ids[i]);
647
- var r = null;
648
- try { r = R.reminders.byId(id); } catch (e) { r = null; }
649
- if (!r) { out.push({ id: id, found: false }); continue; }
650
- // container() throws on a reminder on macOS 26.6 (60/60 attempts), so this
651
- // is expected to be null. Kept because it costs nothing when it fails and
652
- // would start working silently if Apple ever fixes it.
653
- var container = prop(function () { return r.container(); }, null);
654
- var containerClass = container === null ? null : prop(function () { return String(container.class()); }, null);
655
- var dueRaw = prop(function () { return r.dueDate(); }, null);
656
- var allDayRaw = prop(function () { return r.alldayDueDate(); }, null);
678
+ // One event for every field. Each event on a reminder re-resolves byId
679
+ // across the application, ~1 s apiece measured on macOS 27, so reading
680
+ // the properties one at a time ran past the 30 s timeout on every call.
681
+ var all;
682
+ try {
683
+ all = R.reminders.byId(id).properties();
684
+ } catch (e) {
685
+ if (String(e && e.message ? e.message : e).indexOf("Can't get") !== -1) {
686
+ out.push({ id: id, found: false });
687
+ continue;
688
+ }
689
+ throw e;
690
+ }
691
+ var dueRaw = all.dueDate || null;
692
+ var allDayRaw = all.alldayDueDate || null;
657
693
  out.push({
658
694
  id: id,
659
695
  found: true,
660
- name: prop(function () { return String(r.name()); }, null),
661
- body: prop(function () { var b = r.body(); return b === null ? null : String(b); }, null),
662
- completed: prop(function () { return r.completed(); }, null),
663
- completionDate: iso(prop(function () { return r.completionDate(); }, null)),
696
+ name: all.name === null || all.name === undefined ? null : String(all.name),
697
+ body: all.body === null || all.body === undefined ? null : String(all.body),
698
+ completed: all.completed === undefined ? null : all.completed,
699
+ completionDate: iso(all.completionDate),
664
700
  dueDate: iso(dueRaw),
665
701
  alldayDueDate: iso(allDayRaw),
666
702
  allDayGuess: isMidnight(allDayRaw || dueRaw),
667
703
  dueDay: dayOf(allDayRaw || dueRaw),
668
- remindMeDate: iso(prop(function () { return r.remindMeDate(); }, null)),
669
- priority: prop(function () { return r.priority(); }, 0),
670
- flagged: prop(function () { return r.flagged(); }, false),
671
- created: iso(prop(function () { return r.creationDate(); }, null)),
672
- modified: iso(prop(function () { return r.modificationDate(); }, null)),
673
- containerClass: containerClass,
674
- containerId: container === null ? null : prop(function () { return String(container.id()); }, null),
675
- containerName: container === null ? null : prop(function () { return String(container.name()); }, null)
704
+ remindMeDate: iso(all.remindMeDate),
705
+ priority: all.priority === undefined || all.priority === null ? 0 : all.priority,
706
+ flagged: all.flagged === undefined || all.flagged === null ? false : all.flagged,
707
+ created: iso(all.creationDate),
708
+ modified: iso(all.modificationDate)
676
709
  });
677
710
  }
678
711
  return ok(out);
@@ -1008,6 +1041,30 @@ var ReminderStore = class {
1008
1041
  smartListType: r.smartListType ?? null
1009
1042
  }));
1010
1043
  }
1044
+ /**
1045
+ * Total and incomplete reminders per list, keyed by the list's uuid, which
1046
+ * is the id Apple Events gives the same list. Every live list is present,
1047
+ * an empty one at zero; null when the columns the join needs are missing.
1048
+ *
1049
+ * Measured on a live store (2026-10-27): 1 ms, agreeing with Apple Events
1050
+ * on all 12 lists, with tombstoned reminders and lists excluded.
1051
+ */
1052
+ listCounts() {
1053
+ const r = this.caps.reminderColumns;
1054
+ if (!this.caps.listColumns.has("ZCKIDENTIFIER") || !r.has("ZLIST") || !r.has("ZCOMPLETED")) return null;
1055
+ const liveList = this.caps.listColumns.has("ZMARKEDFORDELETION") ? `(l."ZMARKEDFORDELETION" IS NULL OR l."ZMARKEDFORDELETION" = 0)` : "1 = 1";
1056
+ const rows = this.db.prepare(`SELECT UPPER(l."ZCKIDENTIFIER") AS uuid, COUNT(r."Z_PK") AS total,
1057
+ SUM(CASE WHEN r."Z_PK" IS NOT NULL AND (r."ZCOMPLETED" IS NULL OR r."ZCOMPLETED" = 0)
1058
+ THEN 1 ELSE 0 END) AS incomplete
1059
+ FROM ZREMCDBASELIST l
1060
+ LEFT JOIN ZREMCDREMINDER r ON r."ZLIST" = l."Z_PK" AND ${this.#live()}
1061
+ WHERE ${liveList} AND l."ZCKIDENTIFIER" IS NOT NULL
1062
+ GROUP BY l."Z_PK"`).all();
1063
+ return new Map(rows.map((x) => [x.uuid, {
1064
+ total: x.total,
1065
+ incomplete: x.incomplete ?? 0
1066
+ }]));
1067
+ }
1011
1068
  attachmentsOf(reminderPk) {
1012
1069
  if (!this.caps.hasAttachments) return [];
1013
1070
  return this.db.prepare(`SELECT "Z_PK" AS pk, "ZCKIDENTIFIER" AS uuid, "ZREMINDER" AS reminderPk,
@@ -1200,8 +1257,24 @@ var AppleRemindersClient = class AppleRemindersClient {
1200
1257
  async accounts() {
1201
1258
  return (await withBusyRetry(() => this.runner.run(LIST_ACCOUNTS))).accounts.filter((a) => this.#allowedAccount(a.name));
1202
1259
  }
1260
+ /**
1261
+ * Every list, with counts from the store when it is open — one query that
1262
+ * agreed with Apple Events on every list measured — and from Reminders
1263
+ * otherwise, in one chained event. A list the store does not hold reports
1264
+ * null counts: unknown, not zero.
1265
+ */
1203
1266
  async lists() {
1204
- return (await withBusyRetry(() => this.runner.run(LIST_LISTS))).filter((l) => this.#allowedAccount(l.accountName) && this.#allowedList(l.name));
1267
+ const counts = this.index()?.listCounts() ?? null;
1268
+ const allowed = (await withBusyRetry(() => this.runner.run(LIST_LISTS, { withCounts: counts === null }))).filter((l) => this.#allowedAccount(l.accountName) && this.#allowedList(l.name));
1269
+ if (!counts) return allowed;
1270
+ return allowed.map((l) => {
1271
+ const c = l.id ? counts.get(l.id.toUpperCase()) : void 0;
1272
+ return {
1273
+ ...l,
1274
+ reminderCount: c?.total ?? null,
1275
+ incompleteCount: c?.incomplete ?? null
1276
+ };
1277
+ });
1205
1278
  }
1206
1279
  /**
1207
1280
  * Every reminder, cached on a TTL.
@@ -1470,6 +1543,7 @@ var AppleRemindersClient = class AppleRemindersClient {
1470
1543
  return {
1471
1544
  ...summary,
1472
1545
  ...indexed ? {
1546
+ list: summary.list ?? indexed.listName,
1473
1547
  dueAllDay: indexed.allDay,
1474
1548
  dueAllDaySource: "index",
1475
1549
  due: renderDue(indexed.due, indexed.allDay, utcDay(indexed.due))
@@ -1880,7 +1954,7 @@ const buildDiagnostics = async (client, ctx) => {
1880
1954
  const registerDiagnosticsTools = (server, client, ctx) => {
1881
1955
  server.registerTool("apple_reminders_diagnostics", {
1882
1956
  description: "Report which lanes are live, which macOS permissions are granted, and what each missing one is blocking. Start here when a tool fails, or answers from the Apple Events lane when you expected the index — it names the exact System Settings pane to open.",
1883
- inputSchema: {},
1957
+ inputSchema: z.object({}),
1884
1958
  annotations: { readOnlyHint: true }
1885
1959
  }, async () => wrap(() => buildDiagnostics(client, ctx)).then((r) => r ?? ok({})));
1886
1960
  };
@@ -1888,13 +1962,13 @@ const registerDiagnosticsTools = (server, client, ctx) => {
1888
1962
  //#region src/tools/accounts.ts
1889
1963
  const registerAccountTools = (server, client) => {
1890
1964
  server.registerTool("apple_reminders_list_accounts", {
1891
- description: "List the Reminders accounts, with how many lists and reminders each holds. Start here to discover account names for the other tools.",
1892
- inputSchema: {},
1965
+ description: "List the Reminders accounts, with how many lists each holds. Start here to discover account names for the other tools. `reminderCount` is null when Reminders will not count an account's reminders, which is usual: per-list counts are in apple_reminders_list_lists.",
1966
+ inputSchema: z.object({}),
1893
1967
  annotations: { readOnlyHint: true }
1894
1968
  }, async () => wrap(() => client.accounts()));
1895
1969
  server.registerTool("apple_reminders_list_lists", {
1896
- description: "List every Reminders list, across accounts. Lists nest inside other lists (Reminders calls those groups), so each entry carries its depth. Each also reports its total and incomplete counts, which is the cheapest way to see where the live work is.",
1897
- inputSchema: {},
1970
+ description: "List every Reminders list, across accounts. Lists nest inside other lists (Reminders calls those groups), so each entry carries its depth. Each also reports its total and incomplete counts, which is the cheapest way to see where the live work is. Counts are null for a list they could not be read for, which is not the same as empty.",
1971
+ inputSchema: z.object({}),
1898
1972
  annotations: { readOnlyHint: true }
1899
1973
  }, async () => wrap(() => client.lists()));
1900
1974
  };
@@ -1914,7 +1988,7 @@ const registerAccountTools = (server, client) => {
1914
1988
  const registerActionTools = (server, client) => {
1915
1989
  server.registerTool("apple_reminders_create_reminder", {
1916
1990
  description: "Create a reminder. With no list, it goes to the list Reminders itself treats as the default — the same one the app would have used.",
1917
- inputSchema: {
1991
+ inputSchema: z.object({
1918
1992
  name: z.string().min(1).describe("The reminder's title."),
1919
1993
  body: z.string().optional().describe("Notes attached to the reminder."),
1920
1994
  list: listArg,
@@ -1922,11 +1996,11 @@ const registerActionTools = (server, client) => {
1922
1996
  remindMe: dateArg.optional().describe("When to actually alert, if different from the due date."),
1923
1997
  priority: priorityArg,
1924
1998
  flagged: z.boolean().optional().describe("Flag it.")
1925
- }
1999
+ })
1926
2000
  }, async (args) => wrap(() => client.createReminder(args)));
1927
2001
  server.registerTool("apple_reminders_update_reminder", {
1928
2002
  description: "Change fields on one reminder. Anything you omit is left alone. Setting `due` to a bare day converts it to an all-day reminder; setting a date-time makes it timed.",
1929
- inputSchema: {
2003
+ inputSchema: z.object({
1930
2004
  ref: reminderRefArg,
1931
2005
  name: z.string().optional(),
1932
2006
  body: z.string().optional().describe("Replaces the notes body. Pass an empty string to clear it."),
@@ -1934,29 +2008,29 @@ const registerActionTools = (server, client) => {
1934
2008
  remindMe: dateArg.optional(),
1935
2009
  priority: priorityArg,
1936
2010
  flagged: z.boolean().optional()
1937
- }
2011
+ })
1938
2012
  }, async ({ ref, ...fields }) => wrap(() => client.updateReminder(ref, fields)));
1939
2013
  server.registerTool("apple_reminders_complete_reminders", {
1940
2014
  description: "Tick reminders off, or un-tick them with `completed: false`. Separate from update because it is the common case and takes several at once.",
1941
- inputSchema: {
2015
+ inputSchema: z.object({
1942
2016
  refs: reminderRefsArg,
1943
2017
  completed: z.boolean().optional().describe("Defaults to true. Pass false to mark them not done again.")
1944
- }
2018
+ })
1945
2019
  }, async ({ refs, completed }) => wrap(() => client.completeReminders(refs, completed ?? true)));
1946
2020
  server.registerTool("apple_reminders_move_reminders", {
1947
2021
  description: "Move reminders to another list. NOTE: Reminders' scripting interface makes a list read-only on a reminder, so this is a copy followed by a delete. Each moved reminder therefore gets a NEW ref (returned alongside the old one) and a new creation date. The original is deleted only after the copy is confirmed.",
1948
- inputSchema: {
2022
+ inputSchema: z.object({
1949
2023
  refs: reminderRefsArg,
1950
2024
  list: z.string().min(1).describe("Target list name or id."),
1951
2025
  confirm: confirmArg
1952
- }
2026
+ })
1953
2027
  }, async ({ refs, list }) => wrap(() => client.moveReminders(refs, list)));
1954
2028
  server.registerTool("apple_reminders_delete_reminders", {
1955
2029
  description: "Delete reminders. Unlike Notes, Reminders has no Recently Deleted — this is irreversible, so it requires an explicit confirm.",
1956
- inputSchema: {
2030
+ inputSchema: z.object({
1957
2031
  refs: reminderRefsArg,
1958
2032
  confirm: confirmArg
1959
- }
2033
+ })
1960
2034
  }, async ({ refs }) => wrap(() => client.deleteReminders(refs)));
1961
2035
  };
1962
2036
  //#endregion
@@ -1975,7 +2049,7 @@ const filterSchema = {
1975
2049
  const registerReminderTools = (server, client) => {
1976
2050
  server.registerTool("apple_reminders_list_reminders", {
1977
2051
  description: "List reminders, soonest due first, with undated ones last. Returns `reminders` with a `ref` each for the read and action tools, alongside `source` and `hasMore`. Completed reminders are excluded unless you ask for them. Every filter is optional; with none, this is the whole live list — but check `hasMore` before believing that, and read the `note` field if one is present: it means a lane bound, not your `limit`, ended the list.",
1978
- inputSchema: filterSchema,
2052
+ inputSchema: z.object(filterSchema),
1979
2053
  annotations: { readOnlyHint: true }
1980
2054
  }, async (args) => wrap(() => client.listReminders({
1981
2055
  ...args,
@@ -1983,11 +2057,11 @@ const registerReminderTools = (server, client) => {
1983
2057
  })));
1984
2058
  server.registerTool("apple_reminders_search_reminders", {
1985
2059
  description: "Search reminders by text. `scope: \"full\"` (the default) matches the name and the notes body; `scope: \"title\"` matches only the name. Accepts the same filters as list_reminders, so you can search within one list or one date range. Carries the same `hasMore` and `note` fields as list_reminders.",
1986
- inputSchema: {
2060
+ inputSchema: z.object({
1987
2061
  query: z.string().min(1).describe("Text to look for. Case-insensitive substring match."),
1988
2062
  scope: z.enum(["full", "title"]).optional().describe("full = name and notes body (default). title = name only."),
1989
2063
  ...filterSchema
1990
- },
2064
+ }),
1991
2065
  annotations: { readOnlyHint: true }
1992
2066
  }, async ({ query, scope, ...rest }) => wrap(() => client.searchReminders(query, {
1993
2067
  ...rest,
@@ -1996,7 +2070,7 @@ const registerReminderTools = (server, client) => {
1996
2070
  })));
1997
2071
  server.registerTool("apple_reminders_get_reminder", {
1998
2072
  description: "Read one reminder in full by ref, including its notes body and any subtasks. `dueDate` and `alldayDueDate` are reported separately from the combined `due` field, so you can see which property actually holds the date.",
1999
- inputSchema: { ref: reminderRefArg },
2073
+ inputSchema: z.object({ ref: reminderRefArg }),
2000
2074
  annotations: { readOnlyHint: true }
2001
2075
  }, async ({ ref }) => wrap(() => client.getReminder(ref)));
2002
2076
  };
@@ -2070,4 +2144,4 @@ const createServer = (opts) => {
2070
2144
  //#endregion
2071
2145
  export { parseDate as A, InvalidDateError as C, RemindersBusyError as D, ReminderNotFoundError as E, BUILD_INFO as M, RemindersNotRunningError as O, AppleRemindersError as S, REMINDERS_SURFACE as T, toPriorityName as _, loadConfig as a, defaultContainerPath as b, introspect as c, decodeRef as d, encodeRef as f, rank as g, PRIORITY_NAMES as h, registerTools as i, toLocalIso as j, parseBound as k, openStore as l, uuidOf as m, SERVER_VERSION as n, AppleRemindersClient as o, refFromUuid as p, createServer as r, ReminderStore as s, SERVER_NAME as t, REF_VERSION as u, toPriorityValue as v, ListNotFoundError as w, locateStore as x, GROUP_CONTAINER as y };
2072
2146
 
2073
- //# sourceMappingURL=server-DPgwdN2o.js.map
2147
+ //# sourceMappingURL=server-BXLDwZCf.js.map