@todoist/mcp 17.3.8 → 17.3.10

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.
@@ -1,7 +1,7 @@
1
1
  import { ResourceTemplate as hr, McpServer as mr } from "@modelcontextprotocol/server";
2
2
  import { createHash as zo, randomUUID as Ce } from "node:crypto";
3
3
  import { readFileSync as fr } from "node:fs";
4
- import { dirname as qo, join as ct } from "node:path";
4
+ import { join as ct, dirname as qo } from "node:path";
5
5
  import { fileURLToPath as br } from "node:url";
6
6
  import { RESOURCE_MIME_TYPE as dt } from "@modelcontextprotocol/ext-apps/server";
7
7
  import { createToolRegistrar as gr } from "@todoist/mcp-core";
@@ -11,169 +11,10 @@ import { createRequire as Tr } from "node:module";
11
11
  import { TodoistApi as kr, formatUserShortName as Go, isWorkspaceProject as W, isPersonalProject as Q, colors as lt, LOCATION_TRIGGERS as Yo, REMINDER_TYPES as Ir, TodoistSyncError as vr, TodoistRequestError as Sr, createCommand as Y, PROJECT_ICONS as Vo, PROJECT_VIEW_STYLES as Jo, REMINDER_DELIVERY_SERVICES as Cr, HEALTH_STATUSES as $t, getTaskUrl as Xo, getProjectUrl as Zo, ACTIVITY_EVENT_TYPES as jr, ACTIVITY_OBJECT_TYPES as Qo, escapeFilterToken as Et, parseTodoistUrl as $r, WORKSPACE_ROLES as Er, WORKSPACE_PLANS as Ar } from "@todoist/sdk";
12
12
  import { addDays as es, formatISO as Dr } from "date-fns";
13
13
  import { generateNKeysBetween as ts } from "fractional-indexing";
14
- const At = 3600 * 1e3, xr = 365 * 24 * At, $ = {
15
- /** Default limit for task listings */
16
- TASKS_DEFAULT: 10,
17
- /** Maximum limit for task search and list operations */
18
- TASKS_MAX: 100,
19
- /** Largest page of tasks the API returns, for reading past tasks a tool filters out */
20
- TASKS_PAGE_MAX: 200,
21
- /** Default limit for completed tasks */
22
- COMPLETED_TASKS_DEFAULT: 50,
23
- /** Maximum limit for completed tasks */
24
- COMPLETED_TASKS_MAX: 200,
25
- /** Default limit for project listings */
26
- PROJECTS_DEFAULT: 50,
27
- /** Maximum limit for project listings */
28
- PROJECTS_MAX: 200,
29
- /** Maximum limit for section listings */
30
- SECTIONS_MAX: 200,
31
- /** Page size for reading a workspace's folders */
32
- FOLDERS_MAX: 200,
33
- /** Batch size for fetching all tasks in a project */
34
- TASKS_BATCH_SIZE: 50,
35
- /** Maximum number of direct children returned when children are requested alongside an object */
36
- CHILDREN_MAX: 25,
37
- /** Default limit for comment listings */
38
- COMMENTS_DEFAULT: 10,
39
- /** Maximum limit for comment search and list operations */
40
- COMMENTS_MAX: 10,
41
- /** Maximum number of users a single comment can notify */
42
- NOTIFY_USERS_MAX: 25,
43
- /** Default limit for activity log listings */
44
- ACTIVITY_DEFAULT: 20,
45
- /** Maximum limit for activity log search and list operations */
46
- ACTIVITY_MAX: 100,
47
- /** Default limit for label listings */
48
- LABELS_DEFAULT: 50,
49
- /** Maximum limit for label listings */
50
- LABELS_MAX: 200,
51
- /** Maximum values in one list-valued filter parameter, such as labels or project IDs */
52
- FILTER_VALUES_MAX: 50
53
- }, _e = {
54
- /** Maximum number of failures to show in detailed error messages */
55
- MAX_FAILURES_SHOWN: 3
56
- }, Or = {
57
- /** Maximum number of failed items named in one log line */
58
- MAX_FAILURES_LOGGED: 5
59
- }, D = {
60
- /** Maximum tasks accepted by one task update operation */
61
- TASKS_PER_OPERATION: 25,
62
- /**
63
- * Maximum tasks one add-tasks call creates. They go out as one Sync request,
64
- * which takes at most 100 commands.
65
- */
66
- TASK_CREATES_PER_OPERATION: 100,
67
- /** Maximum projects, sections, comments, labels or filters created or updated by one call */
68
- ITEMS_PER_OPERATION: 25,
69
- /**
70
- * Maximum existing objects one bulk action takes by ID, such as completing,
71
- * rescheduling, reordering or assigning. A sync-backed reschedule sends one
72
- * command per task, which keeps it under the Sync API's 100 commands per
73
- * request. A reorder is not bounded that way: it can rekey every sibling of
74
- * the objects it moves, so its command count depends on the sibling list.
75
- */
76
- BULK_ACTIONS_PER_OPERATION: 50,
77
- /** Maximum labels set on one task by one call */
78
- LABELS_PER_TASK: 50
79
- }, ut = {
80
- /**
81
- * In-flight task-move requests per account, per process.
82
- *
83
- * Kept at 1 because the API locks the whole task tree for a move, and a tree
84
- * spans a task's source as well as its destination — two moves of sibling
85
- * subtasks contend even when they target different projects, and the loser
86
- * fails. Batching same-destination moves into a single request means
87
- * serialising costs little in practice. One per process is the smallest
88
- * contribution a process can make; see the note above for the global picture.
89
- */
90
- TASK_MOVES: 1,
91
- /** In-flight non-move write requests per account, per process. */
92
- WRITES: 4,
93
- /**
94
- * How long a request may wait for a slot before it is abandoned unsent.
95
- *
96
- * Matches the SDK's own 30s request timeout, which only starts once a request
97
- * actually goes out: a task that has already waited that long would be
98
- * answering a caller who has given up. Comfortably above the worst realistic
99
- * queue (serialised moves to 100 distinct destinations is roughly 15s).
100
- */
101
- QUEUE_WAIT_MS: 3e4
102
- }, so = qo(br(import.meta.url)), _r = [
103
- ct(so, "task-list", "index.html"),
104
- ct(so, "mcp-apps", "index.html")
105
- ], Pr = `<!doctype html>
106
- <html>
107
- <body>
108
- <p>Task list app is missing. Run "npm run build" to generate it.</p>
109
- </body>
110
- </html>`;
111
- function Rr() {
112
- const e = [];
113
- for (const t of _r)
114
- try {
115
- return fr(t, "utf-8");
116
- } catch (o) {
117
- e.push(o);
118
- }
119
- return console.error("Failed to load task list app HTML from any known path:", e), Pr;
120
- }
121
- const os = Rr(), Ur = zo("sha256").update(os).digest("hex").slice(0, 12), pt = `ui://todoist/task-list@${Ur}`, Nr = "ui://todoist/task-list@{hash}", ht = "Interactive task list widget", Lr = "https://ai.todoist.net", mt = {
122
- ui: {
123
- prefersBorder: !0,
124
- csp: {
125
- // The widget is bundled into one HTML file and does not fetch or load external assets.
126
- connectDomains: [],
127
- resourceDomains: []
128
- }
129
- },
130
- "openai/widgetDescription": ht,
131
- "openai/widgetPrefersBorder": !0,
132
- "openai/widgetCSP": {
133
- connect_domains: [],
134
- resource_domains: []
135
- },
136
- "openai/widgetDomain": Lr
137
- }, Mr = { ttlMs: xr, cacheScope: "public" }, Fr = { ttlMs: At, cacheScope: "private" };
138
- function ro(e) {
139
- return {
140
- contents: [
141
- {
142
- uri: e,
143
- mimeType: dt,
144
- text: os,
145
- _meta: mt
146
- }
147
- ]
148
- };
149
- }
150
- function Hr(e) {
151
- e.registerResource(
152
- "todoist-task-list",
153
- pt,
154
- {
155
- description: ht,
156
- mimeType: dt,
157
- _meta: mt,
158
- cacheHint: Mr
159
- },
160
- async () => ro(pt)
161
- ), e.registerResource(
162
- "todoist-task-list-hash-fallback",
163
- new hr(Nr, { list: void 0 }),
164
- {
165
- description: `${ht} compatibility fallback`,
166
- mimeType: dt,
167
- _meta: mt,
168
- cacheHint: Fr
169
- },
170
- async (t) => ro(t.toString())
171
- );
172
- }
173
14
  function ue(e) {
174
15
  return typeof e == "object" && e !== null;
175
16
  }
176
- function ft(...e) {
17
+ function ut(...e) {
177
18
  return e.find(ue);
178
19
  }
179
20
  function X(...e) {
@@ -197,17 +38,17 @@ function ye(e) {
197
38
  const t = B(e);
198
39
  return t !== void 0 ? t : C(e);
199
40
  }
200
- function Wr(e) {
41
+ function xr(e) {
201
42
  return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
202
43
  /\b(token|api[_-]?key|authorization)\s*[:=]\s*["']?[A-Za-z0-9._~+/=-]{6,}["']?/gi,
203
44
  "$1: [REDACTED]"
204
45
  ).replace(/([?&](?:token|api[_-]?key|authorization)=)[^&\s]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[REDACTED]");
205
46
  }
206
47
  function G(e, t = 220) {
207
- const o = Wr(e).replace(/\s+/g, " ").trim();
48
+ const o = xr(e).replace(/\s+/g, " ").trim();
208
49
  return o.length <= t ? o : `${o.slice(0, t - 3)}...`;
209
50
  }
210
- function bt(e) {
51
+ function pt(e) {
211
52
  const t = e.trim();
212
53
  return /\bHTTP\s*\d{3}\b/i.test(t) || /\bstatus code \d{3}\b/i.test(t) || /^bad request$/i.test(t) || /^unauthorized$/i.test(t) || /^forbidden$/i.test(t) || /^not found$/i.test(t);
213
54
  }
@@ -245,7 +86,7 @@ function ce(e) {
245
86
  }
246
87
  return r.length > 0 ? G(r.join("; ")) : void 0;
247
88
  }
248
- function Br(e) {
89
+ function Or(e) {
249
90
  if (!e)
250
91
  return [];
251
92
  const t = /* @__PURE__ */ new Set(), o = (i) => {
@@ -257,7 +98,7 @@ function Br(e) {
257
98
  C(e.path)
258
99
  );
259
100
  o(r);
260
- const n = ft(
101
+ const n = ut(
261
102
  e.details,
262
103
  e.errorDetails,
263
104
  e.errorExtra,
@@ -308,7 +149,7 @@ function Br(e) {
308
149
  }
309
150
  return Array.from(t).slice(0, 3);
310
151
  }
311
- const Kr = [
152
+ const _r = [
312
153
  "error",
313
154
  "error_code",
314
155
  "error_tag",
@@ -319,22 +160,22 @@ const Kr = [
319
160
  "httpCode",
320
161
  "errorExtra"
321
162
  ];
322
- function zr(e) {
323
- return e ? Kr.some((t) => e[t] !== void 0) : !1;
163
+ function Pr(e) {
164
+ return e ? _r.some((t) => e[t] !== void 0) : !1;
324
165
  }
325
- const ss = 'A due string must name one specific date or recurrence, such as "tomorrow", "Friday at 3pm", "2026-12-01" or "every weekday"; a period such as "this week" is not a date.', ze = {
166
+ const os = 'A due string must name one specific date or recurrence, such as "tomorrow", "Friday at 3pm", "2026-12-01" or "every weekday"; a period such as "this week" is not a date.', ze = {
326
167
  // Seen for a deadline sent by a free-plan user (task creates and updates), for
327
168
  // activity older than the plan's history limit, and for location reminders.
328
169
  PREMIUM_ONLY: "The user's Todoist plan does not include a feature this request used. It is not an authentication or permission problem, and retrying the same request will not help. Most often it is a deadline on a free plan: retry without `deadlineDate`. Activity history only goes back as far as the plan allows: retry with a more recent date range. Tell the user what was left out and that it needs a plan upgrade.",
329
170
  // Seen for an unparseable due string on a create, and for a reschedule sent
330
171
  // "today" or a malformed time where an ISO date belongs.
331
- INVALID_DATE: `Todoist could not parse a date in this request. ${ss} Where a field asks for YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS, send exactly that, not words such as "today". Change only the date and retry.`,
172
+ INVALID_DATE: `Todoist could not parse a date in this request. ${os} Where a field asks for YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS, send exactly that, not words such as "today". Change only the date and retry.`,
332
173
  MAX_ITEMS_LIMIT_REACHED: "This project has reached the maximum number of active tasks per project (subtasks count toward it; completed tasks do not). The cap is the same on every Todoist plan — upgrading will not raise it — and it is not an authentication or permission problem. Complete, delete, or move existing tasks out of the project, or add the task to a different project, then retry.",
333
174
  USER_CANNOT_VIEW_TEMPLATE: "This template exists but belongs to another account. Personal templates are private to whoever saved them, and a link to one cannot be used by anyone else. Use a public gallery template instead, or ask the owner to export it with export-project-template and share the CSV."
334
- }, qr = {
175
+ }, Ur = {
335
176
  PREMIUM_ONLY: "The user's Todoist plan does not include a feature this item used. It is not an authentication or permission problem, and retrying the same item will not help. On a task it is most often a deadline on a free plan: retry without `deadlineDate`. Tell the user what was left out and that it needs a plan upgrade."
336
177
  };
337
- function Gr(...e) {
178
+ function Rr(...e) {
338
179
  for (const t of e) {
339
180
  if (!t)
340
181
  continue;
@@ -345,23 +186,23 @@ function Gr(...e) {
345
186
  return r;
346
187
  }
347
188
  }
348
- function rs(e) {
189
+ function ss(e) {
349
190
  const t = e.tag?.toUpperCase();
350
- return t && ze[t] ? t : Gr(...e.rawText ?? [], e.message, e.details);
191
+ return t && ze[t] ? t : Rr(...e.rawText ?? [], e.message, e.details);
351
192
  }
352
- function Yr(e) {
353
- const t = rs(e);
193
+ function Nr(e) {
194
+ const t = ss(e);
354
195
  return t ? ze[t] : void 0;
355
196
  }
356
- function Vr(e) {
357
- const t = Yr(e);
197
+ function Lr(e) {
198
+ const t = Nr(e);
358
199
  if (t)
359
200
  return t;
360
201
  const { statusCode: o } = e, r = e.fieldHints.length > 0;
361
202
  return o === 401 ? "Authentication failed. Verify your API token, then retry." : o === 403 ? "Access denied. Retrying the same request will not help. If it's a scope/access problem (for example, insufficient token scope), use a token or account with the required access. Otherwise, change the request or target instead." : o === 404 ? "Confirm the referenced IDs exist and are accessible, then retry." : o === 429 ? "Rate limit reached. Wait briefly and retry." : o !== void 0 && o >= 500 ? "Todoist API may be temporarily unavailable. Retry shortly." : r ? "Fix the field hints above and retry." : o === 400 || o === 422 ? "Check parameter values and formats, then retry." : "Check the request parameters and retry.";
362
203
  }
363
- function Dt(e) {
364
- const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r = ft(t?.response, o?.response), n = ft(
204
+ function At(e) {
205
+ const t = ue(e) ? e : void 0, o = e instanceof Error && ue(e.cause) ? e.cause : void 0, r = ut(t?.response, o?.response), n = ut(
365
206
  t?.responseData,
366
207
  r?.data,
367
208
  t?.data,
@@ -401,15 +242,15 @@ function Dt(e) {
401
242
  C(t?.message),
402
243
  C(o?.message),
403
244
  e instanceof Error ? e.message : C(e)
404
- ].filter((h) => !!h), u = d.find((h) => !bt(h)) || d[0], l = X(
245
+ ].filter((h) => !!h), u = d.find((h) => !pt(h)) || d[0], l = X(
405
246
  ce(n?.errorExtra),
406
247
  ce(n?.error_extra),
407
248
  ce(n?.details),
408
249
  ce(n?.errorDetails),
409
250
  ce(n?.errors),
410
251
  ce(t?.details)
411
- ), p = Br(n);
412
- return a !== void 0 || zr(n) || c !== void 0 || i !== void 0 || (u ? bt(u) : !1) ? {
252
+ ), p = Or(n);
253
+ return a !== void 0 || Pr(n) || c !== void 0 || i !== void 0 || (u ? pt(u) : !1) ? {
413
254
  statusCode: a,
414
255
  code: i,
415
256
  tag: c ? G(c, 80) : void 0,
@@ -419,21 +260,21 @@ function Dt(e) {
419
260
  fieldHints: p
420
261
  } : null;
421
262
  }
422
- function ns(e) {
263
+ function rs(e) {
423
264
  const t = [];
424
265
  return e.statusCode !== void 0 && t.push(`HTTP ${e.statusCode}`), e.code !== void 0 && t.push(`code ${e.code}`), e.tag && t.push(`tag ${e.tag}`), t;
425
266
  }
426
- function Jr(e) {
427
- const t = ns(e), o = [
267
+ function Mr(e) {
268
+ const t = rs(e), o = [
428
269
  t.length > 0 ? `Todoist API request failed (${t.join(", ")}).` : "Todoist API request failed."
429
270
  ];
430
- return e.message && o.push(`Message: ${e.message}`), e.details && e.details !== e.message && o.push(`Details: ${e.details}`), e.fieldHints.length > 0 && o.push(`Field hints: ${e.fieldHints.join("; ")}`), o.push(`Try next: ${Vr(e)}`), o.join(`
271
+ return e.message && o.push(`Message: ${e.message}`), e.details && e.details !== e.message && o.push(`Details: ${e.details}`), e.fieldHints.length > 0 && o.push(`Field hints: ${e.fieldHints.join("; ")}`), o.push(`Try next: ${Lr(e)}`), o.join(`
431
272
  `);
432
273
  }
433
- function as(e) {
274
+ function ns(e) {
434
275
  return e instanceof Error ? G(e.message) : typeof e == "string" ? G(e) : "An unknown error occurred";
435
276
  }
436
- class xt extends Error {
277
+ class Dt extends Error {
437
278
  constructor(t) {
438
279
  super(t), this.name = "DueStringParseError";
439
280
  }
@@ -444,41 +285,129 @@ class de extends Error {
444
285
  }
445
286
  }
446
287
  function K(e) {
447
- const { summary: t, hint: o } = is(e);
288
+ const { summary: t, hint: o } = as(e);
448
289
  return o ? `${t}. ${o.text}` : t;
449
290
  }
450
- function is(e) {
451
- if (e instanceof xt || e instanceof de)
291
+ function as(e) {
292
+ if (e instanceof Dt || e instanceof de)
452
293
  return { summary: e.message };
453
- const t = Dt(e);
294
+ const t = At(e);
454
295
  if (!t)
455
- return { summary: as(e) };
456
- const o = ns(t), r = t.message && !(o.length > 0 && bt(t.message)) ? t.message : "Todoist API request failed", n = o.length > 0 ? `${r} (${o.join(", ")})` : r, a = rs(t), i = a ? qr[a] ?? ze[a] : void 0;
296
+ return { summary: ns(e) };
297
+ const o = rs(t), r = t.message && !(o.length > 0 && pt(t.message)) ? t.message : "Todoist API request failed", n = o.length > 0 ? `${r} (${o.join(", ")})` : r, a = ss(t), i = a ? Ur[a] ?? ze[a] : void 0;
457
298
  return a && i ? { summary: n, hint: { tag: a, text: i } } : { summary: n };
458
299
  }
459
- function Xr(e, {
300
+ function Fr(e, {
460
301
  taskContent: t,
461
302
  dueString: o,
462
303
  deadlineDate: r
463
304
  }) {
464
305
  if (!o)
465
306
  return;
466
- const n = Dt(e), a = n?.tag?.toUpperCase(), i = a === "INVALID_DUE_STRING", c = !r && (a === "INVALID_DATE" || /^invalid date format\.?$/i.test(n?.message ?? ""));
307
+ const n = At(e), a = n?.tag?.toUpperCase(), i = a === "INVALID_DUE_STRING", c = !r && (a === "INVALID_DATE" || /^invalid date format\.?$/i.test(n?.message ?? ""));
467
308
  if (!i && !c)
468
309
  return;
469
310
  const d = o.trim().replace(/^recurring(?:\s+|$)/i, "").trim();
470
- return d !== o.trim() && d ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use Todoist recurrence syntax, for example \`${d}\`; don't prefix it with \`recurring\`. Change only \`dueString\` and retry.` : d !== o.trim() ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use a complete Todoist recurrence expression; \`recurring\` alone is not valid. Change only \`dueString\` and retry.` : `Task "${t}" wasn't created because \`dueString\` could not be parsed. ${ss} Change only \`dueString\` and retry.`;
311
+ return d !== o.trim() && d ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use Todoist recurrence syntax, for example \`${d}\`; don't prefix it with \`recurring\`. Change only \`dueString\` and retry.` : d !== o.trim() ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use a complete Todoist recurrence expression; \`recurring\` alone is not valid. Change only \`dueString\` and retry.` : `Task "${t}" wasn't created because \`dueString\` could not be parsed. ${os} Change only \`dueString\` and retry.`;
471
312
  }
472
- function Zr(e) {
473
- if (e instanceof yr || e instanceof xt || e instanceof de)
313
+ function Hr(e) {
314
+ if (e instanceof yr || e instanceof Dt || e instanceof de)
474
315
  return e.message;
475
- const t = Dt(e);
476
- return t ? Jr(t) : as(e);
316
+ const t = At(e);
317
+ return t ? Mr(t) : ns(e);
477
318
  }
478
- const Qr = "17.3.8", en = {
479
- version: Qr
319
+ const Wr = "17.3.10", Br = {
320
+ version: Wr
321
+ }, xt = 3600 * 1e3, Kr = 365 * 24 * xt, $ = {
322
+ /** Default limit for task listings */
323
+ TASKS_DEFAULT: 10,
324
+ /** Maximum limit for task search and list operations */
325
+ TASKS_MAX: 100,
326
+ /** Largest page of tasks the API returns, for reading past tasks a tool filters out */
327
+ TASKS_PAGE_MAX: 200,
328
+ /** Default limit for completed tasks */
329
+ COMPLETED_TASKS_DEFAULT: 50,
330
+ /** Maximum limit for completed tasks */
331
+ COMPLETED_TASKS_MAX: 200,
332
+ /** Default limit for project listings */
333
+ PROJECTS_DEFAULT: 50,
334
+ /** Maximum limit for project listings */
335
+ PROJECTS_MAX: 200,
336
+ /** Maximum limit for section listings */
337
+ SECTIONS_MAX: 200,
338
+ /** Page size for reading a workspace's folders */
339
+ FOLDERS_MAX: 200,
340
+ /** Batch size for fetching all tasks in a project */
341
+ TASKS_BATCH_SIZE: 50,
342
+ /** Maximum number of direct children returned when children are requested alongside an object */
343
+ CHILDREN_MAX: 25,
344
+ /** Default limit for comment listings */
345
+ COMMENTS_DEFAULT: 10,
346
+ /** Maximum limit for comment search and list operations */
347
+ COMMENTS_MAX: 10,
348
+ /** Maximum number of users a single comment can notify */
349
+ NOTIFY_USERS_MAX: 25,
350
+ /** Default limit for activity log listings */
351
+ ACTIVITY_DEFAULT: 20,
352
+ /** Maximum limit for activity log search and list operations */
353
+ ACTIVITY_MAX: 100,
354
+ /** Default limit for label listings */
355
+ LABELS_DEFAULT: 50,
356
+ /** Maximum limit for label listings */
357
+ LABELS_MAX: 200,
358
+ /** Maximum values in one list-valued filter parameter, such as labels or project IDs */
359
+ FILTER_VALUES_MAX: 50
360
+ }, _e = {
361
+ /** Maximum number of failures to show in detailed error messages */
362
+ MAX_FAILURES_SHOWN: 3
363
+ }, zr = {
364
+ /** Maximum number of failed items named in one log line */
365
+ MAX_FAILURES_LOGGED: 5
366
+ }, D = {
367
+ /** Maximum tasks accepted by one task update operation */
368
+ TASKS_PER_OPERATION: 25,
369
+ /**
370
+ * Maximum tasks one add-tasks call creates. They go out as one Sync request,
371
+ * which takes at most 100 commands.
372
+ */
373
+ TASK_CREATES_PER_OPERATION: 100,
374
+ /** Maximum projects, sections, comments, labels or filters created or updated by one call */
375
+ ITEMS_PER_OPERATION: 25,
376
+ /**
377
+ * Maximum existing objects one bulk action takes by ID, such as completing,
378
+ * rescheduling, reordering or assigning. A sync-backed reschedule sends one
379
+ * command per task, which keeps it under the Sync API's 100 commands per
380
+ * request. A reorder is not bounded that way: it can rekey every sibling of
381
+ * the objects it moves, so its command count depends on the sibling list.
382
+ */
383
+ BULK_ACTIONS_PER_OPERATION: 50,
384
+ /** Maximum labels set on one task by one call */
385
+ LABELS_PER_TASK: 50
386
+ }, ht = {
387
+ /**
388
+ * In-flight task-move requests per account, per process.
389
+ *
390
+ * Kept at 1 because the API locks the whole task tree for a move, and a tree
391
+ * spans a task's source as well as its destination — two moves of sibling
392
+ * subtasks contend even when they target different projects, and the loser
393
+ * fails. Batching same-destination moves into a single request means
394
+ * serialising costs little in practice. One per process is the smallest
395
+ * contribution a process can make; see the note above for the global picture.
396
+ */
397
+ TASK_MOVES: 1,
398
+ /** In-flight non-move write requests per account, per process. */
399
+ WRITES: 4,
400
+ /**
401
+ * How long a request may wait for a slot before it is abandoned unsent.
402
+ *
403
+ * Matches the SDK's own 30s request timeout, which only starts once a request
404
+ * actually goes out: a task that has already waited that long would be
405
+ * answering a caller who has given up. Comfortably above the worst realistic
406
+ * queue (serialised moves to 100 distinct destinations is roughly 15s).
407
+ */
408
+ QUEUE_WAIT_MS: 3e4
480
409
  };
481
- function no(e, { queueTimeoutMs: t = ut.QUEUE_WAIT_MS } = {}) {
410
+ function so(e, { queueTimeoutMs: t = ht.QUEUE_WAIT_MS } = {}) {
482
411
  if (!Number.isInteger(e) || e < 1)
483
412
  throw new Error(
484
413
  `maxConcurrent must be a positive integer, received ${String(e)}`
@@ -522,75 +451,75 @@ function no(e, { queueTimeoutMs: t = ut.QUEUE_WAIT_MS } = {}) {
522
451
  }
523
452
  function Ot() {
524
453
  return {
525
- moves: no(ut.TASK_MOVES),
526
- writes: no(ut.WRITES)
454
+ moves: so(ht.TASK_MOVES),
455
+ writes: so(ht.WRITES)
527
456
  };
528
457
  }
529
- const tn = 1e4, on = 5 * 6e4, Z = /* @__PURE__ */ new Map();
530
- let sn = tn;
531
- const cs = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new Map();
532
- let ao, io;
533
- function rn() {
534
- return ao ??= Ot(), ao;
458
+ const qr = 1e4, Gr = 5 * 6e4, Z = /* @__PURE__ */ new Map();
459
+ let Yr = qr;
460
+ const is = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new Map();
461
+ let ro, no;
462
+ function Vr() {
463
+ return ro ??= Ot(), ro;
535
464
  }
536
- function co() {
537
- return io ??= Ot(), io;
465
+ function ao() {
466
+ return no ??= Ot(), no;
538
467
  }
539
- function nn(e) {
468
+ function Jr(e) {
540
469
  return zo("sha256").update(e).digest("hex");
541
470
  }
542
- function an({ moves: e, writes: t }) {
471
+ function Xr({ moves: e, writes: t }) {
543
472
  return e.isIdle() && t.isIdle();
544
473
  }
545
- function ds(e) {
546
- return e.leases === 0 && an(e.limiters);
474
+ function cs(e) {
475
+ return e.leases === 0 && Xr(e.limiters);
547
476
  }
548
- function cn(e, t, o) {
477
+ function Zr(e, t, o) {
549
478
  Z.delete(e), t.lastUsedAt = o, Z.set(e, t);
550
479
  }
551
- function dn(e) {
480
+ function Qr(e) {
552
481
  for (const [t, o] of Z) {
553
- if (e - o.lastUsedAt < on)
482
+ if (e - o.lastUsedAt < Gr)
554
483
  break;
555
- ds(o) && Z.delete(t);
484
+ cs(o) && Z.delete(t);
556
485
  }
557
486
  }
558
- function ln() {
487
+ function en() {
559
488
  for (const [e, t] of Z)
560
- if (ds(t))
489
+ if (cs(t))
561
490
  return Z.delete(e), !0;
562
491
  return !1;
563
492
  }
564
- function ls(e, t) {
493
+ function ds(e, t) {
565
494
  if (le.has(e))
566
495
  return;
567
496
  const o = Z.get(e);
568
497
  if (o)
569
- return cn(e, o, t), o;
570
- if (dn(t), Z.size >= sn && !ln())
498
+ return Zr(e, o, t), o;
499
+ if (Qr(t), Z.size >= Yr && !en())
571
500
  return;
572
501
  const r = { limiters: Ot(), lastUsedAt: t, leases: 0 };
573
502
  return Z.set(e, r), r;
574
503
  }
575
- function un(e) {
504
+ function tn(e) {
576
505
  const t = le.get(e);
577
506
  if (t !== void 0)
578
507
  return le.set(e, t + 1), {
579
- limiters: co(),
580
- release: () => lo(e)
508
+ limiters: ao(),
509
+ release: () => io(e)
581
510
  };
582
- const o = ls(e, Date.now());
511
+ const o = ds(e, Date.now());
583
512
  return o ? (o.leases++, {
584
513
  limiters: o.limiters,
585
514
  release: () => {
586
515
  o.leases--;
587
516
  }
588
517
  }) : (le.set(e, 1), {
589
- limiters: co(),
590
- release: () => lo(e)
518
+ limiters: ao(),
519
+ release: () => io(e)
591
520
  });
592
521
  }
593
- function lo(e) {
522
+ function io(e) {
594
523
  const t = le.get(e);
595
524
  if (t === void 0 || t <= 1) {
596
525
  le.delete(e);
@@ -598,51 +527,51 @@ function lo(e) {
598
527
  }
599
528
  le.set(e, t - 1);
600
529
  }
601
- function pn(e, t) {
602
- const o = nn(t);
603
- cs.set(e, o);
530
+ function on(e, t) {
531
+ const o = Jr(t);
532
+ is.set(e, o);
604
533
  }
605
- function us(e, t) {
606
- const o = cs.get(e);
607
- return o ? (ls(o, Date.now()), async (r) => {
608
- const n = un(o);
534
+ function ls(e, t) {
535
+ const o = is.get(e);
536
+ return o ? (ds(o, Date.now()), async (r) => {
537
+ const n = tn(o);
609
538
  try {
610
539
  return await n.limiters[t](r);
611
540
  } finally {
612
541
  n.release();
613
542
  }
614
- }) : rn()[t];
543
+ }) : Vr()[t];
615
544
  }
616
- function hn(e) {
617
- return us(e, "moves");
545
+ function sn(e) {
546
+ return ls(e, "moves");
618
547
  }
619
548
  function _t(e) {
620
- return us(e, "writes");
549
+ return ls(e, "writes");
621
550
  }
622
- const mn = "todoist-mcp", Pt = en.version, ps = new wr(), uo = Tr(import.meta.url);
551
+ const rn = "todoist-mcp", Pt = Br.version, us = new wr(), co = Tr(import.meta.url);
623
552
  let He;
624
- const fn = async () => {
625
- const e = uo.resolve("@todoist/sdk"), t = ct(qo(e), "transport", "http-dispatcher.js");
626
- return uo(t);
553
+ const nn = async () => {
554
+ const e = co.resolve("@todoist/sdk"), t = ct(qo(e), "transport", "http-dispatcher.js");
555
+ return co(t);
627
556
  };
628
- let bn = fn;
629
- function gn() {
630
- return `${mn}/${Pt}`;
557
+ let an = nn;
558
+ function cn() {
559
+ return `${rn}/${Pt}`;
631
560
  }
632
- function hs(e) {
561
+ function ps(e) {
633
562
  return e.trim().toLowerCase();
634
563
  }
635
- function yn(e, t) {
636
- return ps.run(hs(e), t);
564
+ function dn(e, t) {
565
+ return us.run(ps(e), t);
637
566
  }
638
- function wn({
567
+ function ln({
639
568
  label: e,
640
569
  platform: t = "mcp",
641
570
  sessionId: o = Ce()
642
571
  } = {}) {
643
- const r = e ? hs(e) : ps.getStore();
572
+ const r = e ? ps(e) : us.getStore();
644
573
  return {
645
- "User-Agent": gn(),
574
+ "User-Agent": cn(),
646
575
  "doist-platform": t,
647
576
  "doist-version": Pt,
648
577
  "request-id": Ce(),
@@ -650,16 +579,16 @@ function wn({
650
579
  "mcp-tool": r ?? "unknown"
651
580
  };
652
581
  }
653
- function Tn(e, t) {
582
+ function un(e, t) {
654
583
  const o = new Headers(e);
655
- for (const [r, n] of Object.entries(wn(t)))
584
+ for (const [r, n] of Object.entries(ln(t)))
656
585
  o.set(r, n);
657
586
  return Object.fromEntries(o.entries());
658
587
  }
659
- function po() {
588
+ function lo() {
660
589
  return new DOMException("The operation was aborted due to timeout", "TimeoutError");
661
590
  }
662
- function kn(e, t) {
591
+ function pn(e, t) {
663
592
  if (!e && t === void 0)
664
593
  return {
665
594
  signal: void 0,
@@ -667,7 +596,7 @@ function kn(e, t) {
667
596
  }
668
597
  };
669
598
  if (!e && t !== void 0) {
670
- const i = new AbortController(), c = setTimeout(() => i.abort(po()), t);
599
+ const i = new AbortController(), c = setTimeout(() => i.abort(lo()), t);
671
600
  return {
672
601
  signal: i.signal,
673
602
  cleanup: () => clearTimeout(c)
@@ -688,7 +617,7 @@ function kn(e, t) {
688
617
  const i = () => n(e.reason);
689
618
  e.addEventListener("abort", i, { once: !0 }), r.push(() => e.removeEventListener("abort", i));
690
619
  }
691
- const a = setTimeout(() => n(po()), t);
620
+ const a = setTimeout(() => n(lo()), t);
692
621
  return r.push(() => clearTimeout(a)), {
693
622
  signal: o.signal,
694
623
  cleanup: () => {
@@ -697,26 +626,26 @@ function kn(e, t) {
697
626
  }
698
627
  };
699
628
  }
700
- async function In() {
701
- if (vn())
702
- return He || (He = bn().then((e) => e.getDefaultTransport()).catch((e) => {
629
+ async function hn() {
630
+ if (mn())
631
+ return He || (He = an().then((e) => e.getDefaultTransport()).catch((e) => {
703
632
  throw He = void 0, e;
704
633
  })), He;
705
634
  }
706
- function vn() {
635
+ function mn() {
707
636
  return typeof process < "u" && !!process.versions?.node;
708
637
  }
709
- async function ms(e, t) {
638
+ async function hs(e, t) {
710
639
  if ("dispatcher" in t)
711
640
  return e;
712
- const o = await In();
641
+ const o = await hn();
713
642
  return o ? (t.dispatcher = o.dispatcher, o.fetch ?? e) : e;
714
643
  }
715
- async function yh(e, t) {
644
+ async function Ih(e, t) {
716
645
  const o = { ...t };
717
- return (await ms(globalThis.fetch, o))(e, o);
646
+ return (await hs(globalThis.fetch, o))(e, o);
718
647
  }
719
- function Sn(e) {
648
+ function fn(e) {
720
649
  return {
721
650
  ok: e.ok,
722
651
  status: e.status,
@@ -727,33 +656,33 @@ function Sn(e) {
727
656
  arrayBuffer: () => e.arrayBuffer()
728
657
  };
729
658
  }
730
- function Cn(e = globalThis.fetch, t = {}) {
659
+ function bn(e = globalThis.fetch, t = {}) {
731
660
  const o = e === globalThis.fetch, { enabled: r = !0, platform: n = "mcp", sessionId: a = Ce() } = t;
732
661
  return async (i, c = {}) => {
733
- const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } = kn(l, d);
662
+ const { timeout: d, headers: u, signal: l, ...p } = c, { signal: f, cleanup: h } = pn(l, d);
734
663
  try {
735
664
  const m = {
736
665
  ...p,
737
666
  signal: f,
738
- ...r ? { headers: Tn(u, { platform: n, sessionId: a }) } : u !== void 0 ? { headers: u } : {}
739
- }, g = await (o ? await ms(e, m) : e)(i, m);
740
- return Sn(g);
667
+ ...r ? { headers: un(u, { platform: n, sessionId: a }) } : u !== void 0 ? { headers: u } : {}
668
+ }, g = await (o ? await hs(e, m) : e)(i, m);
669
+ return fn(g);
741
670
  } finally {
742
671
  h();
743
672
  }
744
673
  };
745
674
  }
746
- function jn(e, {
675
+ function gn(e, {
747
676
  baseUrl: t,
748
677
  tracking: o
749
678
  } = {}) {
750
679
  const r = new kr(e, {
751
- customFetch: Cn(globalThis.fetch, o),
680
+ customFetch: bn(globalThis.fetch, o),
752
681
  ...t ? { baseUrl: t } : {}
753
682
  });
754
- return pn(r, e), r;
683
+ return on(r, e), r;
755
684
  }
756
- const $n = 2, En = 500, An = 2e3, Dn = 50, xn = /* @__PURE__ */ new Set([502, 503, 504]), On = /* @__PURE__ */ new Set([503]);
685
+ const yn = 2, wn = 500, Tn = 2e3, kn = 50, In = /* @__PURE__ */ new Set([502, 503, 504]), vn = /* @__PURE__ */ new Set([503]);
757
686
  function qe(e) {
758
687
  if (e == null || typeof e != "object")
759
688
  return;
@@ -770,32 +699,32 @@ function qe(e) {
770
699
  return Number(o[1]);
771
700
  }
772
701
  }
773
- function _n(e, t = xn) {
702
+ function Sn(e, t = In) {
774
703
  const o = qe(e);
775
704
  return o !== void 0 && t.has(o);
776
705
  }
777
- function Pn({
706
+ function Cn({
778
707
  attempt: e,
779
708
  baseDelayMs: t,
780
709
  maxDelayMs: o,
781
710
  random: r = Math.random
782
711
  }) {
783
712
  const n = Math.min(t * 2 ** e, o), a = Math.round(r() * n);
784
- return Math.min(n, Math.max(Dn, a));
713
+ return Math.min(n, Math.max(kn, a));
785
714
  }
786
- function Rn(e) {
715
+ function jn(e) {
787
716
  return new Promise((t) => setTimeout(t, e));
788
717
  }
789
718
  async function j(e, t = {}) {
790
- const o = t.maxRetries ?? $n, r = t.baseDelayMs ?? En, n = t.maxDelayMs ?? An, a = t.random;
719
+ const o = t.maxRetries ?? yn, r = t.baseDelayMs ?? wn, n = t.maxDelayMs ?? Tn, a = t.random;
791
720
  let i;
792
721
  for (let c = 0; c <= o; c++)
793
722
  try {
794
723
  return await e();
795
724
  } catch (d) {
796
- if (i = d, c < o && _n(d, t.retryableStatusCodes)) {
797
- const u = Pn({ attempt: c, baseDelayMs: r, maxDelayMs: n, random: a });
798
- await Rn(u);
725
+ if (i = d, c < o && Sn(d, t.retryableStatusCodes)) {
726
+ const u = Cn({ attempt: c, baseDelayMs: r, maxDelayMs: n, random: a });
727
+ await jn(u);
799
728
  continue;
800
729
  }
801
730
  throw d;
@@ -803,7 +732,7 @@ async function j(e, t = {}) {
803
732
  throw i;
804
733
  }
805
734
  async function se(e, t = {}) {
806
- return j(e, { ...t, retryableStatusCodes: On });
735
+ return j(e, { ...t, retryableStatusCodes: vn });
807
736
  }
808
737
  const y = {
809
738
  // Task management tools
@@ -874,45 +803,45 @@ const y = {
874
803
  // OpenAI MCP tools
875
804
  SEARCH: "search",
876
805
  FETCH: "fetch"
877
- }, wh = {
806
+ }, vh = {
878
807
  /**
879
808
  * Strips email addresses from tool outputs that expose user data.
880
809
  * Affects: find-project-collaborators, find-completed-tasks
881
810
  */
882
811
  STRIP_EMAILS: "strip_emails"
883
- }, Un = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test", Nn = /* @__PURE__ */ new Set(["file"]);
884
- function Ln(e) {
812
+ }, $n = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test", En = /* @__PURE__ */ new Set(["file"]);
813
+ function An(e) {
885
814
  return !e || typeof e != "object" || Array.isArray(e) ? e : Object.fromEntries(
886
815
  Object.entries(e).map(
887
- ([t, o]) => Nn.has(t) && o !== void 0 ? [t, "[redacted]"] : [t, o]
816
+ ([t, o]) => En.has(t) && o !== void 0 ? [t, "[redacted]"] : [t, o]
888
817
  )
889
818
  );
890
819
  }
891
- const Mn = [
820
+ const Dn = [
892
821
  y.FIND_PROJECT_COLLABORATORS,
893
822
  y.FIND_COMPLETED_TASKS
894
823
  ];
895
- function gt(e) {
824
+ function mt(e) {
896
825
  if (e == null)
897
826
  return e;
898
827
  if (Array.isArray(e))
899
- return e.map((t) => gt(t));
828
+ return e.map((t) => mt(t));
900
829
  if (typeof e == "object") {
901
830
  const t = {};
902
831
  for (const [o, r] of Object.entries(e))
903
- o !== "email" && (t[o] = gt(r));
832
+ o !== "email" && (t[o] = mt(r));
904
833
  return t;
905
834
  }
906
835
  return e;
907
836
  }
908
- function Fn(e) {
837
+ function xn(e) {
909
838
  const t = /\s*\([^)]*@[^)]+\)/g, o = /\S+@\S+\.\S+/g;
910
839
  return e.replace(t, "").replace(o, "[email hidden]");
911
840
  }
912
- function Hn(e) {
913
- return Mn.includes(e);
841
+ function On(e) {
842
+ return Dn.includes(e);
914
843
  }
915
- function Wn({
844
+ function _n({
916
845
  tools: e,
917
846
  server: t,
918
847
  client: o,
@@ -921,23 +850,94 @@ function Wn({
921
850
  const n = r.some((i) => i.name === "strip_emails"), a = gr({
922
851
  titlePrefix: "Todoist",
923
852
  createContext: () => o,
924
- formatError: Zr,
925
- structuredContentAsText: !Un,
853
+ formatError: Hr,
854
+ structuredContentAsText: !$n,
926
855
  wrapExecute: async (i, c) => {
927
- const d = await yn(i.name, () => j(c));
928
- return !n || !Hn(i.name) ? d : {
856
+ const d = await dn(i.name, () => j(c));
857
+ return !n || !On(i.name) ? d : {
929
858
  ...d,
930
- textContent: d.textContent && Fn(d.textContent),
931
- structuredContent: d.structuredContent && gt(d.structuredContent)
859
+ textContent: d.textContent && xn(d.textContent),
860
+ structuredContent: d.structuredContent && mt(d.structuredContent)
932
861
  };
933
862
  },
934
863
  onError: ({ tool: i, args: c, error: d }) => {
935
- console.error(`Error executing tool ${i.name}:`, { args: Ln(c), error: d });
864
+ console.error(`Error executing tool ${i.name}:`, { args: An(c), error: d });
936
865
  }
937
866
  });
938
867
  for (const i of e)
939
868
  a(t, i);
940
869
  }
870
+ const uo = qo(br(import.meta.url)), Pn = [
871
+ ct(uo, "task-list", "index.html"),
872
+ ct(uo, "mcp-apps", "index.html")
873
+ ], Un = `<!doctype html>
874
+ <html>
875
+ <body>
876
+ <p>Task list app is missing. Run "npm run build" to generate it.</p>
877
+ </body>
878
+ </html>`;
879
+ function Rn() {
880
+ const e = [];
881
+ for (const t of Pn)
882
+ try {
883
+ return fr(t, "utf-8");
884
+ } catch (o) {
885
+ e.push(o);
886
+ }
887
+ return console.error("Failed to load task list app HTML from any known path:", e), Un;
888
+ }
889
+ const ms = Rn(), Nn = zo("sha256").update(ms).digest("hex").slice(0, 12), ft = `ui://todoist/task-list@${Nn}`, Ln = "ui://todoist/task-list@{hash}", bt = "Interactive task list widget", Mn = "https://ai.todoist.net", gt = {
890
+ ui: {
891
+ prefersBorder: !0,
892
+ csp: {
893
+ // The widget is bundled into one HTML file and does not fetch or load external assets.
894
+ connectDomains: [],
895
+ resourceDomains: []
896
+ }
897
+ },
898
+ "openai/widgetDescription": bt,
899
+ "openai/widgetPrefersBorder": !0,
900
+ "openai/widgetCSP": {
901
+ connect_domains: [],
902
+ resource_domains: []
903
+ },
904
+ "openai/widgetDomain": Mn
905
+ }, Fn = { ttlMs: Kr, cacheScope: "public" }, Hn = { ttlMs: xt, cacheScope: "private" };
906
+ function po(e) {
907
+ return {
908
+ contents: [
909
+ {
910
+ uri: e,
911
+ mimeType: dt,
912
+ text: ms,
913
+ _meta: gt
914
+ }
915
+ ]
916
+ };
917
+ }
918
+ function Wn(e) {
919
+ e.registerResource(
920
+ "todoist-task-list",
921
+ ft,
922
+ {
923
+ description: bt,
924
+ mimeType: dt,
925
+ _meta: gt,
926
+ cacheHint: Fn
927
+ },
928
+ async () => po(ft)
929
+ ), e.registerResource(
930
+ "todoist-task-list-hash-fallback",
931
+ new hr(Ln, { list: void 0 }),
932
+ {
933
+ description: `${bt} compatibility fallback`,
934
+ mimeType: dt,
935
+ _meta: gt,
936
+ cacheHint: Hn
937
+ },
938
+ async (t) => po(t.toString())
939
+ );
940
+ }
941
941
  const Bn = s.object({
942
942
  period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
943
943
  'Time period for the analysis. "today" analyzes the current day, "7d"/"14d"/"30d" analyze the last N days, "this-week" and "this-month" analyze the current week or month.'
@@ -1077,22 +1077,22 @@ const Ae = {
1077
1077
  argsSchema: Bn,
1078
1078
  callback: Gn
1079
1079
  }, fs = 'The duration of the task. Use format: "2h" (hours), "90m" (minutes), "2h30m" (combined), "1.5h" (decimal hours), or "3d" (whole days; days cannot be combined with hours or minutes). Todoist apps only display durations under 24 hours: a longer or day-based duration is stored and reported by this server, but the apps show the task as having no duration.', bs = 'Use format like "2h", "30m", "2h30m", "1.5h", or "3d"';
1080
- class U extends Error {
1080
+ class R extends Error {
1081
1081
  constructor(t, o) {
1082
1082
  super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
1083
1083
  }
1084
1084
  }
1085
1085
  function Yn(e) {
1086
1086
  if (!e || typeof e != "string")
1087
- throw new U(e, "Duration must be a non-empty string");
1087
+ throw new R(e, "Duration must be a non-empty string");
1088
1088
  const t = e.trim().toLowerCase().replace(/\s+/g, "");
1089
1089
  if (!t)
1090
- throw new U(e, "Duration must be a non-empty string");
1090
+ throw new R(e, "Duration must be a non-empty string");
1091
1091
  const o = t.match(/^(\d+(?:\.\d+)?)d$/)?.[1];
1092
1092
  if (o !== void 0)
1093
1093
  return { amount: Jn(e, o), unit: "day" };
1094
1094
  if (Vn(t))
1095
- throw new U(
1095
+ throw new R(
1096
1096
  e,
1097
1097
  `${bs} (days cannot be combined with hours or minutes)`
1098
1098
  );
@@ -1105,51 +1105,51 @@ const yt = "Duration is too large";
1105
1105
  function Jn(e, t) {
1106
1106
  const o = Number.parseFloat(t);
1107
1107
  if (Number.isNaN(o) || o < 0)
1108
- throw new U(e, "Days must be a positive number");
1108
+ throw new R(e, "Days must be a positive number");
1109
1109
  if (!Number.isFinite(o))
1110
- throw new U(e, yt);
1110
+ throw new R(e, yt);
1111
1111
  if (o % 1 !== 0)
1112
- throw new U(e, "Days must be a whole number");
1112
+ throw new R(e, "Days must be a whole number");
1113
1113
  if (o === 0)
1114
- throw new U(e, "Duration must be at least 1 day");
1114
+ throw new R(e, "Duration must be at least 1 day");
1115
1115
  return o;
1116
1116
  }
1117
1117
  function Xn(e, t) {
1118
1118
  const o = t.match(/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?$/);
1119
1119
  if (!o || !o[1] && !o[2])
1120
- throw new U(e, bs);
1120
+ throw new R(e, bs);
1121
1121
  let r = 0;
1122
1122
  const [, n, a] = o;
1123
1123
  if (n) {
1124
1124
  const i = Number.parseFloat(n);
1125
1125
  if (Number.isNaN(i) || i < 0)
1126
- throw new U(e, "Hours must be a positive number");
1126
+ throw new R(e, "Hours must be a positive number");
1127
1127
  r += i * 60;
1128
1128
  }
1129
1129
  if (a) {
1130
1130
  const i = Number.parseFloat(a);
1131
1131
  if (Number.isNaN(i) || i < 0)
1132
- throw new U(e, "Minutes must be a positive number");
1132
+ throw new R(e, "Minutes must be a positive number");
1133
1133
  if (!Number.isFinite(i))
1134
- throw new U(e, yt);
1134
+ throw new R(e, yt);
1135
1135
  if (i % 1 !== 0)
1136
- throw new U(
1136
+ throw new R(
1137
1137
  e,
1138
1138
  "Minutes must be a whole number (use decimal hours instead)"
1139
1139
  );
1140
1140
  r += i;
1141
1141
  }
1142
1142
  if (r = Math.round(r), !Number.isFinite(r))
1143
- throw new U(e, yt);
1143
+ throw new R(e, yt);
1144
1144
  if (r === 0)
1145
- throw new U(e, "Duration must be greater than 0 minutes");
1145
+ throw new R(e, "Duration must be greater than 0 minutes");
1146
1146
  return r;
1147
1147
  }
1148
- function Rt(e, t) {
1148
+ function Ut(e, t) {
1149
1149
  try {
1150
1150
  return Yn(t);
1151
1151
  } catch (o) {
1152
- throw o instanceof U ? new Error(`${e}: ${o.message}`) : o;
1152
+ throw o instanceof R ? new Error(`${e}: ${o.message}`) : o;
1153
1153
  }
1154
1154
  }
1155
1155
  function Zn(e, t = "minute") {
@@ -1159,7 +1159,7 @@ function Zn(e, t = "minute") {
1159
1159
  const o = Math.floor(e / 60), r = e % 60;
1160
1160
  return o === 0 ? `${r}m` : r === 0 ? `${o}h` : `${o}h${r}m`;
1161
1161
  }
1162
- const Qn = ["p1", "p2", "p3", "p4"], Ut = 'Task priority as a string: "p1" (highest), "p2" (high), "p3" (medium), or "p4" (lowest/default). Integers like 1, 2, 3, or 4 are not accepted.', Nt = s.enum(Qn).describe(Ut);
1162
+ const Qn = ["p1", "p2", "p3", "p4"], Rt = 'Task priority as a string: "p1" (highest), "p2" (high), "p3" (medium), or "p4" (lowest/default). Integers like 1, 2, 3, or 4 are not accepted.', Nt = s.enum(Qn).describe(Rt);
1163
1163
  function gs(e) {
1164
1164
  return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
1165
1165
  }
@@ -1763,7 +1763,7 @@ function P(e, t, o) {
1763
1763
  r.push({ item: i, index: c, value: d.value });
1764
1764
  return;
1765
1765
  }
1766
- const { summary: u, hint: l } = is(d?.reason);
1766
+ const { summary: u, hint: l } = as(d?.reason);
1767
1767
  let p = u;
1768
1768
  l && (p = a.has(l.tag) ? `${u}. Same cause and fix as the first ${l.tag} failure in this list.` : `${u}. ${l.text}`, a.add(l.tag)), n.push({ item: o(i, c), error: p });
1769
1769
  }), { succeeded: r, failures: n };
@@ -1772,7 +1772,7 @@ const go = "[redacted]", ma = /"[^"]*"/g;
1772
1772
  function O(e, t, o, r = {}) {
1773
1773
  if (o.length === 0)
1774
1774
  return;
1775
- const n = o.slice(0, Or.MAX_FAILURES_LOGGED);
1775
+ const n = o.slice(0, zr.MAX_FAILURES_LOGGED);
1776
1776
  console.error(`${e}: items failed`, {
1777
1777
  failed: o.length,
1778
1778
  of: t,
@@ -1978,7 +1978,7 @@ ${i.slice(0, _e.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
1978
1978
  return c.join(`
1979
1979
  `);
1980
1980
  }
1981
- function R(e, t) {
1981
+ function U(e, t) {
1982
1982
  if (t.length === 0)
1983
1983
  return e;
1984
1984
  const o = t.slice(0, _e.MAX_FAILURES_SHOWN), r = t.length - o.length, n = o.map((i) => ` ${i.item}: ${i.error}`).join(`
@@ -2112,7 +2112,7 @@ const $a = s.object({
2112
2112
  getCurrentUser: n
2113
2113
  });
2114
2114
  return {
2115
- textContent: R(
2115
+ textContent: U(
2116
2116
  _a({ comments: h, notifiedNames: m }),
2117
2117
  f
2118
2118
  ),
@@ -2204,7 +2204,7 @@ async function V(e, t, { limit: o = (r) => r() } = {}) {
2204
2204
  function Ds(e) {
2205
2205
  return e.description || void 0;
2206
2206
  }
2207
- const Ra = {
2207
+ const Ua = {
2208
2208
  search: s.string().optional().describe(
2209
2209
  "Search for a filter by name (partial and case insensitive match). If omitted, all filters are returned."
2210
2210
  )
@@ -2218,14 +2218,14 @@ const Ra = {
2218
2218
  color: $e,
2219
2219
  isFavorite: s.boolean().describe("Whether the filter is marked as favorite."),
2220
2220
  itemOrder: s.number().describe("The display order of the filter.")
2221
- }), Ua = {
2221
+ }), Ra = {
2222
2222
  filters: s.array(Gt).describe("The found filters."),
2223
2223
  totalCount: s.number().describe("The total number of filters returned.")
2224
2224
  }, Na = {
2225
2225
  name: y.FIND_FILTERS,
2226
2226
  description: 'List all personal filters or search for filters by name. Filters are saved custom views that use query syntax to organize tasks (e.g. "today & p1", "#Work & overdue").',
2227
- parameters: Ra,
2228
- outputSchema: Ua,
2227
+ parameters: Ua,
2228
+ outputSchema: Ra,
2229
2229
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2230
2230
  async execute(e, t) {
2231
2231
  let r = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((i) => !i.isDeleted);
@@ -2335,7 +2335,7 @@ const Ma = s.object({
2335
2335
  `), h = p > 0 ? `Added ${p} filter${p === 1 ? "" : "s"}:
2336
2336
  ${f}` : "Added 0 filters";
2337
2337
  return {
2338
- textContent: R(h, u),
2338
+ textContent: U(h, u),
2339
2339
  structuredContent: {
2340
2340
  filters: l,
2341
2341
  totalCount: l.length,
@@ -2421,7 +2421,7 @@ ${l}` + (d.length > 5 ? `
2421
2421
  this.stateByClient = /* @__PURE__ */ new WeakMap();
2422
2422
  }
2423
2423
  }
2424
- const Re = new za(), { ADD_PROJECTS: qa, LIST_WORKSPACES: Ga, UPDATE_PROJECTS: Ya } = y, Va = s.object({
2424
+ const Ue = new za(), { ADD_PROJECTS: qa, LIST_WORKSPACES: Ga, UPDATE_PROJECTS: Ya } = y, Va = s.object({
2425
2425
  name: s.string().min(1).describe("The name of the folder."),
2426
2426
  workspace: s.string().trim().min(1).describe(`The workspace to create the folder in, by name or ID (see ${Ga}).`)
2427
2427
  }), Ja = {
@@ -2441,7 +2441,7 @@ const Re = new za(), { ADD_PROJECTS: qa, LIST_WORKSPACES: Ga, UPDATE_PROJECTS: Y
2441
2441
  const o = /* @__PURE__ */ new Map(), r = (d) => {
2442
2442
  let u = o.get(d);
2443
2443
  return u || (u = j(
2444
- () => Re.resolveWorkspace(t, d)
2444
+ () => Ue.resolveWorkspace(t, d)
2445
2445
  ).then(({ workspaceId: l }) => l), o.set(d, u)), u;
2446
2446
  }, n = await Promise.allSettled(
2447
2447
  e.map(async ({ name: d, workspace: u }) => {
@@ -2466,7 +2466,7 @@ function Qa(e, t) {
2466
2466
  ), n = o > 0 ? `Added ${o} folder${o === 1 ? "" : "s"}:
2467
2467
  ${r.join(`
2468
2468
  `)}` : "Added 0 folders";
2469
- return R(n, t);
2469
+ return U(n, t);
2470
2470
  }
2471
2471
  const ei = s.object({
2472
2472
  name: s.string().min(1).max(128).describe("The name of the label."),
@@ -2512,7 +2512,7 @@ function ri({
2512
2512
  const o = e.length, r = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
2513
2513
  `), n = o > 0 ? `Added ${o} label${o === 1 ? "" : "s"}:
2514
2514
  ${r}` : "Added 0 labels";
2515
- return R(n, t);
2515
+ return U(n, t);
2516
2516
  }
2517
2517
  async function Yt(e, t) {
2518
2518
  try {
@@ -2570,7 +2570,7 @@ const { FIND_FOLDERS: ni } = y, ai = s.object({
2570
2570
  return Promise.resolve(void 0);
2571
2571
  let w = o.get(g);
2572
2572
  return w || (w = j(
2573
- () => Re.resolveWorkspace(t, g)
2573
+ () => Ue.resolveWorkspace(t, g)
2574
2574
  ).then(({ workspaceId: I }) => I), o.set(g, w)), w;
2575
2575
  }, i = (g) => {
2576
2576
  let w = r.get(g);
@@ -2709,7 +2709,7 @@ function mi({
2709
2709
  const o = e.length, r = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
2710
2710
  `), n = o > 0 ? `Added ${o} project${o === 1 ? "" : "s"}:
2711
2711
  ${r}` : "Added 0 projects";
2712
- return R(n, t);
2712
+ return U(n, t);
2713
2713
  }
2714
2714
  async function xs(e, t) {
2715
2715
  const o = /* @__PURE__ */ new Map();
@@ -2746,10 +2746,10 @@ const Be = 25, Je = s.enum(Cr), _s = s.object({
2746
2746
  string: s.string().optional().describe('Natural language due string, e.g. "tomorrow at 3pm".'),
2747
2747
  timezone: s.string().optional().describe('Timezone for the reminder, e.g. "America/New_York".'),
2748
2748
  lang: s.string().optional().describe('Language for parsing the due string, e.g. "en".')
2749
- }), Ps = s.enum(Yo), Xe = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), Rs = `Who to remind: user ID, email, name, or "me". Must collaborate on the task's project.`, Jt = H(
2750
- `${Rs} Defaults to the creator.`
2749
+ }), Ps = s.enum(Yo), Xe = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), Us = `Who to remind: user ID, email, name, or "me". Must collaborate on the task's project.`, Jt = H(
2750
+ `${Us} Defaults to the creator.`
2751
2751
  ), Xt = H(
2752
- `${Rs} Omit to keep the current one.`
2752
+ `${Us} Omit to keep the current one.`
2753
2753
  ), fi = s.object({
2754
2754
  type: s.literal("relative"),
2755
2755
  taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
@@ -2864,7 +2864,7 @@ const Be = 25, Je = s.enum(Cr), _s = s.object({
2864
2864
  return p?.status === "fulfilled" ? p.value : void 0;
2865
2865
  });
2866
2866
  return O(y.ADD_REMINDERS, o.length, i), {
2867
- textContent: R(
2867
+ textContent: U(
2868
2868
  [
2869
2869
  Ii(c),
2870
2870
  ...Os(c, d)
@@ -2952,7 +2952,7 @@ function $i({
2952
2952
  const o = e.length, r = e.map((a) => `• ${a.name} (id=${a.id}, projectId=${a.projectId})`).join(`
2953
2953
  `), n = o > 0 ? `Added ${o} section${o === 1 ? "" : "s"}:
2954
2954
  ${r}` : "Added 0 sections";
2955
- return R(n, t);
2955
+ return U(n, t);
2956
2956
  }
2957
2957
  const Te = {
2958
2958
  USER_NOT_FOUND: "USER_NOT_FOUND",
@@ -3176,7 +3176,7 @@ const Zt = new Ei(), wo = D.TASK_CREATES_PER_OPERATION, Ai = s.object({
3176
3176
  description: H(
3177
3177
  "Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."
3178
3178
  ),
3179
- priority: Nt.optional().describe(Ut),
3179
+ priority: Nt.optional().describe(Rt),
3180
3180
  dueString: H(
3181
3181
  'The due date for the task, in natural language. Also use natural language for recurrences; do not prefix it with "recurring".'
3182
3182
  ),
@@ -3222,7 +3222,7 @@ const Zt = new Ei(), wo = D.TASK_CREATES_PER_OPERATION, Ai = s.object({
3222
3222
  const { tasks: o } = s.object(To).parse(e), r = Oi(t), n = await Promise.allSettled(o.map((h) => _i(h, r))), a = n.flatMap((h, m) => {
3223
3223
  const b = o[m];
3224
3224
  return h.status === "fulfilled" && b ? [{ index: m, task: b, ...h.value }] : [];
3225
- }), i = await Ri(t, a), c = n.map(
3225
+ }), i = await Ui(t, a), c = n.map(
3226
3226
  (h, m) => h.status === "rejected" ? h : i.get(m) ?? {
3227
3227
  status: "rejected",
3228
3228
  reason: new Error("Todoist did not report whether this task was created")
@@ -3296,7 +3296,7 @@ async function _i(e, t) {
3296
3296
  throw new Error(
3297
3297
  `Task "${o}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
3298
3298
  );
3299
- const g = n ? Rt(`Task "${o}"`, n) : void 0;
3299
+ const g = n ? Ut(`Task "${o}"`, n) : void 0;
3300
3300
  let w;
3301
3301
  u && (w = await Pi(e, t, b));
3302
3302
  const I = Ce();
@@ -3346,7 +3346,7 @@ async function Pi(e, t, o) {
3346
3346
  }
3347
3347
  return d.resolvedUser?.userId;
3348
3348
  }
3349
- async function Ri(e, t) {
3349
+ async function Ui(e, t) {
3350
3350
  const o = /* @__PURE__ */ new Map();
3351
3351
  if (t.length === 0)
3352
3352
  return o;
@@ -3361,7 +3361,7 @@ async function Ri(e, t) {
3361
3361
  status: "rejected",
3362
3362
  // Only Todoist's answer about this task's own command can blame its
3363
3363
  // due string; a failed request says nothing about any one task.
3364
- reason: a ? h?.reason : Ui(h?.reason, l)
3364
+ reason: a ? h?.reason : Ri(h?.reason, l)
3365
3365
  });
3366
3366
  return;
3367
3367
  }
@@ -3407,13 +3407,13 @@ async function Ri(e, t) {
3407
3407
  }
3408
3408
  return o;
3409
3409
  }
3410
- function Ui(e, t) {
3411
- const o = Xr(e, {
3410
+ function Ri(e, t) {
3411
+ const o = Fr(e, {
3412
3412
  taskContent: t.content,
3413
3413
  dueString: t.dueString,
3414
3414
  deadlineDate: t.deadlineDate
3415
3415
  });
3416
- return o ? new xt(o) : e;
3416
+ return o ? new Dt(o) : e;
3417
3417
  }
3418
3418
  const ko = "* ";
3419
3419
  function Ni(e) {
@@ -3598,7 +3598,7 @@ function Yi({
3598
3598
  failures: t
3599
3599
  });
3600
3600
  }
3601
- const Us = [
3601
+ const Rs = [
3602
3602
  "project",
3603
3603
  "section",
3604
3604
  "task",
@@ -3609,11 +3609,11 @@ const Us = [
3609
3609
  "reminder",
3610
3610
  "location_reminder"
3611
3611
  ], Vi = {
3612
- type: s.enum(Us).describe("The type of entity to delete."),
3612
+ type: s.enum(Rs).describe("The type of entity to delete."),
3613
3613
  id: s.string().min(1).describe("The ID of the entity to delete.")
3614
3614
  }, Ji = {
3615
3615
  deletedEntity: s.object({
3616
- type: s.enum(Us).describe("The type of deleted entity."),
3616
+ type: s.enum(Rs).describe("The type of deleted entity."),
3617
3617
  id: s.string().describe("The ID of the deleted entity.")
3618
3618
  }).describe("Information about the deleted entity."),
3619
3619
  success: s.boolean().describe("Whether the deletion was successful.")
@@ -4022,14 +4022,21 @@ const mc = {
4022
4022
  cursor: p ?? null
4023
4023
  };
4024
4024
  o && n ? f.objectEventTypes = `${o}:${n}` : o ? f.objectEventTypes = `${o}:` : n && (f.objectEventTypes = `:${n}`), r && r !== "remove" && (f.objectId = r), a && (f.parentProjectId = a), i && (f.parentItemId = i), c && (f.initiatorId = c), d && (f.dateFrom = d), u && (f.dateTo = u);
4025
- const { results: h, nextCursor: m } = await t.getActivityLogs(f), b = h.map(pa), g = await M.getUserShortNames(
4025
+ const { results: h, nextCursor: m } = await t.getActivityLogs(f), b = h.map(pa), g = b.length > 0 ? await wc(t) : void 0, w = Tc(g), I = await M.getUserShortNames(
4026
4026
  t,
4027
4027
  b.flatMap(
4028
- (I) => I.initiatorId && I.parentProjectId ? [I.parentProjectId] : []
4029
- )
4028
+ (S) => S.initiatorId && S.parentProjectId ? [S.parentProjectId] : []
4029
+ ),
4030
+ g?.id ?? null
4030
4031
  );
4031
4032
  return {
4032
- textContent: gc({ events: b, args: e, nextCursor: m, initiatorNames: g }),
4033
+ textContent: kc({
4034
+ events: b,
4035
+ args: e,
4036
+ nextCursor: m,
4037
+ initiatorNames: I,
4038
+ timeZone: w
4039
+ }),
4033
4040
  structuredContent: {
4034
4041
  events: b,
4035
4042
  nextCursor: m ?? void 0,
@@ -4039,77 +4046,101 @@ const mc = {
4039
4046
  }
4040
4047
  };
4041
4048
  }
4042
- };
4043
- function gc({
4049
+ }, gc = "UTC";
4050
+ function yc(e) {
4051
+ try {
4052
+ return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
4053
+ } catch {
4054
+ return !1;
4055
+ }
4056
+ }
4057
+ async function wc(e) {
4058
+ try {
4059
+ return await j(() => e.getUser());
4060
+ } catch (t) {
4061
+ return console.error(
4062
+ `${y.FIND_ACTIVITY}: could not load the user's time zone, using UTC`,
4063
+ t
4064
+ ), null;
4065
+ }
4066
+ }
4067
+ function Tc(e) {
4068
+ const t = e?.tzInfo?.timezone;
4069
+ return t && yc(t) ? t : gc;
4070
+ }
4071
+ function kc({
4044
4072
  events: e,
4045
4073
  args: t,
4046
4074
  nextCursor: o,
4047
- initiatorNames: r
4075
+ initiatorNames: r,
4076
+ timeZone: n
4048
4077
  }) {
4049
- let n = "Activity events";
4050
- const a = [];
4051
- if (t.eventType && a.push(`${t.eventType}`), t.objectType) {
4052
- const d = t.objectType === "task" ? "tasks" : `${t.objectType}s`;
4053
- a.push(d);
4054
- }
4055
- a.length > 0 && (n = `Activity: ${a.join(" ")}`);
4078
+ let a = "Activity events";
4056
4079
  const i = [];
4057
- t.objectId && i.push(`object ID: ${t.objectId}`), t.projectId && i.push(`project: ${t.projectId}`), t.taskId && i.push(`task: ${t.taskId}`), t.initiatorId && i.push(`initiator: ${t.initiatorId}`), t.dateFrom && i.push(`from: ${t.dateFrom}`), t.dateTo && i.push(`until (exclusive): ${t.dateTo}`);
4080
+ if (t.eventType && i.push(`${t.eventType}`), t.objectType) {
4081
+ const u = t.objectType === "task" ? "tasks" : `${t.objectType}s`;
4082
+ i.push(u);
4083
+ }
4084
+ i.length > 0 && (a = `Activity: ${i.join(" ")}`);
4058
4085
  const c = [];
4059
- return e.length === 0 && (c.push("No activity events match the specified filters"), c.push("Note: Activity logs only show recent events"), t.eventType && c.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && c.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && c.push("Verify the object ID is correct")), oe({
4060
- subject: n,
4086
+ t.objectId && c.push(`object ID: ${t.objectId}`), t.projectId && c.push(`project: ${t.projectId}`), t.taskId && c.push(`task: ${t.taskId}`), t.initiatorId && c.push(`initiator: ${t.initiatorId}`), t.dateFrom && c.push(`from: ${t.dateFrom}`), t.dateTo && c.push(`until (exclusive): ${t.dateTo}`);
4087
+ const d = [];
4088
+ return e.length === 0 && (d.push("No activity events match the specified filters"), d.push("Note: Activity logs only show recent events"), t.eventType && d.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && d.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && d.push("Verify the object ID is correct")), oe({
4089
+ subject: a,
4061
4090
  count: e.length,
4062
4091
  limit: t.limit,
4063
4092
  nextCursor: o ?? void 0,
4064
- filterHints: i,
4065
- previewLines: yc(
4093
+ filterHints: c,
4094
+ notes: e.length > 0 ? [`Times are in ${n}.`] : void 0,
4095
+ previewLines: Ic(
4066
4096
  e,
4067
4097
  r,
4098
+ n,
4068
4099
  Math.min(e.length, t.limit)
4069
4100
  ),
4070
- zeroReasonHints: c
4101
+ zeroReasonHints: d
4071
4102
  });
4072
4103
  }
4073
- function yc(e, t, o = 10) {
4074
- const n = e.slice(0, o).map((a) => wc(a, t)).join(`
4104
+ function Ic(e, t, o, r = 10) {
4105
+ const a = e.slice(0, r).map((i) => vc(i, t, o)).join(`
4075
4106
  `);
4076
- if (e.length > o) {
4077
- const a = e.length - o;
4078
- return `${n}
4079
- ... and ${a} more event${a === 1 ? "" : "s"}`;
4107
+ if (e.length > r) {
4108
+ const i = e.length - r;
4109
+ return `${a}
4110
+ ... and ${i} more event${i === 1 ? "" : "s"}`;
4080
4111
  }
4081
- return n;
4112
+ return a;
4082
4113
  }
4083
- function wc(e, t) {
4084
- const o = Tc(e.eventDate), r = `${e.eventType} ${e.objectType}`;
4085
- let n = "";
4114
+ function vc(e, t, o) {
4115
+ const r = Sc(e.eventDate, o), n = `${e.eventType} ${e.objectType}`;
4116
+ let a = "";
4086
4117
  if (e.extraData) {
4087
- const d = e.extraData.content || e.extraData.name || e.extraData.last_content;
4088
- d && typeof d == "string" && (n = ` • "${d.length > 50 ? `${d.substring(0, 47)}...` : d}"`);
4118
+ const u = e.extraData.content || e.extraData.name || e.extraData.last_content;
4119
+ u && typeof u == "string" && (a = ` • "${u.length > 50 ? `${u.substring(0, 47)}...` : u}"`);
4089
4120
  }
4090
- const a = e.objectId ? ` • id=${e.objectId}` : "";
4091
- let i = " • system";
4121
+ const i = e.objectId ? ` • id=${e.objectId}` : "";
4122
+ let c = " • system";
4092
4123
  if (e.initiatorId) {
4093
- const d = t.get(e.initiatorId);
4094
- i = d ? ` • by ${d}` : ` • by=${e.initiatorId}`;
4124
+ const u = t.get(e.initiatorId);
4125
+ c = u ? ` • by ${u}` : ` • by=${e.initiatorId}`;
4095
4126
  }
4096
- const c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
4097
- return ` [${o}] ${r}${n}${a}${i}${c}`;
4127
+ const d = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
4128
+ return ` [${r}] ${n}${a}${i}${c}${d}`;
4098
4129
  }
4099
- function Tc(e) {
4130
+ function Sc(e, t) {
4100
4131
  try {
4101
- const t = new Date(e), o = t.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" }), r = t.toLocaleDateString("en-US", { day: "numeric", timeZone: "UTC" }), n = t.toLocaleTimeString("en-US", {
4132
+ const o = new Date(e), r = o.toLocaleDateString("en-US", { month: "short", timeZone: t }), n = o.toLocaleDateString("en-US", { day: "numeric", timeZone: t }), a = o.toLocaleTimeString("en-US", {
4102
4133
  hour: "2-digit",
4103
4134
  minute: "2-digit",
4104
- hour12: !1,
4105
- timeZone: "UTC"
4135
+ hourCycle: "h23",
4136
+ timeZone: t
4106
4137
  });
4107
- return `${o} ${r}, ${n}`;
4138
+ return `${r} ${n}, ${a}`;
4108
4139
  } catch {
4109
4140
  return e;
4110
4141
  }
4111
4142
  }
4112
- const kc = {
4143
+ const Cc = {
4113
4144
  taskId: s.string().optional().describe("Find comments for a specific task."),
4114
4145
  projectId: s.string().optional().describe(
4115
4146
  'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
@@ -4117,7 +4148,7 @@ const kc = {
4117
4148
  commentId: s.string().optional().describe("Get a specific comment by ID."),
4118
4149
  cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
4119
4150
  limit: s.number().int().min(1).max($.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
4120
- }, Ic = {
4151
+ }, jc = {
4121
4152
  comments: s.array(Le).describe("The found comments."),
4122
4153
  searchType: s.string().describe(
4123
4154
  'The type of search performed: "single" (comment ID), "task" (task ID), or "project" (project ID).'
@@ -4126,11 +4157,11 @@ const kc = {
4126
4157
  hasMore: s.boolean(),
4127
4158
  nextCursor: s.string().optional(),
4128
4159
  totalCount: s.number().describe("The total number of comments in this page.")
4129
- }, vc = {
4160
+ }, $c = {
4130
4161
  name: y.FIND_COMMENTS,
4131
4162
  description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
4132
- parameters: kc,
4133
- outputSchema: Ic,
4163
+ parameters: Cc,
4164
+ outputSchema: jc,
4134
4165
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4135
4166
  async execute(e, t) {
4136
4167
  const o = Ge(e.cursor), r = [e.taskId, e.projectId, e.commentId].filter(Boolean);
@@ -4165,7 +4196,7 @@ const kc = {
4165
4196
  throw new Error("Invalid state: no search parameter provided");
4166
4197
  const d = c.map(Ne);
4167
4198
  return {
4168
- textContent: Sc({
4199
+ textContent: Ec({
4169
4200
  comments: d,
4170
4201
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
4171
4202
  searchId: e.commentId || e.taskId || e.projectId || "",
@@ -4183,7 +4214,7 @@ const kc = {
4183
4214
  };
4184
4215
  }
4185
4216
  };
4186
- function Sc({
4217
+ function Ec({
4187
4218
  comments: e,
4188
4219
  searchType: t,
4189
4220
  searchId: o,
@@ -4224,18 +4255,18 @@ function Fs(e, t) {
4224
4255
  const o = new Date(e.getTime() + t * 60 * 1e3);
4225
4256
  return Ms(o);
4226
4257
  }
4227
- function Ue(e, t) {
4258
+ function Re(e, t) {
4228
4259
  const [o, r, n] = e.split("-"), a = Number(o), i = Number(r), c = Number(n);
4229
4260
  if (!Number.isFinite(a) || !Number.isFinite(i) || !Number.isFinite(c))
4230
4261
  throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD.`);
4231
4262
  const d = new Date(Date.UTC(a, i - 1, c));
4232
4263
  return d.setUTCDate(d.getUTCDate() + t), Ms(d);
4233
4264
  }
4234
- function Cc(e) {
4265
+ function Ac(e) {
4235
4266
  const t = e < 0 ? "-" : "+", o = Math.abs(e), r = String(Math.floor(o / 60)).padStart(2, "0"), n = String(o % 60).padStart(2, "0");
4236
4267
  return `${t}${r}:${n}`;
4237
4268
  }
4238
- function jc(e, t) {
4269
+ function Dc(e, t) {
4239
4270
  try {
4240
4271
  const o = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "longOffset" }).formatToParts(e).find((r) => r.type === "timeZoneName")?.value;
4241
4272
  return o === void 0 ? void 0 : o === "GMT" ? 0 : Ze(o.slice(3));
@@ -4251,16 +4282,16 @@ function Hs({
4251
4282
  }) {
4252
4283
  const r = (l) => `${e}T00:00:00${l}`, n = Date.parse(`${e}T00:00:00Z`);
4253
4284
  if (!t || Number.isNaN(n)) return r(o);
4254
- const a = (l) => jc(l, t), i = a(n - 840 * st), c = a(n + 840 * st);
4285
+ const a = (l) => Dc(l, t), i = a(n - 840 * st), c = a(n + 840 * st);
4255
4286
  if (i === void 0 || c === void 0) return r(o);
4256
4287
  const d = [.../* @__PURE__ */ new Set([i, c])].filter(
4257
4288
  (l) => a(n - l * st) === l
4258
4289
  ), u = d.length > 0 ? Math.max(...d) : i;
4259
- return r(Cc(u));
4290
+ return r(Ac(u));
4260
4291
  }
4261
- const $c = ["and", "or"], Qt = {
4292
+ const xc = ["and", "or"], Qt = {
4262
4293
  labels: s.string().array().max($.FILTER_VALUES_MAX).optional().describe("The labels to filter the tasks by"),
4263
- labelsOperator: s.enum($c).optional().describe(
4294
+ labelsOperator: s.enum(xc).optional().describe(
4264
4295
  'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
4265
4296
  )
4266
4297
  };
@@ -4276,31 +4307,31 @@ function eo(e = [], t = "or") {
4276
4307
  function Ke(e) {
4277
4308
  return e.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").toLowerCase();
4278
4309
  }
4279
- function Ec(e, t, o = "or") {
4310
+ function Oc(e, t, o = "or") {
4280
4311
  const r = new Set(e.map(Ke)), n = t.map((a) => Ke(Qe(a)));
4281
4312
  return o === "and" ? n.every((a) => r.has(a)) : n.some((a) => r.has(a));
4282
4313
  }
4283
- function Ac(e, t) {
4314
+ function _c(e, t) {
4284
4315
  const o = Ke(Qe(e)), r = new Set(t.filter((n) => Ke(n) === o));
4285
4316
  return r.size === 1 ? [...r][0] : void 0;
4286
4317
  }
4287
4318
  function Ie(e, t = "or") {
4288
4319
  return e.map((o) => `@${Qe(o)}`).join(t === "and" ? " & " : " | ");
4289
4320
  }
4290
- const { FIND_ACTIVITY: $o } = y, Dc = 7;
4291
- function xc({
4321
+ const { FIND_ACTIVITY: $o } = y, Pc = 7;
4322
+ function Uc({
4292
4323
  since: e,
4293
4324
  until: t,
4294
4325
  userGmtOffset: o,
4295
4326
  now: r = /* @__PURE__ */ new Date()
4296
4327
  }) {
4297
- const n = Ze(o), a = Fs(r, n), i = Dc - 1, c = t ?? (e ? Ue(e, i) : a);
4328
+ const n = Ze(o), a = Fs(r, n), i = Pc - 1, c = t ?? (e ? Re(e, i) : a);
4298
4329
  return {
4299
- since: e ?? Ue(c, -i),
4330
+ since: e ?? Re(c, -i),
4300
4331
  until: c
4301
4332
  };
4302
4333
  }
4303
- const Oc = {
4334
+ const Rc = {
4304
4335
  getBy: s.enum(["completion", "due"]).default("completion").describe(
4305
4336
  'The method to use to get the tasks: "completion" to get tasks by completion date (ie, when the task was actually completed), "due" to get tasks by due date (ie, when the task was due to be completed by).'
4306
4337
  ),
@@ -4324,17 +4355,17 @@ const Oc = {
4324
4355
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
4325
4356
  ),
4326
4357
  ...Qt
4327
- }, _c = {
4358
+ }, Nc = {
4328
4359
  tasks: s.array(te).describe("The found completed tasks."),
4329
4360
  nextCursor: s.string().optional(),
4330
4361
  totalCount: s.number().describe("The total number of tasks in this page."),
4331
4362
  hasMore: s.boolean(),
4332
4363
  appliedFilters: s.record(s.string(), s.unknown())
4333
- }, Pc = {
4364
+ }, Lc = {
4334
4365
  name: y.FIND_COMPLETED_TASKS,
4335
4366
  description: 'Get completed tasks in a date range. Neither getBy mode returns completions of a recurring task that is still active. For "what did I complete/get done" questions, or whenever recurring work should count, use find-activity instead — it reports completion events, including every occurrence of a recurring task. since/until are optional and default to a 7-day window when omitted. Includes all collaborators by default. Person-specific queries (summaries, plans, reports) require responsibleUser.',
4336
- parameters: Oc,
4337
- outputSchema: _c,
4367
+ parameters: Rc,
4368
+ outputSchema: Nc,
4338
4369
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4339
4370
  async execute(e, t) {
4340
4371
  const {
@@ -4358,12 +4389,12 @@ const Oc = {
4358
4389
  const g = await t.getUser(), w = g.tzInfo?.gmtString || "+00:00", I = await pe({
4359
4390
  projectId: d,
4360
4391
  user: g
4361
- }), k = xc({
4392
+ }), k = Uc({
4362
4393
  since: a,
4363
4394
  until: i,
4364
4395
  userGmtOffset: w
4365
4396
  }), S = g.tzInfo?.timezone, E = (oo) => new Date(Hs({ date: oo, timeZone: S, fallbackOffset: w })), N = E(k.since).toISOString(), T = new Date(
4366
- E(Ue(k.until, 1)).getTime() - 1e3
4397
+ E(Re(k.until, 1)).getTime() - 1e3
4367
4398
  ).toISOString(), v = {
4368
4399
  ...e,
4369
4400
  since: k.since,
@@ -4384,7 +4415,7 @@ const Oc = {
4384
4415
  ...b ? { filterQuery: b, filterLang: "en" } : {}
4385
4416
  }), L = A.map(z);
4386
4417
  return {
4387
- textContent: Rc({
4418
+ textContent: Mc({
4388
4419
  tasks: L,
4389
4420
  args: v,
4390
4421
  userGmtOffset: w,
@@ -4403,7 +4434,7 @@ const Oc = {
4403
4434
  };
4404
4435
  }
4405
4436
  };
4406
- function Rc({
4437
+ function Mc({
4407
4438
  tasks: e,
4408
4439
  args: t,
4409
4440
  userGmtOffset: o,
@@ -4432,52 +4463,52 @@ function Rc({
4432
4463
  // completing it, so the completed-tasks endpoints never return it while the
4433
4464
  // recurrence is active. Nothing in the response can show the gap, so say it
4434
4465
  // on every result rather than only when the list is empty.
4435
- notes: [Uc(t, o, r)],
4466
+ notes: [Fc(t, o, r)],
4436
4467
  previewLines: Ve(e, Math.min(e.length, t.limit), i),
4437
4468
  zeroReasonHints: l
4438
4469
  });
4439
4470
  }
4440
- function Uc(e, t, o) {
4471
+ function Fc(e, t, o) {
4441
4472
  const r = "Completions of recurring tasks that are still active are not in this list.";
4442
4473
  if (e.getBy === "due")
4443
4474
  return `${r} ${$o} with objectType "task" and eventType "completed" reports them, but only by completion time: it cannot match a due-date range.`;
4444
- const n = (c) => Hs({ date: c, timeZone: o, fallbackOffset: t }), a = n(e.since), i = n(Ue(e.until, 1));
4475
+ const n = (c) => Hs({ date: c, timeZone: o, fallbackOffset: t }), a = n(e.since), i = n(Re(e.until, 1));
4445
4476
  return `${r} To include them, call ${$o} with objectType "task", eventType "completed", dateFrom "${a}" and dateTo "${i}".`;
4446
4477
  }
4447
- const { ADD_FOLDERS: Nc, FIND_PROJECTS: Lc, LIST_WORKSPACES: Mc } = y, Fc = {
4478
+ const { ADD_FOLDERS: Hc, FIND_PROJECTS: Wc, LIST_WORKSPACES: Bc } = y, Kc = {
4448
4479
  workspace: s.string().trim().min(1).optional().describe(
4449
- `The workspace to list folders for, by name or ID (see ${Mc}). Omit to list the folders of every workspace.`
4480
+ `The workspace to list folders for, by name or ID (see ${Bc}). Omit to list the folders of every workspace.`
4450
4481
  )
4451
- }, Hc = {
4482
+ }, zc = {
4452
4483
  folders: s.array(Wt).describe("In sidebar order within each workspace."),
4453
4484
  totalCount: s.number()
4454
- }, Wc = {
4485
+ }, qc = {
4455
4486
  name: y.FIND_FOLDERS,
4456
- description: `List the folders that group a workspace's projects. Only workspace projects go in folders; personal projects nest under a parent project instead. To see a folder's projects, use ${Lc} with folderId.`,
4457
- parameters: Fc,
4458
- outputSchema: Hc,
4487
+ description: `List the folders that group a workspace's projects. Only workspace projects go in folders; personal projects nest under a parent project instead. To see a folder's projects, use ${Wc} with folderId.`,
4488
+ parameters: Kc,
4489
+ outputSchema: zc,
4459
4490
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4460
4491
  async execute({ workspace: e }, t) {
4461
- const o = e ? [await Re.resolveWorkspace(t, e)] : await Re.listWorkspaces(t), r = await Promise.all(
4492
+ const o = e ? [await Ue.resolveWorkspace(t, e)] : await Ue.listWorkspaces(t), r = await Promise.all(
4462
4493
  o.map(async (a) => ({
4463
4494
  ...a,
4464
- folders: await Bc(t, a.workspaceId)
4495
+ folders: await Gc(t, a.workspaceId)
4465
4496
  }))
4466
4497
  ), n = r.flatMap((a) => a.folders);
4467
4498
  return {
4468
- textContent: Kc(r),
4499
+ textContent: Yc(r),
4469
4500
  structuredContent: { folders: n, totalCount: n.length }
4470
4501
  };
4471
4502
  }
4472
4503
  };
4473
- async function Bc(e, t) {
4504
+ async function Gc(e, t) {
4474
4505
  return (await F({
4475
4506
  apiMethod: (r) => j(() => e.getFolders(r)),
4476
4507
  args: { workspaceId: t },
4477
4508
  limit: $.FOLDERS_MAX
4478
4509
  })).sort((r, n) => r.defaultOrder - n.defaultOrder).map(Bt);
4479
4510
  }
4480
- function Kc(e) {
4511
+ function Yc(e) {
4481
4512
  return e.length === 0 ? "The user is not in any workspace. Folders exist only in workspaces; personal projects nest under a parent project instead." : e.map(
4482
4513
  ({ workspaceId: t, workspaceName: o, folders: r }) => oe({
4483
4514
  subject: `Folders in ${o} (id=${t})`,
@@ -4486,13 +4517,13 @@ function Kc(e) {
4486
4517
  `),
4487
4518
  zeroReasonHints: [
4488
4519
  "No folders in this workspace",
4489
- `Use ${Nc} to create one`
4520
+ `Use ${Hc} to create one`
4490
4521
  ]
4491
4522
  })
4492
4523
  ).join(`
4493
4524
  `);
4494
4525
  }
4495
- const zc = {
4526
+ const Vc = {
4496
4527
  searchText: s.string().optional().describe(
4497
4528
  'Search for a label by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all labels are returned.'
4498
4529
  ),
@@ -4500,7 +4531,7 @@ const zc = {
4500
4531
  cursor: s.string().optional().describe(
4501
4532
  "The cursor to get the next page of labels (cursor is obtained from the previous call to this tool, with the same parameters). Ignored when searchText is provided."
4502
4533
  )
4503
- }, qc = {
4534
+ }, Jc = {
4504
4535
  labels: s.array(Ee).describe("The found personal labels."),
4505
4536
  nextCursor: s.string().optional(),
4506
4537
  totalCount: s.number().describe("The total number of labels in this page."),
@@ -4509,11 +4540,11 @@ const zc = {
4509
4540
  "Names of all shared labels visible to you. These have no IDs or metadata — use their names directly when filtering tasks."
4510
4541
  ),
4511
4542
  appliedFilters: s.record(s.string(), s.unknown())
4512
- }, Gc = {
4543
+ }, Xc = {
4513
4544
  name: y.FIND_LABELS,
4514
4545
  description: "List personal labels and shared labels. Personal labels have full metadata (id, name, color, order, isFavorite) and support pagination and name search (partial, case insensitive). Shared labels are labels used on tasks shared with you — they are returned as names only (no IDs or metadata). When searching, all matching personal labels are fetched across all pages and returned as a single result set (limit and cursor are ignored). When not searching, personal labels are returned with pagination.",
4515
- parameters: zc,
4516
- outputSchema: qc,
4546
+ parameters: Vc,
4547
+ outputSchema: Jc,
4517
4548
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4518
4549
  async execute(e, t) {
4519
4550
  const [o, r] = await Promise.all([
@@ -4524,7 +4555,7 @@ const zc = {
4524
4555
  js(t)
4525
4556
  ]), { results: n, nextCursor: a } = o, i = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
4526
4557
  return {
4527
- textContent: Yc({ labels: n, args: e, nextCursor: a, sharedLabels: r }),
4558
+ textContent: Zc({ labels: n, args: e, nextCursor: a, sharedLabels: r }),
4528
4559
  structuredContent: {
4529
4560
  labels: n.map((c) => Ee.parse(c)),
4530
4561
  nextCursor: a ?? void 0,
@@ -4536,7 +4567,7 @@ const zc = {
4536
4567
  };
4537
4568
  }
4538
4569
  };
4539
- function Yc({
4570
+ function Zc({
4540
4571
  labels: e,
4541
4572
  args: t,
4542
4573
  nextCursor: o,
@@ -4561,14 +4592,14 @@ No shared labels.`;
4561
4592
  zeroReasonHints: p
4562
4593
  }) + f;
4563
4594
  }
4564
- const { FIND_PROJECTS: Ws, ADD_TASKS: Bs, UPDATE_TASKS: Ks } = y, Vc = {
4595
+ const { FIND_PROJECTS: Ws, ADD_TASKS: Bs, UPDATE_TASKS: Ks } = y, Qc = {
4565
4596
  projectId: s.string().min(1).optional().describe(
4566
4597
  'Optional. If provided, searches only collaborators of this project. If omitted, searches across the collaborators of all shared projects the authenticated user can access (plus the authenticated user themselves) — use this for general "find a user" / "who is X" lookups.'
4567
4598
  ),
4568
4599
  searchTerm: s.string().optional().describe(
4569
4600
  "Search for a user by name or email (partial and case insensitive match). If omitted, all users are returned."
4570
4601
  )
4571
- }, Jc = {
4602
+ }, ed = {
4572
4603
  collaborators: s.array(Ia).describe("The found users."),
4573
4604
  projectInfo: s.object({
4574
4605
  id: s.string().describe("The project ID."),
@@ -4578,16 +4609,16 @@ const { FIND_PROJECTS: Ws, ADD_TASKS: Bs, UPDATE_TASKS: Ks } = y, Vc = {
4578
4609
  totalCount: s.number().describe("The total number of users found."),
4579
4610
  totalAvailable: s.number().optional().describe("The total number of available users before the search filter was applied."),
4580
4611
  appliedFilters: s.record(s.string(), s.unknown())
4581
- }, Xc = {
4612
+ }, td = {
4582
4613
  name: y.FIND_PROJECT_COLLABORATORS,
4583
4614
  description: `Find Todoist users (collaborators, teammates) by name or email to look up their user ID. Use this whenever the user asks to find, look up, or identify a person — e.g. "find Carrie's user ID", "who is Ernesto", "look up a user". When projectId is omitted, searches across the collaborators of every shared project the authenticated user has access to, plus the authenticated user themselves — an empty result means the person is not a collaborator on any project you share with them, not necessarily that they do not exist in Todoist. When projectId is provided, searches only that project. Partial, case-insensitive match on name and email.`,
4584
- parameters: Vc,
4585
- outputSchema: Jc,
4615
+ parameters: Qc,
4616
+ outputSchema: ed,
4586
4617
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4587
4618
  async execute(e, t) {
4588
4619
  const { projectId: o, searchTerm: r } = e;
4589
4620
  if (!o)
4590
- return Zc({ searchTerm: r, client: t, appliedFilters: e });
4621
+ return od({ searchTerm: r, client: t, appliedFilters: e });
4591
4622
  let n = o, a;
4592
4623
  try {
4593
4624
  if (a = await ne(t, o), !a)
@@ -4657,12 +4688,12 @@ const { FIND_PROJECTS: Ws, ADD_TASKS: Bs, UPDATE_TASKS: Ks } = y, Vc = {
4657
4688
  };
4658
4689
  }
4659
4690
  };
4660
- async function Zc({
4691
+ async function od({
4661
4692
  searchTerm: e,
4662
4693
  client: t,
4663
4694
  appliedFilters: o
4664
4695
  }) {
4665
- const r = await M.getAllCollaborators(t), n = await Qc(t, r);
4696
+ const r = await M.getAllCollaborators(t), n = await sd(t, r);
4666
4697
  if (n.length === 0)
4667
4698
  return {
4668
4699
  textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.
@@ -4696,7 +4727,7 @@ async function Zc({
4696
4727
  }
4697
4728
  };
4698
4729
  }
4699
- async function Qc(e, t) {
4730
+ async function sd(e, t) {
4700
4731
  try {
4701
4732
  const o = await e.getUser();
4702
4733
  return !o || t.some((r) => r.id === o.id) ? t : [
@@ -4741,11 +4772,11 @@ function qs({
4741
4772
  nextSteps: l
4742
4773
  });
4743
4774
  }
4744
- const { ADD_PROJECTS: Eo, FIND_FOLDERS: Gs, PROJECT_MANAGEMENT: Ys } = y, ed = {
4775
+ const { ADD_PROJECTS: Eo, FIND_FOLDERS: Gs, PROJECT_MANAGEMENT: Ys } = y, rd = {
4745
4776
  active: "projects",
4746
4777
  archived: "archived projects",
4747
4778
  all: "projects (active and archived)"
4748
- }, td = {
4779
+ }, nd = {
4749
4780
  searchText: s.string().optional().describe(
4750
4781
  'Search for a project by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all projects are returned.'
4751
4782
  ),
@@ -4760,24 +4791,24 @@ const { ADD_PROJECTS: Eo, FIND_FOLDERS: Gs, PROJECT_MANAGEMENT: Ys } = y, ed = {
4760
4791
  includeUnjoined: s.boolean().optional().describe(
4761
4792
  `Also list workspace projects the user can join but hasn't, in unjoinedProjects (first page only). They can't be read until joined; join with ${Ys} (action 'join') only when the user asks.`
4762
4793
  )
4763
- }, od = s.object({
4794
+ }, ad = s.object({
4764
4795
  id: s.string(),
4765
4796
  name: s.string(),
4766
4797
  workspaceId: s.string(),
4767
4798
  url: s.string()
4768
- }), sd = {
4799
+ }), id = {
4769
4800
  projects: s.array(me).describe("The found projects."),
4770
4801
  nextCursor: s.string().optional(),
4771
4802
  totalCount: s.number().describe("The total number of projects in this page."),
4772
4803
  hasMore: s.boolean(),
4773
4804
  appliedFilters: s.record(s.string(), s.unknown()),
4774
- unjoinedProjects: s.array(od).optional().describe("Up to limit. With includeUnjoined, or when a search matched no joined project."),
4805
+ unjoinedProjects: s.array(ad).optional().describe("Up to limit. With includeUnjoined, or when a search matched no joined project."),
4775
4806
  unjoinedHasMore: s.boolean().optional().describe("More matched than limit; narrow with searchText.")
4776
- }, rd = {
4807
+ }, cd = {
4777
4808
  name: y.FIND_PROJECTS,
4778
4809
  description: "List or search by name the projects the user has joined. By default only active projects are returned; use archivedStatus ('archived' or 'all') to include archived projects. When searching, when archivedStatus is 'all', or when listing archived projects in a folder, all matching projects are returned (pagination is ignored). Otherwise projects are returned with pagination. Workspace projects the user hasn't joined are left out unless includeUnjoined is set, or a search matches no joined project.",
4779
- parameters: td,
4780
- outputSchema: sd,
4810
+ parameters: nd,
4811
+ outputSchema: id,
4781
4812
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4782
4813
  async execute(e, t) {
4783
4814
  const { searchText: o } = e, r = e.archivedStatus ?? "active";
@@ -4801,16 +4832,16 @@ const { ADD_PROJECTS: Eo, FIND_FOLDERS: Gs, PROJECT_MANAGEMENT: Ys } = y, ed = {
4801
4832
  });
4802
4833
  n = d.results, a = d.nextCursor;
4803
4834
  }
4804
- const i = n.map(he), c = await nd(t, e, i.length);
4835
+ const i = n.map(he), c = await dd(t, e, i.length);
4805
4836
  return {
4806
- textContent: id({ projects: i, args: e, nextCursor: a, unjoined: c }),
4837
+ textContent: ud({ projects: i, args: e, nextCursor: a, unjoined: c }),
4807
4838
  structuredContent: {
4808
4839
  projects: i,
4809
4840
  nextCursor: a ?? void 0,
4810
4841
  totalCount: i.length,
4811
4842
  hasMore: !!a,
4812
4843
  appliedFilters: e,
4813
- unjoinedProjects: c?.listed.map(ad),
4844
+ unjoinedProjects: c?.listed.map(ld),
4814
4845
  unjoinedHasMore: c ? c.total > c.listed.length : void 0
4815
4846
  }
4816
4847
  };
@@ -4822,7 +4853,7 @@ function to({ searchText: e, archivedStatus: t, folderId: o }) {
4822
4853
  function Vs(e) {
4823
4854
  return e.archivedStatus === "archived" ? !1 : to(e) || !e.cursor;
4824
4855
  }
4825
- async function nd(e, t, o) {
4856
+ async function dd(e, t, o) {
4826
4857
  const { includeUnjoined: r, searchText: n, limit: a } = t, i = !!n && o === 0;
4827
4858
  if (!Vs(t) || !(r || i))
4828
4859
  return;
@@ -4838,16 +4869,16 @@ async function nd(e, t, o) {
4838
4869
  );
4839
4870
  return { listed: l.slice(0, a), total: l.length };
4840
4871
  }
4841
- function ad({ id: e, name: t, workspaceId: o, url: r }) {
4872
+ function ld({ id: e, name: t, workspaceId: o, url: r }) {
4842
4873
  return { id: e, name: t, workspaceId: o, url: r };
4843
4874
  }
4844
- function id({
4875
+ function ud({
4845
4876
  projects: e,
4846
4877
  args: t,
4847
4878
  nextCursor: o,
4848
4879
  unjoined: r
4849
4880
  }) {
4850
- const n = ed[t.archivedStatus ?? "active"], a = t.searchText ? `All ${n} matching "${t.searchText}"` : `${n.charAt(0).toUpperCase()}${n.slice(1)}`, i = [];
4881
+ const n = rd[t.archivedStatus ?? "active"], a = t.searchText ? `All ${n} matching "${t.searchText}"` : `${n.charAt(0).toUpperCase()}${n.slice(1)}`, i = [];
4851
4882
  t.searchText && i.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && i.push(`archivedStatus: "${t.archivedStatus}"`), t.folderId && i.push(`folderId: "${t.folderId}"`);
4852
4883
  const c = 10, u = e.slice(0, c).map(ja).join(`
4853
4884
  `), l = e.length - c, p = l > 0 ? `${u}
@@ -4879,22 +4910,22 @@ function id({
4879
4910
  ].join(`
4880
4911
  `);
4881
4912
  }
4882
- const cd = {
4913
+ const pd = {
4883
4914
  taskId: s.string().optional().describe(
4884
4915
  "Find all reminders for a specific task. Returns both time-based and location reminders."
4885
4916
  ),
4886
4917
  reminderId: s.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
4887
4918
  locationReminderId: s.string().optional().describe("Get a specific location reminder by its ID.")
4888
- }, dd = {
4919
+ }, hd = {
4889
4920
  reminders: s.array(Kt).describe("The found reminders (time-based and location)."),
4890
4921
  searchType: s.string().describe('The search type used: "task", "reminder", or "location_reminder".'),
4891
4922
  searchId: s.string().describe("The ID used for the search."),
4892
4923
  totalCount: s.number().describe("Total reminders in this response.")
4893
- }, ld = {
4924
+ }, md = {
4894
4925
  name: y.FIND_REMINDERS,
4895
4926
  description: "Find reminders by task ID (returns all reminder types), or get a specific reminder by its ID. Use reminderId for time-based reminders and locationReminderId for location reminders.",
4896
- parameters: cd,
4897
- outputSchema: dd,
4927
+ parameters: pd,
4928
+ outputSchema: hd,
4898
4929
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4899
4930
  async execute(e, t) {
4900
4931
  const { taskId: o, reminderId: r, locationReminderId: n } = e, a = [o, r, n].filter(Boolean);
@@ -4940,7 +4971,7 @@ const cd = {
4940
4971
  })
4941
4972
  ]), u = [...i, ...c].map(Pe);
4942
4973
  return {
4943
- textContent: ud(u, o),
4974
+ textContent: fd(u, o),
4944
4975
  structuredContent: {
4945
4976
  reminders: u,
4946
4977
  searchType: "task",
@@ -4952,7 +4983,7 @@ const cd = {
4952
4983
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
4953
4984
  }
4954
4985
  };
4955
- function ud(e, t) {
4986
+ function fd(e, t) {
4956
4987
  if (e.length === 0)
4957
4988
  return `No reminders found for task ${t}`;
4958
4989
  const { timeBasedCount: o, locationCount: r } = $s(e), n = [];
@@ -4966,22 +4997,22 @@ function ud(e, t) {
4966
4997
  }
4967
4998
  return `Found ${n.join(" and ")} for task ${t}`;
4968
4999
  }
4969
- const { ADD_SECTIONS: pd } = y, hd = {
5000
+ const { ADD_SECTIONS: bd } = y, gd = {
4970
5001
  projectId: s.string().min(1).describe(
4971
5002
  'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
4972
5003
  ),
4973
5004
  searchText: s.string().optional().describe(
4974
5005
  'Search for a section by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all sections in the project are returned.'
4975
5006
  )
4976
- }, md = {
5007
+ }, yd = {
4977
5008
  sections: s.array(re).describe("The found sections."),
4978
5009
  totalCount: s.number().describe("The total number of sections found."),
4979
5010
  appliedFilters: s.record(s.string(), s.unknown())
4980
- }, fd = {
5011
+ }, wd = {
4981
5012
  name: y.FIND_SECTIONS,
4982
5013
  description: "Search for sections by name or other criteria in a project. When searching, uses server-side search to avoid fetching all sections.",
4983
- parameters: hd,
4984
- outputSchema: md,
5014
+ parameters: gd,
5015
+ outputSchema: yd,
4985
5016
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4986
5017
  async execute(e, t) {
4987
5018
  const o = await pe({
@@ -4994,7 +5025,7 @@ const { ADD_SECTIONS: pd } = y, hd = {
4994
5025
  })).results;
4995
5026
  const n = r.map(ae);
4996
5027
  return {
4997
- textContent: bd({
5028
+ textContent: Td({
4998
5029
  sections: n,
4999
5030
  projectId: e.projectId,
5000
5031
  searchText: e.searchText
@@ -5007,13 +5038,13 @@ const { ADD_SECTIONS: pd } = y, hd = {
5007
5038
  };
5008
5039
  }
5009
5040
  };
5010
- function bd({
5041
+ function Td({
5011
5042
  sections: e,
5012
5043
  projectId: t,
5013
5044
  searchText: o
5014
5045
  }) {
5015
5046
  const r = [];
5016
- o ? (r.push("Try broader search terms"), r.push("Check spelling"), r.push("Remove searchText to see all sections")) : (r.push("Project has no sections yet"), r.push(`Use ${pd} to create sections`));
5047
+ o ? (r.push("Try broader search terms"), r.push("Check spelling"), r.push("Remove searchText to see all sections")) : (r.push("Project has no sections yet"), r.push(`Use ${bd} to create sections`));
5017
5048
  const n = o ? `Sections in project ${t} matching "${o}"` : `Sections in project ${t}`, a = e.length > 0 ? e.map((i) => ` ${i.name} • id=${i.id}`).join(`
5018
5049
  `) : void 0;
5019
5050
  return oe({
@@ -5027,7 +5058,7 @@ function Js(e) {
5027
5058
  return /* @__PURE__ */ new Date(`${e}T00:00:00`);
5028
5059
  }
5029
5060
  const rt = "+00:00";
5030
- async function gd(e, t) {
5061
+ async function kd(e, t) {
5031
5062
  if (t)
5032
5063
  return t.tzInfo?.gmtString || rt;
5033
5064
  try {
@@ -5039,7 +5070,7 @@ async function gd(e, t) {
5039
5070
  ), rt;
5040
5071
  }
5041
5072
  }
5042
- const yd = {
5073
+ const Id = {
5043
5074
  startDate: s.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe(
5044
5075
  "The start date to get the tasks for. Format: YYYY-MM-DD, or 'today', which by default also includes overdue tasks. Defaults to 'today' when omitted, except with overdueOption='overdue-only'."
5045
5076
  ),
@@ -5060,17 +5091,17 @@ const yd = {
5060
5091
  "Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."
5061
5092
  ),
5062
5093
  ...Qt
5063
- }, wd = {
5094
+ }, vd = {
5064
5095
  tasks: s.array(te).describe("The found tasks."),
5065
5096
  nextCursor: s.string().optional(),
5066
5097
  totalCount: s.number().describe("The total number of tasks in this page."),
5067
5098
  hasMore: s.boolean(),
5068
5099
  appliedFilters: s.record(s.string(), s.unknown())
5069
- }, Td = {
5100
+ }, Sd = {
5070
5101
  name: y.FIND_TASKS_BY_DATE,
5071
5102
  description: "Get tasks by date range. startDate='today' includes overdue items. Default responsibleUserFiltering='unassignedOrMe' excludes others' tasks.",
5072
- parameters: yd,
5073
- outputSchema: wd,
5103
+ parameters: Id,
5104
+ outputSchema: vd,
5074
5105
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5075
5106
  async execute(e, t) {
5076
5107
  const o = e.startDate !== void 0 || e.overdueOption === "overdue-only" ? e : { ...e, startDate: "today" }, r = Ge(o.cursor), n = await Lt(t, o.responsibleUser), a = n?.userId, i = n?.email, c = o.responsibleUser?.trim().toLowerCase() === wt, d = a && !c ? await t.getUser() : void 0, u = c ? a : d?.id;
@@ -5079,7 +5110,7 @@ const yd = {
5079
5110
  l = "overdue";
5080
5111
  else if (o.startDate === "today")
5081
5112
  if (o.daysCount > 1) {
5082
- const g = await gd(t, d), w = Fs(/* @__PURE__ */ new Date(), Ze(g)), I = Ue(w, o.daysCount), k = `(due after: ${w} | due: ${w}) & due before: ${I}`;
5113
+ const g = await kd(t, d), w = Fs(/* @__PURE__ */ new Date(), Ze(g)), I = Re(w, o.daysCount), k = `(due after: ${w} | due: ${w}) & due before: ${I}`;
5083
5114
  l = o.overdueOption === "exclude-overdue" ? k : `(${k} | overdue)`;
5084
5115
  } else
5085
5116
  l = o.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
@@ -5103,7 +5134,7 @@ const yd = {
5103
5134
  limit: o.limit
5104
5135
  });
5105
5136
  return {
5106
- textContent: kd({
5137
+ textContent: Cd({
5107
5138
  tasks: h,
5108
5139
  args: o,
5109
5140
  nextCursor: m,
@@ -5120,7 +5151,7 @@ const yd = {
5120
5151
  };
5121
5152
  }
5122
5153
  };
5123
- function kd({
5154
+ function Cd({
5124
5155
  tasks: e,
5125
5156
  args: t,
5126
5157
  nextCursor: o,
@@ -5171,14 +5202,14 @@ function kd({
5171
5202
  zeroReasonHints: c
5172
5203
  });
5173
5204
  }
5174
- const Id = 300 * 1e3;
5175
- class vd {
5205
+ const jd = 300 * 1e3;
5206
+ class $d {
5176
5207
  constructor() {
5177
5208
  this.cacheByClient = /* @__PURE__ */ new WeakMap();
5178
5209
  }
5179
5210
  async getFilters(t) {
5180
5211
  const o = this.cacheByClient, r = o.get(t);
5181
- if (r && Date.now() - r.timestamp < Id)
5212
+ if (r && Date.now() - r.timestamp < jd)
5182
5213
  return r.filters;
5183
5214
  const a = ((await t.sync({
5184
5215
  resourceTypes: ["filters"],
@@ -5235,19 +5266,19 @@ ${l}` + (d.length > 5 ? `
5235
5266
  this.cacheByClient = /* @__PURE__ */ new WeakMap();
5236
5267
  }
5237
5268
  }
5238
- const Sd = new vd(), Ao = 5, It = "resume:", vt = "Invalid cursor. Pass the nextCursor from the previous call unchanged, with the same parameters.", Cd = s.object({
5269
+ const Ed = new $d(), Ao = 5, It = "resume:", vt = "Invalid cursor. Pass the nextCursor from the previous call unchanged, with the same parameters.", Ad = s.object({
5239
5270
  next: s.string(),
5240
5271
  state: s.unknown().optional()
5241
5272
  });
5242
- function jd(e) {
5273
+ function Dd(e) {
5243
5274
  return `${It}${Buffer.from(JSON.stringify(e)).toString("base64url")}`;
5244
5275
  }
5245
- function $d(e) {
5276
+ function xd(e) {
5246
5277
  if (e) {
5247
5278
  if (!e.startsWith(It)) throw new Error(vt);
5248
5279
  try {
5249
5280
  const t = e.slice(It.length);
5250
- return Cd.parse(
5281
+ return Ad.parse(
5251
5282
  JSON.parse(Buffer.from(t, "base64url").toString())
5252
5283
  );
5253
5284
  } catch {
@@ -5255,7 +5286,7 @@ function $d(e) {
5255
5286
  }
5256
5287
  }
5257
5288
  }
5258
- async function Ed({
5289
+ async function Od({
5259
5290
  fetchPage: e,
5260
5291
  matches: t,
5261
5292
  limit: o,
@@ -5274,7 +5305,7 @@ async function Ed({
5274
5305
  }
5275
5306
  if (t(f)) {
5276
5307
  if (i.length === o)
5277
- return { items: i, nextCursor: jd({ next: f.id, state: a }) };
5308
+ return { items: i, nextCursor: Dd({ next: f.id, state: a }) };
5278
5309
  i.push(f);
5279
5310
  }
5280
5311
  }
@@ -5291,7 +5322,7 @@ async function Ed({
5291
5322
  `Stopped after reading ${Ao * r} items without reaching the end of the list.`
5292
5323
  );
5293
5324
  }
5294
- const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, Ad = {
5325
+ const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, _d = {
5295
5326
  searchText: s.string().optional().describe("The text to search for in tasks."),
5296
5327
  projectId: s.string().optional().describe(
5297
5328
  'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
@@ -5315,17 +5346,17 @@ const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, Ad = {
5315
5346
  "The ID or name of a saved Todoist filter. The filter's query will be fetched and used to find tasks. Cannot be used with the `filter` parameter, projectId, sectionId, or parentId."
5316
5347
  ),
5317
5348
  ...Qt
5318
- }, Dd = {
5349
+ }, Pd = {
5319
5350
  tasks: s.array(te).describe("The found tasks."),
5320
5351
  nextCursor: s.string().optional(),
5321
5352
  totalCount: s.number().describe("The total number of tasks in this page."),
5322
5353
  hasMore: s.boolean(),
5323
5354
  appliedFilters: s.record(s.string(), s.unknown())
5324
- }, xd = {
5355
+ }, Ud = {
5325
5356
  name: y.FIND_TASKS,
5326
5357
  description: 'Find active tasks by text, project/section/parent, responsible user, labels, raw filter, or saved filter (filterIdOrName). Without filters, list a page. Default scope: unassigned + mine; responsibleUserFiltering="all" includes others.',
5327
- parameters: Ad,
5328
- outputSchema: Dd,
5358
+ parameters: _d,
5359
+ outputSchema: Pd,
5329
5360
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5330
5361
  async execute(e, t) {
5331
5362
  const {
@@ -5351,16 +5382,16 @@ const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, Ad = {
5351
5382
  throw new Error(
5352
5383
  'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
5353
5384
  );
5354
- const g = b ? $d(m) : void 0, w = b ? g ? Promise.resolve(_d(g.state)) : Pd(t, l, p) : Promise.resolve(void 0), I = await t.getUser(), k = l && l.length > 0;
5385
+ const g = b ? xd(m) : void 0, w = b ? g ? Promise.resolve(Nd(g.state)) : Ld(t, l, p) : Promise.resolve(void 0), I = await t.getUser(), k = l && l.length > 0;
5355
5386
  let S = f;
5356
- h && (S = (await Sd.resolveFilter(t, h)).filterQuery);
5387
+ h && (S = (await Ed.resolveFilter(t, h)).filterQuery);
5357
5388
  const E = await Lt(t, i), N = E?.userId, T = E?.email;
5358
5389
  if (b) {
5359
5390
  const q = {};
5360
5391
  r && (q.projectId = await pe({ projectId: r, user: I })), n && (q.sectionId = n), a && (q.parentId = a);
5361
5392
  const fe = await w;
5362
5393
  fe && (q.label = fe);
5363
- const ie = o?.toLowerCase(), { items: J, nextCursor: Fe } = await Ed({
5394
+ const ie = o?.toLowerCase(), { items: J, nextCursor: Fe } = await Od({
5364
5395
  fetchPage: async (be) => {
5365
5396
  const { results: ur, nextCursor: pr } = await t.getTasks({
5366
5397
  ...q,
@@ -5373,7 +5404,7 @@ const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, Ad = {
5373
5404
  resolvedAssigneeId: N,
5374
5405
  currentUserId: I.id,
5375
5406
  responsibleUserFiltering: c
5376
- }).length === 1 && (!l?.length || Ec(be.labels, l, p)),
5407
+ }).length === 1 && (!l?.length || Oc(be.labels, l, p)),
5377
5408
  limit: d,
5378
5409
  maxPageSize: $.TASKS_PAGE_MAX,
5379
5410
  from: g,
@@ -5463,14 +5494,14 @@ const { FIND_COMPLETED_TASKS: Do, ADD_TASKS: xo } = y, Ad = {
5463
5494
  }
5464
5495
  };
5465
5496
  }
5466
- }, Od = s.object({ apiLabel: s.string().optional() });
5467
- function _d(e) {
5497
+ }, Rd = s.object({ apiLabel: s.string().optional() });
5498
+ function Nd(e) {
5468
5499
  if (e === void 0) return;
5469
- const t = Od.safeParse(e);
5500
+ const t = Rd.safeParse(e);
5470
5501
  if (!t.success) throw new Error(vt);
5471
5502
  return t.data.apiLabel;
5472
5503
  }
5473
- async function Pd(e, t, o) {
5504
+ async function Ld(e, t, o) {
5474
5505
  if (!(!t?.length || t.length > 1 && o !== "and"))
5475
5506
  try {
5476
5507
  const [r, n] = await Promise.all([
@@ -5478,7 +5509,7 @@ async function Pd(e, t, o) {
5478
5509
  js(e)
5479
5510
  ]), a = [...r, ...n];
5480
5511
  for (const i of t) {
5481
- const c = Ac(i, a);
5512
+ const c = _c(i, a);
5482
5513
  if (c) return c;
5483
5514
  }
5484
5515
  return;
@@ -5490,7 +5521,7 @@ async function Pd(e, t, o) {
5490
5521
  return;
5491
5522
  }
5492
5523
  }
5493
- function Rd(e) {
5524
+ function Md(e) {
5494
5525
  if (e.projectId) {
5495
5526
  const t = [
5496
5527
  e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
@@ -5526,7 +5557,7 @@ function nt({
5526
5557
  const u = Ie(t.labels, t.labelsOperator);
5527
5558
  c.push(`labels: ${u}`);
5528
5559
  }
5529
- e.length === 0 && d.push(...Rd(t));
5560
+ e.length === 0 && d.push(...Md(t));
5530
5561
  } else {
5531
5562
  const u = n || t.responsibleUser, l = [];
5532
5563
  if (t.filter && l.push(`filter: ${t.filter}`), t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${u}`), t.labels && t.labels.length > 0) {
@@ -5555,7 +5586,7 @@ function nt({
5555
5586
  zeroReasonHints: d
5556
5587
  });
5557
5588
  }
5558
- const Ud = {
5589
+ const Fd = {
5559
5590
  projectId: s.string().min(1).optional().describe(
5560
5591
  `Optional project ID. Use "inbox" for the Inbox. If provided, returns that project's tasks grouped by section. If omitted, returns the project and section structure for the whole account with no tasks.`
5561
5592
  )
@@ -5569,7 +5600,7 @@ const Ud = {
5569
5600
  sections: s.array(re),
5570
5601
  children: s.array(Xs).describe("Nested child projects.")
5571
5602
  })
5572
- ), Nd = {
5603
+ ), Hd = {
5573
5604
  type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
5574
5605
  totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
5575
5606
  totalTasks: s.number().optional().describe("Total number of tasks."),
@@ -5603,7 +5634,7 @@ const Ud = {
5603
5634
  tasksWithoutSection: s.number()
5604
5635
  }).optional().describe("Statistics object (project overview only).")
5605
5636
  };
5606
- function Ld(e) {
5637
+ function Wd(e) {
5607
5638
  const t = {};
5608
5639
  for (const n of e)
5609
5640
  t[n.id] = {
@@ -5628,7 +5659,7 @@ function Ld(e) {
5628
5659
  }
5629
5660
  return r(o), o;
5630
5661
  }
5631
- async function Md(e, t) {
5662
+ async function Bd(e, t) {
5632
5663
  const o = {};
5633
5664
  return await Promise.all(
5634
5665
  t.map(async (r) => {
@@ -5685,7 +5716,7 @@ function Qs(e, t) {
5685
5716
  )
5686
5717
  };
5687
5718
  }
5688
- async function Fd(e, t) {
5719
+ async function Kd(e, t) {
5689
5720
  let o = [], r;
5690
5721
  do {
5691
5722
  const { results: n, nextCursor: a } = await e.getTasks({
@@ -5697,12 +5728,12 @@ async function Fd(e, t) {
5697
5728
  } while (r);
5698
5729
  return o;
5699
5730
  }
5700
- async function Hd(e, t) {
5731
+ async function zd(e, t) {
5701
5732
  const { results: o } = await e.getSections({ projectId: t });
5702
5733
  return o;
5703
5734
  }
5704
- async function Wd(e) {
5705
- const { results: t } = await e.getProjects({}), o = t.find((p) => Q(p) && p.inboxProject === !0), r = t.filter((p) => !Q(p) || p.inboxProject !== !0), n = Ld(r), a = t.map((p) => p.id), i = await Md(e, a), c = ["# Personal Projects", ""];
5735
+ async function qd(e) {
5736
+ const { results: t } = await e.getProjects({}), o = t.find((p) => Q(p) && p.inboxProject === !0), r = t.filter((p) => !Q(p) || p.inboxProject !== !0), n = Wd(r), a = t.map((p) => p.id), i = await Bd(e, a), c = ["# Personal Projects", ""];
5706
5737
  if (o) {
5707
5738
  c.push(`- Inbox Project: ${o.name} (id=${o.id})`);
5708
5739
  for (const p of i[o.id] || [])
@@ -5742,13 +5773,13 @@ async function Wd(e) {
5742
5773
  };
5743
5774
  return { textContent: u, structuredContent: l };
5744
5775
  }
5745
- async function Bd(e, t) {
5776
+ async function Gd(e, t) {
5746
5777
  const o = ne(e, t), r = (h) => h.catch(async (m) => {
5747
5778
  throw await o, m;
5748
5779
  }), [n, a, i] = await Promise.all([
5749
5780
  o,
5750
- r(Hd(e, t)),
5751
- r(Fd(e, t))
5781
+ r(zd(e, t)),
5782
+ r(Kd(e, t))
5752
5783
  ]), c = await ve(e, i), d = {};
5753
5784
  for (const h of a)
5754
5785
  d[h.id] = [];
@@ -5790,27 +5821,27 @@ async function Bd(e, t) {
5790
5821
  };
5791
5822
  return { textContent: p, structuredContent: f };
5792
5823
  }
5793
- const Kd = {
5824
+ const Yd = {
5794
5825
  name: y.GET_OVERVIEW,
5795
5826
  description: `Get a Markdown overview. Called without a projectId, returns the account's project and section structure only — no tasks — for navigation. Pass a projectId (or "inbox" for the Inbox) to get that project's tasks grouped by section.`,
5796
- parameters: Ud,
5797
- outputSchema: Nd,
5827
+ parameters: Fd,
5828
+ outputSchema: Hd,
5798
5829
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5799
5830
  async execute(e, t) {
5800
- const o = await pe({ projectId: e.projectId, client: t }), r = o ? await Bd(t, o) : await Wd(t);
5831
+ const o = await pe({ projectId: e.projectId, client: t }), r = o ? await Gd(t, o) : await qd(t);
5801
5832
  return {
5802
5833
  textContent: r.textContent,
5803
5834
  structuredContent: r.structuredContent
5804
5835
  };
5805
5836
  }
5806
- }, zd = {}, ke = s.object({
5837
+ }, Vd = {}, ke = s.object({
5807
5838
  count: s.number().describe("Number of consecutive periods in this streak."),
5808
5839
  start: s.string().describe("Start date of the streak."),
5809
5840
  end: s.string().describe("End date of the streak.")
5810
5841
  }), _o = s.object({
5811
5842
  id: s.string().describe("Project ID."),
5812
5843
  completed: s.number().describe("Number of tasks completed in this project.")
5813
- }), qd = {
5844
+ }), Jd = {
5814
5845
  completedCount: s.number().describe("Total number of completed tasks (all-time)."),
5815
5846
  daysItems: s.array(
5816
5847
  s.object({
@@ -5859,11 +5890,11 @@ const Kd = {
5859
5890
  })
5860
5891
  ).describe("Recent karma change events with reasons."),
5861
5892
  projectColors: s.record(s.string(), s.string()).describe("Map of project ID to color key.")
5862
- }, Gd = {
5893
+ }, Xd = {
5863
5894
  name: y.GET_PRODUCTIVITY_STATS,
5864
5895
  description: 'Get comprehensive productivity statistics including daily/weekly completion breakdowns, goal streaks (current, last, max), karma score and trends, and historical karma data. Useful for productivity analysis and tracking goal progress. Reports counts, streaks and karma only, never the tasks themselves — for "what did I complete", use find-activity.',
5865
- parameters: zd,
5866
- outputSchema: qd,
5896
+ parameters: Vd,
5897
+ outputSchema: Jd,
5867
5898
  annotations: {
5868
5899
  readOnlyHint: !0,
5869
5900
  destructiveHint: !1,
@@ -5872,7 +5903,7 @@ const Kd = {
5872
5903
  async execute(e, t) {
5873
5904
  const o = await t.getProductivityStats();
5874
5905
  return {
5875
- textContent: Yd(o),
5906
+ textContent: Zd(o),
5876
5907
  structuredContent: {
5877
5908
  completedCount: o.completedCount,
5878
5909
  daysItems: o.daysItems,
@@ -5899,7 +5930,7 @@ const Kd = {
5899
5930
  };
5900
5931
  }
5901
5932
  };
5902
- function Yd(e) {
5933
+ function Zd(e) {
5903
5934
  const t = [
5904
5935
  "# Productivity Statistics",
5905
5936
  "",
@@ -5929,11 +5960,11 @@ function Yd(e) {
5929
5960
  return t.join(`
5930
5961
  `);
5931
5962
  }
5932
- const Vd = {
5963
+ const Qd = {
5933
5964
  projectId: s.string().min(1).describe("The ID of the project to get activity stats for."),
5934
5965
  weeks: s.number().int().min(1).max(12).optional().describe("Number of weeks of activity data to retrieve (1-12, default 2)."),
5935
5966
  includeWeeklyCounts: s.boolean().optional().describe("Include weekly rollup counts alongside daily counts.")
5936
- }, Jd = {
5967
+ }, el = {
5937
5968
  projectId: s.string().describe("The project ID."),
5938
5969
  dayItems: s.array(
5939
5970
  s.object({
@@ -5949,7 +5980,7 @@ const Vd = {
5949
5980
  })
5950
5981
  ).optional().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
5951
5982
  };
5952
- function Xd(e, t) {
5983
+ function tl(e, t) {
5953
5984
  const o = [`# Activity Stats: Project ${e}`, ""];
5954
5985
  if (t.dayItems.length > 0) {
5955
5986
  o.push("## Daily Activity");
@@ -5965,11 +5996,11 @@ function Xd(e, t) {
5965
5996
  return o.join(`
5966
5997
  `);
5967
5998
  }
5968
- const Zd = {
5999
+ const ol = {
5969
6000
  name: y.GET_PROJECT_ACTIVITY_STATS,
5970
6001
  description: "Get daily and optional weekly task completion counts for a project over a configurable time window (1-12 weeks). Useful for identifying completion trends and patterns.",
5971
- parameters: Vd,
5972
- outputSchema: Jd,
6002
+ parameters: Qd,
6003
+ outputSchema: el,
5973
6004
  annotations: {
5974
6005
  readOnlyHint: !0,
5975
6006
  destructiveHint: !1,
@@ -5981,7 +6012,7 @@ const Zd = {
5981
6012
  includeWeeklyCounts: n
5982
6013
  });
5983
6014
  return {
5984
- textContent: Xd(o, a),
6015
+ textContent: tl(o, a),
5985
6016
  structuredContent: {
5986
6017
  projectId: o,
5987
6018
  dayItems: a.dayItems,
@@ -5989,9 +6020,9 @@ const Zd = {
5989
6020
  }
5990
6021
  };
5991
6022
  }
5992
- }, Qd = {
6023
+ }, sl = {
5993
6024
  projectId: s.string().min(1).describe("The ID of the project to check health for.")
5994
- }, el = {
6025
+ }, rl = {
5995
6026
  projectId: s.string().describe("The project ID."),
5996
6027
  projectName: s.string().describe("The project name."),
5997
6028
  progress: s.object({
@@ -6008,18 +6039,18 @@ const Zd = {
6008
6039
  updatedAt: s.string().optional().describe("When the health assessment was last updated.")
6009
6040
  }).describe("Project health assessment.")
6010
6041
  };
6011
- function tl(e, t, o) {
6042
+ function nl(e, t, o) {
6012
6043
  const r = [`# Project Health: ${e}`, ""];
6013
6044
  return r.push(`**Status:** ${o.status}`), o.isStale && r.push("**Note:** Health data is stale and may not reflect recent changes."), o.updateInProgress && r.push("**Note:** A health analysis update is currently in progress."), o.updatedAt && r.push(`**Last Updated:** ${o.updatedAt.toISOString()}`), r.push(""), r.push("## Progress"), r.push(
6014
6045
  `**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`
6015
6046
  ), o.description && (r.push(""), r.push("## Health Description"), r.push(o.description)), r.join(`
6016
6047
  `);
6017
6048
  }
6018
- const ol = {
6049
+ const al = {
6019
6050
  name: y.GET_PROJECT_HEALTH,
6020
6051
  description: "Get a comprehensive health assessment for a project including completion progress, health status (EXCELLENT, ON_TRACK, AT_RISK, CRITICAL), and a written assessment. Use find-tasks and find-completed-tasks for task-level detail.",
6021
- parameters: Qd,
6022
- outputSchema: el,
6052
+ parameters: sl,
6053
+ outputSchema: rl,
6023
6054
  annotations: {
6024
6055
  readOnlyHint: !0,
6025
6056
  destructiveHint: !1,
@@ -6031,7 +6062,7 @@ const ol = {
6031
6062
  t.getProjectHealth(o)
6032
6063
  ]), a = `Project ${o}`;
6033
6064
  return {
6034
- textContent: tl(a, r, n),
6065
+ textContent: nl(a, r, n),
6035
6066
  structuredContent: {
6036
6067
  projectId: o,
6037
6068
  projectName: a,
@@ -6051,7 +6082,7 @@ const ol = {
6051
6082
  }
6052
6083
  };
6053
6084
  }
6054
- }, sl = s.object({
6085
+ }, il = s.object({
6055
6086
  message: s.string().optional(),
6056
6087
  emoji: s.string().optional(),
6057
6088
  activeUntil: s.string().optional().describe("ISO 8601 end. Omitted when it has no end."),
@@ -6059,9 +6090,9 @@ const ol = {
6059
6090
  pauseActivity: s.boolean().describe("Karma and streaks paused.")
6060
6091
  }), er = {
6061
6092
  hasStatus: s.boolean(),
6062
- status: sl.optional().describe("Omitted when there is no active status.")
6093
+ status: il.optional().describe("Omitted when there is no active status.")
6063
6094
  };
6064
- function rl(e) {
6095
+ function cl(e) {
6065
6096
  if (!e.user)
6066
6097
  throw new Error("Todoist did not return the user, so the status is unknown.");
6067
6098
  return e.user.status ?? null;
@@ -6070,9 +6101,9 @@ async function tr(e) {
6070
6101
  const t = await j(
6071
6102
  () => e.sync({ resourceTypes: ["user"], syncToken: "*" })
6072
6103
  );
6073
- return rl(t);
6104
+ return cl(t);
6074
6105
  }
6075
- function nl(e) {
6106
+ function dl(e) {
6076
6107
  const t = e.activeUntil ? new Date(e.activeUntil).toISOString() : void 0;
6077
6108
  return {
6078
6109
  ...e.message ? { message: e.message } : {},
@@ -6088,7 +6119,7 @@ function Ct(e, t) {
6088
6119
  textContent: `${t}: none`,
6089
6120
  structuredContent: { hasStatus: !1 }
6090
6121
  };
6091
- const o = nl(e), r = [`${t}: ${[o.emoji, o.message].filter(Boolean).join(" ")}`];
6122
+ const o = dl(e), r = [`${t}: ${[o.emoji, o.message].filter(Boolean).join(" ")}`];
6092
6123
  r.push(o.activeUntil ? `Until: ${o.activeUntil}` : "Until: no end");
6093
6124
  const n = [
6094
6125
  o.pauseNotifications ? "Comms notifications paused" : void 0,
@@ -6100,21 +6131,21 @@ function Ct(e, t) {
6100
6131
  structuredContent: { hasStatus: !0, status: o }
6101
6132
  };
6102
6133
  }
6103
- const al = {}, il = {
6134
+ const ll = {}, ul = {
6104
6135
  name: y.GET_USER_STATUS,
6105
6136
  description: "Get the user's status, the message and emoji shown next to their name in Todoist and Comms, with when it ends and whether it pauses Comms notifications or Karma and streaks. Returns no status when none is set or it has expired.",
6106
- parameters: al,
6137
+ parameters: ll,
6107
6138
  outputSchema: er,
6108
6139
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
6109
6140
  async execute(e, t) {
6110
6141
  return Ct(await tr(t), "Status");
6111
6142
  }
6112
- }, cl = {
6143
+ }, pl = {
6113
6144
  workspaceIdOrName: s.string().min(1).describe(
6114
6145
  "The workspace ID or name. Supports exact ID, exact name match (case-insensitive), or unique partial name match."
6115
6146
  ),
6116
6147
  projectIds: s.array(s.string().min(1)).min(1).max($.FILTER_VALUES_MAX).optional().describe("Optional list of project IDs to scope insights to specific projects.")
6117
- }, dl = s.object({
6148
+ }, hl = s.object({
6118
6149
  projectId: s.string().describe("The project ID."),
6119
6150
  health: s.object({
6120
6151
  status: s.enum($t).describe("The health status of the project."),
@@ -6126,22 +6157,22 @@ const al = {}, il = {
6126
6157
  activeCount: s.number().describe("Number of active tasks."),
6127
6158
  progressPercent: s.number().describe("Completion percentage (0-100).")
6128
6159
  }).optional().describe("Progress data for this project. Omitted when the project has none.")
6129
- }), ll = {
6160
+ }), ml = {
6130
6161
  workspaceId: s.string().describe("The resolved workspace ID."),
6131
6162
  workspaceName: s.string().describe("The resolved workspace name."),
6132
- projectInsights: s.array(dl).describe("Health and progress insights for each project in the workspace.")
6133
- }, ul = {
6163
+ projectInsights: s.array(hl).describe("Health and progress insights for each project in the workspace.")
6164
+ }, fl = {
6134
6165
  name: y.GET_WORKSPACE_INSIGHTS,
6135
6166
  description: "Get aggregated health and progress insights across all projects in a workspace. Accepts workspace name or ID, with optional project ID filtering. Useful for a cross-project health overview.",
6136
- parameters: cl,
6137
- outputSchema: ll,
6167
+ parameters: pl,
6168
+ outputSchema: ml,
6138
6169
  annotations: {
6139
6170
  readOnlyHint: !0,
6140
6171
  destructiveHint: !1,
6141
6172
  idempotentHint: !0
6142
6173
  },
6143
6174
  async execute(e, t) {
6144
- const { workspaceIdOrName: o, projectIds: r } = e, n = await Re.resolveWorkspace(t, o), i = (await t.getWorkspaceInsights(n.workspaceId, { projectIds: r })).projectInsights.map((d) => ({
6175
+ const { workspaceIdOrName: o, projectIds: r } = e, n = await Ue.resolveWorkspace(t, o), i = (await t.getWorkspaceInsights(n.workspaceId, { projectIds: r })).projectInsights.map((d) => ({
6145
6176
  projectId: d.projectId,
6146
6177
  health: d.health ? {
6147
6178
  status: d.health.status,
@@ -6174,7 +6205,7 @@ const al = {}, il = {
6174
6205
  };
6175
6206
  }
6176
6207
  };
6177
- function pl(e) {
6208
+ function bl(e) {
6178
6209
  const t = e.trim();
6179
6210
  if (!/^https?:\/\//i.test(t))
6180
6211
  return t;
@@ -6184,7 +6215,7 @@ function pl(e) {
6184
6215
  } catch {
6185
6216
  throw new Error(`Could not read a template ID from "${t}".`);
6186
6217
  }
6187
- if (!hl(o.hostname))
6218
+ if (!gl(o.hostname))
6188
6219
  throw new Error(
6189
6220
  `"${o.hostname}" is not a Todoist domain. Pass a todoist.com template URL or the template ID itself.`
6190
6221
  );
@@ -6194,18 +6225,18 @@ function pl(e) {
6194
6225
  throw new Error(`"${t}" is not a Todoist template URL.`);
6195
6226
  return r.id;
6196
6227
  }
6197
- function hl(e) {
6228
+ function gl(e) {
6198
6229
  const t = e.toLowerCase();
6199
6230
  return t === "todoist.com" || t.endsWith(".todoist.com");
6200
6231
  }
6201
6232
  function Po(e) {
6202
6233
  return e.replace(/[a-z]/gi, (t) => `[${t.toUpperCase()}${t.toLowerCase()}]`).replace(/\./g, "\\.");
6203
6234
  }
6204
- const ml = new RegExp(
6235
+ const yl = new RegExp(
6205
6236
  String.raw`^\s*(?:[A-Za-z0-9_\-]+|${Po("https")}:\/\/(?:[A-Za-z0-9\-]+\.)*${Po("todoist.com")}(?:\/\S*)?)\s*$`
6206
- ), fl = {
6237
+ ), wl = {
6207
6238
  projectId: s.string().min(1).describe("The ID of the existing project to import the template into."),
6208
- templateId: s.string().regex(ml, {
6239
+ templateId: s.string().regex(yl, {
6209
6240
  error: 'Pass a template slug ("product-launch"), a template ID ("UT_..."), or an https URL on todoist.com or one of its subdomains.'
6210
6241
  }).optional().describe(
6211
6242
  'The template to import — either a gallery slug ("product-launch"), a personal template ID ("UT_28Ex..."), or a full Todoist template URL, which is reduced to the ID automatically. Gallery templates work for anyone; personal templates only for the account that owns them. There is no way to list templates through this server, so only use the ID or URL the user supplied. Provide either this or `csvFileContent`, not both.'
@@ -6214,16 +6245,16 @@ const ml = new RegExp(
6214
6245
  "Raw CSV template content, as produced by export-project-template. Provide either this or `templateId`, not both."
6215
6246
  ),
6216
6247
  locale: s.string().optional().describe('Locale for the imported content when using `templateId`. Defaults to "en".')
6217
- }, bl = {
6248
+ }, Tl = {
6218
6249
  sections: s.array(re).describe("Sections created by the import."),
6219
6250
  tasks: s.array(te).describe("Tasks created by the import."),
6220
6251
  comments: s.array(Le).describe("Comments created by the import."),
6221
6252
  totalCount: s.number().describe("The total number of objects created by the import.")
6222
- }, gl = {
6253
+ }, kl = {
6223
6254
  name: y.IMPORT_PROJECT_TEMPLATE,
6224
6255
  description: "Import a template into an existing project, adding its tasks, sections and comments to whatever is already there. Source it by template ID/URL or by passing CSV content from export-project-template. To start a new project from a template, create the project with add-projects first, then import into it. This writes immediately and cannot be undone, so only run it against a project the user named.",
6225
- parameters: fl,
6226
- outputSchema: bl,
6256
+ parameters: wl,
6257
+ outputSchema: Tl,
6227
6258
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
6228
6259
  async execute({ projectId: e, templateId: t, csvFileContent: o, locale: r }, n) {
6229
6260
  if (!!t == !!o)
@@ -6232,7 +6263,7 @@ const ml = new RegExp(
6232
6263
  );
6233
6264
  const a = t ? await n.importTemplateFromId({
6234
6265
  projectId: e,
6235
- templateId: pl(t),
6266
+ templateId: bl(t),
6236
6267
  locale: r
6237
6268
  }) : await n.importCsvIntoProject({
6238
6269
  projectId: e,
@@ -6241,7 +6272,7 @@ const ml = new RegExp(
6241
6272
  fileName: "template.csv"
6242
6273
  }), i = a.sections.map(ae), c = a.tasks.map(z), d = a.comments.map(Ne), u = a.projects.length + i.length + c.length + d.length;
6243
6274
  return {
6244
- textContent: yl({
6275
+ textContent: Il({
6245
6276
  projectId: e,
6246
6277
  counts: {
6247
6278
  projects: a.projects.length,
@@ -6255,7 +6286,7 @@ const ml = new RegExp(
6255
6286
  };
6256
6287
  }
6257
6288
  };
6258
- function yl({
6289
+ function Il({
6259
6290
  projectId: e,
6260
6291
  counts: t,
6261
6292
  totalCount: o
@@ -6265,7 +6296,7 @@ function yl({
6265
6296
  const r = Object.entries(t).filter(([, n]) => n > 0).map(([n, a]) => `${a} ${a === 1 ? n.replace(/s$/, "") : n}`);
6266
6297
  return `Imported template into project (id=${e}): ${r.join(", ")}.`;
6267
6298
  }
6268
- const wl = {}, Tl = {
6299
+ const vl = {}, Sl = {
6269
6300
  id: s.string().describe("The unique identifier for the workspace."),
6270
6301
  name: s.string().describe("The name of the workspace."),
6271
6302
  plan: s.enum(Ar).describe("The workspace plan type."),
@@ -6274,12 +6305,12 @@ const wl = {}, Tl = {
6274
6305
  isGuestAllowed: s.boolean().describe("Whether guests are allowed in the workspace."),
6275
6306
  createdAt: s.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
6276
6307
  creatorId: s.string().describe("The ID of the user who created the workspace.")
6277
- }, kl = {
6308
+ }, Cl = {
6278
6309
  type: s.literal("workspaces").describe("The type of the response."),
6279
- workspaces: s.array(s.object(Tl)).describe("List of workspaces."),
6310
+ workspaces: s.array(s.object(Sl)).describe("List of workspaces."),
6280
6311
  count: s.number().describe("The total number of workspaces.")
6281
6312
  };
6282
- async function Il(e) {
6313
+ async function jl(e) {
6283
6314
  const o = (await e.getWorkspaces()).map((i) => ({
6284
6315
  id: i.id,
6285
6316
  name: i.name,
@@ -6310,20 +6341,20 @@ async function Il(e) {
6310
6341
  };
6311
6342
  return { textContent: n, structuredContent: a };
6312
6343
  }
6313
- const vl = {
6344
+ const $l = {
6314
6345
  name: y.LIST_WORKSPACES,
6315
6346
  description: "Get all workspaces for the authenticated user. Returns workspace details including ID, name, plan type (STARTER/BUSINESS), user role (ADMIN/MEMBER/GUEST), link sharing settings, guest permissions, creation date, and creator ID.",
6316
- parameters: wl,
6317
- outputSchema: kl,
6347
+ parameters: vl,
6348
+ outputSchema: Cl,
6318
6349
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
6319
6350
  async execute(e, t) {
6320
- const o = await Il(t);
6351
+ const o = await jl(t);
6321
6352
  return {
6322
6353
  textContent: o.textContent,
6323
6354
  structuredContent: o.structuredContent
6324
6355
  };
6325
6356
  }
6326
- }, { FIND_TASKS: Sl, FIND_PROJECT_COLLABORATORS: Ro, UPDATE_TASKS: Cl } = y, or = D.BULK_ACTIONS_PER_OPERATION, jl = {
6357
+ }, { FIND_TASKS: El, FIND_PROJECT_COLLABORATORS: Uo, UPDATE_TASKS: Al } = y, or = D.BULK_ACTIONS_PER_OPERATION, Dl = {
6327
6358
  operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
6328
6359
  taskIds: s.array(s.string()).min(1).max(or).describe("The IDs of the tasks to operate on (max 50)."),
6329
6360
  responsibleUser: s.string().optional().describe(
@@ -6333,7 +6364,7 @@ const vl = {
6333
6364
  "For reassign operations: the current assignee to reassign from. Can be user ID, name, or email. Optional - if not provided, reassigns from any current assignee."
6334
6365
  ),
6335
6366
  dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
6336
- }, $l = {
6367
+ }, xl = {
6337
6368
  results: s.array(
6338
6369
  s.object({
6339
6370
  taskId: s.string().describe("The ID of the task."),
@@ -6349,11 +6380,11 @@ const vl = {
6349
6380
  failed: s.number().describe("Number of failed operations."),
6350
6381
  dryRun: s.boolean().describe("Whether this was a dry run.")
6351
6382
  }).optional().describe("Summary of the operation.")
6352
- }, El = {
6383
+ }, Ol = {
6353
6384
  name: y.MANAGE_ASSIGNMENTS,
6354
6385
  description: `Assign, unassign or reassign up to ${or} tasks at once. Assigning notifies the new assignee. Each task is updated independently, so one failure does not undo the others; failures are reported per task. Use dryRun to check the changes first.`,
6355
- parameters: jl,
6356
- outputSchema: $l,
6386
+ parameters: Dl,
6387
+ outputSchema: xl,
6357
6388
  // Open world: assigning a task notifies the new assignee.
6358
6389
  annotations: {
6359
6390
  readOnlyHint: !1,
@@ -6582,39 +6613,39 @@ function at({
6582
6613
  `;
6583
6614
  }
6584
6615
  return !o && r.length > 0 ? (c += `**Next steps:**
6585
- `, c += `• Use ${Sl} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
6586
- `, c += `• Use ${Cl} for individual assignment changes
6587
- `, n.length > 0 && (c += `• Check failed tasks and use ${Ro} to verify collaborator access
6616
+ `, c += `• Use ${El} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
6617
+ `, c += `• Use ${Al} for individual assignment changes
6618
+ `, n.length > 0 && (c += `• Check failed tasks and use ${Uo} to verify collaborator access
6588
6619
  `)) : o ? (c += `**To execute:**
6589
6620
  `, c += `• Remove dryRun parameter and run again to execute changes
6590
6621
  `, r.length > 0 && (c += `• ${r.length} task${r.length === 1 ? "" : "s"} ready for ${e} operation
6591
6622
  `), n.length > 0 && (c += `• Fix ${n.length} validation error${n.length === 1 ? "" : "s"} before executing
6592
6623
  `)) : r.length === 0 && (c += `**Suggestions:**
6593
- `, c += `• Use ${Ro} to find valid assignees
6624
+ `, c += `• Use ${Uo} to find valid assignees
6594
6625
  `, c += `• Check task IDs and assignee permissions
6595
6626
  `, c += `• Use dryRun=true to validate before executing
6596
6627
  `), c;
6597
6628
  }
6598
- const { FIND_PROJECTS: Al } = y, Dl = {
6629
+ const { FIND_PROJECTS: _l } = y, Pl = {
6599
6630
  action: s.enum(["archive", "unarchive", "join"]).describe("The action to perform on the project."),
6600
6631
  projectId: s.string().min(1).describe("The ID of the project.")
6601
- }, xl = {
6632
+ }, Ul = {
6602
6633
  project: me.describe("The updated project."),
6603
6634
  success: s.boolean().describe("Whether the action was successful.")
6604
- }, Ol = {
6635
+ }, Rl = {
6605
6636
  archive: "Archived",
6606
6637
  unarchive: "Unarchived",
6607
6638
  join: "Joined"
6608
- }, _l = {
6639
+ }, Nl = {
6609
6640
  name: y.PROJECT_MANAGEMENT,
6610
- description: `Archive or unarchive a project by its ID, or join a workspace project the user hasn't joined (see ${Al} includeUnjoined) when they ask to.`,
6611
- parameters: Dl,
6612
- outputSchema: xl,
6641
+ description: `Archive or unarchive a project by its ID, or join a workspace project the user hasn't joined (see ${_l} includeUnjoined) when they ask to.`,
6642
+ parameters: Pl,
6643
+ outputSchema: Ul,
6613
6644
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
6614
6645
  async execute(e, t) {
6615
- const o = await Pl(e, t), r = he(o);
6646
+ const o = await Ll(e, t), r = he(o);
6616
6647
  return {
6617
- textContent: `${Ol[e.action]} project: ${r.name} (id=${r.id})`,
6648
+ textContent: `${Rl[e.action]} project: ${r.name} (id=${r.id})`,
6618
6649
  structuredContent: {
6619
6650
  project: r,
6620
6651
  success: !0
@@ -6622,7 +6653,7 @@ const { FIND_PROJECTS: Al } = y, Dl = {
6622
6653
  };
6623
6654
  }
6624
6655
  };
6625
- async function Pl({ action: e, projectId: t }, o) {
6656
+ async function Ll({ action: e, projectId: t }, o) {
6626
6657
  switch (e) {
6627
6658
  case "archive":
6628
6659
  return o.archiveProject(t);
@@ -6639,7 +6670,7 @@ async function Pl({ action: e, projectId: t }, o) {
6639
6670
  }
6640
6671
  }
6641
6672
  }
6642
- const Rl = {
6673
+ const Ml = {
6643
6674
  action: s.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
6644
6675
  projectId: s.string().min(1).describe("The ID of the project to move."),
6645
6676
  workspaceId: s.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
@@ -6647,14 +6678,14 @@ const Rl = {
6647
6678
  visibility: s.enum(["restricted", "team", "public"]).optional().describe(
6648
6679
  "Optional access visibility for the project in the workspace (restricted, team, or public)."
6649
6680
  )
6650
- }, Ul = {
6681
+ }, Fl = {
6651
6682
  project: me.describe("The moved project."),
6652
6683
  success: s.boolean().describe("Whether the move was successful.")
6653
- }, Nl = {
6684
+ }, Hl = {
6654
6685
  name: y.PROJECT_MOVE,
6655
6686
  description: "Move a project between personal and workspace contexts.",
6656
- parameters: Rl,
6657
- outputSchema: Ul,
6687
+ parameters: Ml,
6688
+ outputSchema: Fl,
6658
6689
  // Destructive: move-to-personal removes every collaborator from the project.
6659
6690
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
6660
6691
  async execute(e, t) {
@@ -6689,7 +6720,7 @@ function sr(e, t) {
6689
6720
  for (const f of r)
6690
6721
  if (!o.has(f))
6691
6722
  throw new Error(`Sibling id=${f} is not in the list being reordered`);
6692
- const n = e.every((f) => f.key !== null), i = [...e].sort(n ? Hl : Wl).filter((f) => !r.has(f.id)), c = [...t].sort((f, h) => f.position - h.position);
6723
+ const n = e.every((f) => f.key !== null), i = [...e].sort(n ? zl : ql).filter((f) => !r.has(f.id)), c = [...t].sort((f, h) => f.position - h.position);
6693
6724
  let d;
6694
6725
  for (const { id: f, position: h } of c) {
6695
6726
  const m = o.get(f);
@@ -6697,8 +6728,8 @@ function sr(e, t) {
6697
6728
  const b = d?.position === h ? d.index + 1 : h, g = Math.min(b, i.length);
6698
6729
  i.splice(g, 0, m), d = { position: h, index: g };
6699
6730
  }
6700
- if (!n || !Ml(i, r))
6701
- return Fl(i);
6731
+ if (!n || !Bl(i, r))
6732
+ return Kl(i);
6702
6733
  const u = /* @__PURE__ */ new Map();
6703
6734
  let l = [], p = null;
6704
6735
  for (const f of i) {
@@ -6706,12 +6737,12 @@ function sr(e, t) {
6706
6737
  l.push(f);
6707
6738
  continue;
6708
6739
  }
6709
- Uo(l, p, f.key, u), l = [], p = f.key;
6740
+ Ro(l, p, f.key, u), l = [], p = f.key;
6710
6741
  }
6711
- return Uo(l, p, null, u), u;
6742
+ return Ro(l, p, null, u), u;
6712
6743
  }
6713
- function Uo(e, t, o, r) {
6714
- if (e.length === 0 || Ll(e, t, o))
6744
+ function Ro(e, t, o, r) {
6745
+ if (e.length === 0 || Wl(e, t, o))
6715
6746
  return;
6716
6747
  const n = ts(t, o, e.length);
6717
6748
  e.forEach((a, i) => {
@@ -6719,7 +6750,7 @@ function Uo(e, t, o, r) {
6719
6750
  c !== void 0 && c !== a.key && r.set(a.id, c);
6720
6751
  });
6721
6752
  }
6722
- function Ll(e, t, o) {
6753
+ function Wl(e, t, o) {
6723
6754
  let r = t;
6724
6755
  for (const { key: n } of e) {
6725
6756
  if (n === null || r !== null && n <= r)
@@ -6728,7 +6759,7 @@ function Ll(e, t, o) {
6728
6759
  }
6729
6760
  return o === null || r !== null && r < o;
6730
6761
  }
6731
- function Ml(e, t) {
6762
+ function Bl(e, t) {
6732
6763
  let o = null;
6733
6764
  for (const { id: r, key: n } of e)
6734
6765
  if (!t.has(r)) {
@@ -6738,21 +6769,21 @@ function Ml(e, t) {
6738
6769
  }
6739
6770
  return !0;
6740
6771
  }
6741
- function Fl(e) {
6772
+ function Kl(e) {
6742
6773
  const t = ts(null, null, e.length), o = /* @__PURE__ */ new Map();
6743
6774
  return e.forEach((r, n) => {
6744
6775
  const a = t[n];
6745
6776
  a !== void 0 && a !== r.key && o.set(r.id, a);
6746
6777
  }), o;
6747
6778
  }
6748
- function Hl(e, t) {
6779
+ function zl(e, t) {
6749
6780
  const o = e.key ?? "", r = t.key ?? "";
6750
6781
  return o < r ? -1 : o > r ? 1 : 0;
6751
6782
  }
6752
- function Wl(e, t) {
6783
+ function ql(e, t) {
6753
6784
  return e.legacyOrder - t.legacyOrder;
6754
6785
  }
6755
- const rr = ["project", "section"], Bl = s.object({
6786
+ const rr = ["project", "section"], Gl = s.object({
6756
6787
  id: s.string().min(1).describe("The ID of the entity."),
6757
6788
  order: s.number().int().min(0).optional().describe(
6758
6789
  "0-based position among its siblings after the reorder: 0 is first, past the end is last. Unlisted siblings keep their relative order."
@@ -6760,25 +6791,25 @@ const rr = ["project", "section"], Bl = s.object({
6760
6791
  parentId: s.string().min(1).optional().describe(
6761
6792
  'Move a personal project under this parent project ID, or "root" for the top level. Personal projects only.'
6762
6793
  )
6763
- }), Kl = {
6794
+ }), Yl = {
6764
6795
  type: s.enum(rr).describe(
6765
6796
  '"project": personal projects among the siblings under their parent, or workspace projects within their folder. "section": sections within their project.'
6766
6797
  ),
6767
- items: s.array(Bl).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe(
6798
+ items: s.array(Gl).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe(
6768
6799
  "Each item needs order and/or parentId. Moves happen first, so order is a position under the new parent."
6769
6800
  )
6770
- }, zl = {
6801
+ }, Vl = {
6771
6802
  type: s.enum(rr).describe("The type of entity that was reordered/moved."),
6772
6803
  movedCount: s.number().describe("The number of entities moved to a new parent."),
6773
6804
  reorderedCount: s.number().describe("The number of entities reordered."),
6774
6805
  affectedIds: s.array(s.string()).describe("The IDs of the entities moved or reordered."),
6775
6806
  failures: s.array(_).describe("Entities that could not be moved or reordered, with the reason for each."),
6776
6807
  success: s.boolean().describe("Whether every entity was moved and reordered as asked.")
6777
- }, ql = {
6808
+ }, Jl = {
6778
6809
  name: y.REORDER_OBJECTS,
6779
6810
  description: 'Reorder projects or sections, and optionally move personal projects to a new parent. Personal projects: order places a project among its siblings; parentId moves it ("root" for top level). Workspace projects: order places a project within its folder, in the shared default ordering every member sees; needs permission to reorder the workspace. Sections: order places a section within its project.',
6780
- parameters: Kl,
6781
- outputSchema: zl,
6811
+ parameters: Yl,
6812
+ outputSchema: Vl,
6782
6813
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
6783
6814
  async execute(e, t) {
6784
6815
  const { type: o, items: r } = e, n = /* @__PURE__ */ new Set();
@@ -6794,13 +6825,13 @@ const rr = ["project", "section"], Bl = s.object({
6794
6825
  `parentId is only supported when type is "project", but type is "${o}".`
6795
6826
  );
6796
6827
  }
6797
- const a = o === "project" ? await Gl(t, r) : await Yl(t, r);
6828
+ const a = o === "project" ? await Xl(t, r) : await Zl(t, r);
6798
6829
  O(y.REORDER_OBJECTS, r.length, a.failures);
6799
6830
  const i = o === "project" ? "projects" : "sections", c = r.map((l) => l.id).filter((l) => a.movedIds.has(l) || a.reorderedIds.has(l)), d = [];
6800
6831
  a.movedIds.size > 0 && d.push(`moved ${a.movedIds.size}`), (a.reorderedIds.size > 0 || d.length === 0) && d.push(`reordered ${a.reorderedIds.size}`);
6801
6832
  const u = c.length > 0 ? `${d.join(" and ")} ${i}: ${c.map((l) => `id=${l}`).join(", ")}` : `${d.join(" and ")} ${i}`;
6802
6833
  return {
6803
- textContent: R(u, a.failures),
6834
+ textContent: U(u, a.failures),
6804
6835
  structuredContent: {
6805
6836
  type: o,
6806
6837
  movedCount: a.movedIds.size,
@@ -6812,12 +6843,12 @@ const rr = ["project", "section"], Bl = s.object({
6812
6843
  };
6813
6844
  }
6814
6845
  };
6815
- async function Gl(e, t) {
6846
+ async function Xl(e, t) {
6816
6847
  const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = [];
6817
6848
  let a = await Lo(e);
6818
6849
  const i = [];
6819
6850
  for (const m of t) {
6820
- const b = a.get(m.id), g = b ? Vl(b, m) : "Project not found, or you do not have access to it.";
6851
+ const b = a.get(m.id), g = b ? Ql(b, m) : "Project not found, or you do not have access to it.";
6821
6852
  g ? n.push({ item: m.id, error: g }) : i.push(m);
6822
6853
  }
6823
6854
  const c = i.filter((m) => m.parentId !== void 0), d = /* @__PURE__ */ new Set();
@@ -6853,7 +6884,7 @@ async function Gl(e, t) {
6853
6884
  });
6854
6885
  return { movedIds: o, reorderedIds: r, failures: n };
6855
6886
  }
6856
- const l = nr([...a.values()].filter(Jl), No), p = /* @__PURE__ */ new Map(), f = [];
6887
+ const l = nr([...a.values()].filter(eu), No), p = /* @__PURE__ */ new Map(), f = [];
6857
6888
  for (const m of u) {
6858
6889
  const b = a.get(m.id);
6859
6890
  if (!b) {
@@ -6866,7 +6897,7 @@ async function Gl(e, t) {
6866
6897
  }
6867
6898
  const h = [];
6868
6899
  for (const [m, b] of p) {
6869
- const g = l.get(m) ?? [], w = sr(g.map(Xl), b);
6900
+ const g = l.get(m) ?? [], w = sr(g.map(tu), b);
6870
6901
  for (const [I, k] of w) {
6871
6902
  const S = a.get(I);
6872
6903
  h.push({
@@ -6880,8 +6911,8 @@ async function Gl(e, t) {
6880
6911
  }
6881
6912
  return await ar(e, h, f, r, n), { movedIds: o, reorderedIds: r, failures: n };
6882
6913
  }
6883
- async function Yl(e, t) {
6884
- const o = /* @__PURE__ */ new Set(), r = [], n = await Zl(e), a = nr(
6914
+ async function Zl(e, t) {
6915
+ const o = /* @__PURE__ */ new Set(), r = [], n = await ou(e), a = nr(
6885
6916
  [...n.values()].filter((l) => !l.isDeleted && !l.isArchived),
6886
6917
  (l) => l.projectId
6887
6918
  ), i = t.filter((l) => l.order !== void 0), c = /* @__PURE__ */ new Map(), d = [];
@@ -6940,7 +6971,7 @@ async function ar(e, t, o, r, n) {
6940
6971
  for (const { id: i } of o)
6941
6972
  a.has(i) || r.add(i);
6942
6973
  }
6943
- function Vl(e, t) {
6974
+ function Ql(e, t) {
6944
6975
  if (e.isDeleted)
6945
6976
  return "Project not found, or you do not have access to it.";
6946
6977
  if (e.isArchived)
@@ -6950,13 +6981,13 @@ function Vl(e, t) {
6950
6981
  if (W(e) && t.parentId !== void 0)
6951
6982
  return "parentId is only supported for personal projects. Workspace projects are ordered within their folder; omit parentId to reorder it there.";
6952
6983
  }
6953
- function Jl(e) {
6984
+ function eu(e) {
6954
6985
  return e.isDeleted || e.isArchived ? !1 : W(e) || !e.inboxProject;
6955
6986
  }
6956
6987
  function No(e) {
6957
6988
  return W(e) ? `workspace:${e.workspaceId}:${e.folderId ?? "root"}` : `personal:${e.parentId ?? "root"}`;
6958
6989
  }
6959
- function Xl(e) {
6990
+ function tu(e) {
6960
6991
  return W(e) ? {
6961
6992
  id: e.id,
6962
6993
  key: e.defaultOrderKey ?? null,
@@ -6969,41 +7000,41 @@ async function Lo(e) {
6969
7000
  );
6970
7001
  return new Map((t.projects ?? []).map((o) => [o.id, o]));
6971
7002
  }
6972
- async function Zl(e) {
7003
+ async function ou(e) {
6973
7004
  const t = await j(
6974
7005
  () => e.sync({ resourceTypes: ["sections"], syncToken: "*" })
6975
7006
  );
6976
7007
  return new Map((t.sections ?? []).map((o) => [o.id, o]));
6977
7008
  }
6978
- const Ql = s.object({
7009
+ const su = s.object({
6979
7010
  id: s.string().min(1).describe("The ID of the task to reschedule."),
6980
7011
  date: s.string().min(1).describe(
6981
7012
  "The new date for the task. Use YYYY-MM-DD for date-only, or YYYY-MM-DDTHH:MM:SS for datetime. If date-only is provided and the task already has a specific time, the existing time is preserved."
6982
7013
  ),
6983
7014
  duration: s.string().optional().describe('Optional new duration, e.g. for time-blocking: "15m", "1h", "2h30m".')
6984
- }), eu = {
6985
- tasks: s.array(Ql).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe("The tasks to reschedule with their new dates.")
6986
- }, tu = {
7015
+ }), ru = {
7016
+ tasks: s.array(su).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe("The tasks to reschedule with their new dates.")
7017
+ }, nu = {
6987
7018
  tasks: s.array(te).describe("The rescheduled tasks."),
6988
7019
  totalCount: s.number().describe("The total number of tasks rescheduled."),
6989
7020
  rescheduledTaskIds: s.array(s.string()).describe("The IDs of the rescheduled tasks."),
6990
7021
  failures: s.array(_).describe("Tasks that could not be rescheduled, with reasons.")
6991
- }, ou = {
7022
+ }, au = {
6992
7023
  name: y.RESCHEDULE_TASKS,
6993
7024
  description: "Reschedule tasks to new dates while preserving recurring schedules. Unlike update-tasks (which replaces the entire due string and can wipe recurrence), this tool changes only the date (and duration, if given), keeping recurrence patterns intact. Use this when moving recurring tasks to a different date or time without altering their repeat pattern. Without a due date, the deadline moves.",
6994
- parameters: eu,
6995
- outputSchema: tu,
7025
+ parameters: ru,
7026
+ outputSchema: nu,
6996
7027
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
6997
7028
  async execute(e, t) {
6998
7029
  const { tasks: o } = e, r = o.map(
6999
- (h) => h.duration ? Rt(`Task ${h.id}`, h.duration) : void 0
7030
+ (h) => h.duration ? Ut(`Task ${h.id}`, h.duration) : void 0
7000
7031
  ), n = [], a = await Promise.allSettled(
7001
7032
  o.map((h) => j(() => t.getTask(h.id)))
7002
7033
  ), i = P(o, a, (h) => h.id);
7003
7034
  n.push(...i.failures);
7004
7035
  const c = [];
7005
7036
  for (const { item: h, index: m, value: b } of i.succeeded) {
7006
- const g = su(h.date, b);
7037
+ const g = iu(h.date, b);
7007
7038
  g && c.push({
7008
7039
  id: h.id,
7009
7040
  command: Y("item_update", {
@@ -7046,7 +7077,7 @@ Could not read back ${l.join(", ")}: ${p}` : zt("Rescheduled", u, {
7046
7077
  showDetails: u.length <= 5
7047
7078
  });
7048
7079
  return {
7049
- textContent: R(f, n),
7080
+ textContent: U(f, n),
7050
7081
  structuredContent: {
7051
7082
  tasks: u,
7052
7083
  totalCount: d.length,
@@ -7056,11 +7087,11 @@ Could not read back ${l.join(", ")}: ${p}` : zt("Rescheduled", u, {
7056
7087
  };
7057
7088
  }
7058
7089
  };
7059
- function su(e, t) {
7090
+ function iu(e, t) {
7060
7091
  if (t.due)
7061
7092
  return {
7062
7093
  due: {
7063
- date: ru(e, t.due),
7094
+ date: cu(e, t.due),
7064
7095
  string: t.due.string,
7065
7096
  isRecurring: t.due.isRecurring,
7066
7097
  timezone: t.due.timezone ?? void 0,
@@ -7070,16 +7101,16 @@ function su(e, t) {
7070
7101
  if (t.deadline)
7071
7102
  return { deadline: { date: e.slice(0, 10) } };
7072
7103
  }
7073
- function ru(e, t) {
7104
+ function cu(e, t) {
7074
7105
  if (/^\d{4}-\d{2}-\d{2}$/.test(e) && t.datetime) {
7075
7106
  const r = t.datetime.substring(10);
7076
7107
  return e + r;
7077
7108
  }
7078
7109
  return e;
7079
7110
  }
7080
- const nu = {
7111
+ const du = {
7081
7112
  query: s.string().min(1).describe("The search query string to find tasks and projects.")
7082
- }, au = {
7113
+ }, lu = {
7083
7114
  results: s.array(
7084
7115
  s.object({
7085
7116
  id: s.string().describe("The ID of the result."),
@@ -7088,11 +7119,11 @@ const nu = {
7088
7119
  })
7089
7120
  ).describe("The search results."),
7090
7121
  totalCount: s.number().describe("Total number of results found.")
7091
- }, iu = {
7122
+ }, uu = {
7092
7123
  name: y.SEARCH,
7093
7124
  description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
7094
- parameters: nu,
7095
- outputSchema: au,
7125
+ parameters: du,
7126
+ outputSchema: lu,
7096
7127
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
7097
7128
  async execute(e, t) {
7098
7129
  const { query: o } = e, [r, n] = await Promise.all([
@@ -7121,8 +7152,8 @@ const nu = {
7121
7152
  structuredContent: { results: a, totalCount: a.length }
7122
7153
  };
7123
7154
  }
7124
- }, cu = 80, du = {
7125
- message: s.string().trim().min(1).max(cu).optional().describe("Omit for an emoji-only status."),
7155
+ }, pu = 80, hu = {
7156
+ message: s.string().trim().min(1).max(pu).optional().describe("Omit for an emoji-only status."),
7126
7157
  emoji: s.string().trim().min(1).optional().describe("A Unicode emoji, such as 🏝️."),
7127
7158
  activeUntil: s.string().trim().optional().describe(
7128
7159
  "When it ends: a future ISO 8601 timestamp with Z or an offset, e.g. 2026-11-10T00:00:00+00:00. Omit for no end."
@@ -7130,20 +7161,20 @@ const nu = {
7130
7161
  pauseNotifications: s.boolean().optional().describe("Hold back Comms notifications while active. They are not sent later."),
7131
7162
  pauseActivity: s.boolean().optional().describe("Pause Karma and streaks while active."),
7132
7163
  clear: s.boolean().optional().describe("Remove the status. Use alone.")
7133
- }, lu = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|([+-])(\d{2}):(\d{2}))$/i, uu = -720, pu = 840;
7164
+ }, mu = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|([+-])(\d{2}):(\d{2}))$/i, fu = -720, bu = 840;
7134
7165
  function it(e) {
7135
7166
  return new Error(
7136
7167
  `activeUntil must be an ISO 8601 timestamp with Z or an offset, such as "2026-11-10T00:00:00+00:00". Got "${e}".`
7137
7168
  );
7138
7169
  }
7139
- function hu(e, t) {
7140
- const o = lu.exec(e);
7170
+ function gu(e, t) {
7171
+ const o = mu.exec(e);
7141
7172
  if (!o)
7142
7173
  throw it(e);
7143
7174
  const [, r, n, a, i, c, d = "0", u = ""] = o, [l, p, f, h, m, b] = [r, n, a, i, c, d].map(Number), g = /* @__PURE__ */ new Date(0);
7144
7175
  g.setUTCFullYear(l, p - 1, f), g.setUTCHours(h, m, b);
7145
7176
  const w = g.getUTCFullYear() === l && g.getUTCMonth() === p - 1 && g.getUTCDate() === f && g.getUTCHours() === h && g.getUTCMinutes() === m && g.getUTCSeconds() === b, I = u.toUpperCase() === "Z" ? 0 : Ze(u);
7146
- if (!w || I < uu || I > pu)
7177
+ if (!w || I < fu || I > bu)
7147
7178
  throw it(e);
7148
7179
  const k = new Date(e);
7149
7180
  if (Number.isNaN(k.getTime()))
@@ -7153,7 +7184,7 @@ function hu(e, t) {
7153
7184
  return k.toISOString();
7154
7185
  }
7155
7186
  const Mo = { scope: { mode: "all" } };
7156
- function mu(e, t) {
7187
+ function yu(e, t) {
7157
7188
  const { clear: o, message: r, emoji: n, activeUntil: a, pauseNotifications: i, pauseActivity: c } = e;
7158
7189
  if (o) {
7159
7190
  if (r !== void 0 || n !== void 0 || a !== void 0 || i === !0 || c === !0)
@@ -7167,7 +7198,7 @@ function mu(e, t) {
7167
7198
  return {
7168
7199
  message: r ?? null,
7169
7200
  emoji: n ?? null,
7170
- activeUntil: a !== void 0 ? hu(a, t) : null,
7201
+ activeUntil: a !== void 0 ? gu(a, t) : null,
7171
7202
  effects: i || c ? {
7172
7203
  pauseNotifications: i ? Mo : null,
7173
7204
  pauseActivity: c ? Mo : null
@@ -7177,17 +7208,17 @@ function mu(e, t) {
7177
7208
  function Fo(e) {
7178
7209
  return e ? e.replace(/\uFE0F/g, "") : null;
7179
7210
  }
7180
- function fu(e, t) {
7211
+ function wu(e, t) {
7181
7212
  const o = e.activeUntil ? new Date(e.activeUntil).getTime() : null, r = t.activeUntil ? new Date(t.activeUntil).getTime() : null;
7182
7213
  return (
7183
7214
  // An emoji-only status may be held with its message null or left out.
7184
7215
  (e.message ?? null) === (t.message ?? null) && Fo(e.emoji) === Fo(t.emoji) && o === r && !!e.effects?.pauseNotifications == !!t.effects?.pauseNotifications && !!e.effects?.pauseActivity == !!t.effects?.pauseActivity
7185
7216
  );
7186
7217
  }
7187
- const bu = {
7218
+ const Tu = {
7188
7219
  name: y.SET_USER_STATUS,
7189
7220
  description: "Set or clear the user's status, shown next to their name in Todoist and Comms. It needs a message, an emoji or both. Replaces the whole status: any field omitted is removed, not kept. Use clear to remove the status.",
7190
- parameters: du,
7221
+ parameters: hu,
7191
7222
  outputSchema: er,
7192
7223
  annotations: {
7193
7224
  readOnlyHint: !1,
@@ -7196,7 +7227,7 @@ const bu = {
7196
7227
  openWorldHint: !0
7197
7228
  },
7198
7229
  async execute(e, t) {
7199
- const o = mu(e, /* @__PURE__ */ new Date()), {
7230
+ const o = yu(e, /* @__PURE__ */ new Date()), {
7200
7231
  outcomes: [r]
7201
7232
  } = await V(t, [Y("user_update", { status: o })]);
7202
7233
  if (r?.status !== "fulfilled")
@@ -7217,30 +7248,30 @@ const bu = {
7217
7248
  throw new Error(
7218
7249
  "Todoist accepted the status but reports no active status, so it may have expired already."
7219
7250
  );
7220
- if (!fu(n, o))
7251
+ if (!wu(n, o))
7221
7252
  throw new Error(
7222
7253
  `Todoist accepted the status but reports a different one. Another app may have changed it at the same moment; use ${y.GET_USER_STATUS} to see it.`
7223
7254
  );
7224
7255
  return Ct(n, "Status set");
7225
7256
  }
7226
- }, gu = {
7257
+ }, ku = {
7227
7258
  ids: s.array(s.string().min(1)).min(1).max(D.BULK_ACTIONS_PER_OPERATION).describe("The IDs of the tasks to uncomplete.")
7228
- }, yu = {
7259
+ }, Iu = {
7229
7260
  uncompleted: s.array(s.string()).describe("The IDs of successfully uncompleted tasks."),
7230
7261
  failures: s.array(_).describe("Failed task uncompletion with error details."),
7231
7262
  totalRequested: s.number().describe("The total number of tasks requested to uncomplete."),
7232
7263
  successCount: s.number().describe("The number of successfully uncompleted tasks."),
7233
7264
  failureCount: s.number().describe("The number of failed task uncompletions.")
7234
- }, wu = {
7265
+ }, vu = {
7235
7266
  name: y.UNCOMPLETE_TASKS,
7236
7267
  description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
7237
- parameters: gu,
7238
- outputSchema: yu,
7268
+ parameters: ku,
7269
+ outputSchema: Iu,
7239
7270
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
7240
7271
  async execute(e, t) {
7241
- const o = await Tu(t, e.ids), { succeeded: r, failures: n } = P(e.ids, o, (c) => c), a = r.map(({ item: c }) => c);
7272
+ const o = await Su(t, e.ids), { succeeded: r, failures: n } = P(e.ids, o, (c) => c), a = r.map(({ item: c }) => c);
7242
7273
  return O(y.UNCOMPLETE_TASKS, e.ids.length, n), {
7243
- textContent: ku({
7274
+ textContent: Cu({
7244
7275
  uncompleted: a,
7245
7276
  failures: n,
7246
7277
  args: e
@@ -7255,7 +7286,7 @@ const bu = {
7255
7286
  };
7256
7287
  }
7257
7288
  };
7258
- async function Tu(e, t) {
7289
+ async function Su(e, t) {
7259
7290
  const o = [...new Set(t)], { outcomes: r } = await V(
7260
7291
  e,
7261
7292
  o.map((a) => Y("item_uncomplete", { id: a })),
@@ -7268,7 +7299,7 @@ async function Tu(e, t) {
7268
7299
  }
7269
7300
  );
7270
7301
  }
7271
- function ku({
7302
+ function Cu({
7272
7303
  uncompleted: e,
7273
7304
  failures: t,
7274
7305
  args: o
@@ -7282,12 +7313,12 @@ function ku({
7282
7313
  failures: t
7283
7314
  });
7284
7315
  }
7285
- const Iu = s.object({
7316
+ const ju = s.object({
7286
7317
  id: s.string().min(1).describe("The ID of the comment to update."),
7287
7318
  content: s.string().min(1).describe("The new content for the comment.")
7288
- }), vu = {
7289
- comments: s.array(Iu).min(1).max(D.ITEMS_PER_OPERATION).describe("The comments to update.")
7290
- }, Su = {
7319
+ }), $u = {
7320
+ comments: s.array(ju).min(1).max(D.ITEMS_PER_OPERATION).describe("The comments to update.")
7321
+ }, Eu = {
7291
7322
  comments: s.array(Le).describe("The updated comments."),
7292
7323
  totalCount: s.number().describe("The total number of comments updated."),
7293
7324
  updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
@@ -7296,11 +7327,11 @@ const Iu = s.object({
7296
7327
  updateCount: s.number().describe("The number of comments updated."),
7297
7328
  failureCount: s.number()
7298
7329
  }).describe("Summary of operations performed.")
7299
- }, Cu = {
7330
+ }, Au = {
7300
7331
  name: y.UPDATE_COMMENTS,
7301
7332
  description: "Update multiple existing comments with new content.",
7302
- parameters: vu,
7303
- outputSchema: Su,
7333
+ parameters: $u,
7334
+ outputSchema: Eu,
7304
7335
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
7305
7336
  async execute(e, t) {
7306
7337
  const { comments: o } = e, r = await Promise.allSettled(
@@ -7311,8 +7342,8 @@ const Iu = s.object({
7311
7342
  )
7312
7343
  ), { succeeded: n, failures: a } = P(o, r, (d) => d.id), i = n.map(({ value: d }) => Ne(d));
7313
7344
  return O(y.UPDATE_COMMENTS, o.length, a), {
7314
- textContent: R(
7315
- ju({ comments: i }),
7345
+ textContent: U(
7346
+ Du({ comments: i }),
7316
7347
  a
7317
7348
  ),
7318
7349
  structuredContent: {
@@ -7328,7 +7359,7 @@ const Iu = s.object({
7328
7359
  };
7329
7360
  }
7330
7361
  };
7331
- function ju({ comments: e }) {
7362
+ function Du({ comments: e }) {
7332
7363
  const t = e.filter((a) => a.taskId).length, o = e.filter((a) => a.projectId).length, r = [];
7333
7364
  if (t > 0) {
7334
7365
  const a = t > 1 ? "comments" : "comment";
@@ -7340,7 +7371,7 @@ function ju({ comments: e }) {
7340
7371
  }
7341
7372
  return r.length > 0 ? `Updated ${r.join(" and ")}` : "No comments updated";
7342
7373
  }
7343
- const $u = s.object({
7374
+ const xu = s.object({
7344
7375
  id: s.string().min(1).describe("The ID of the filter to update."),
7345
7376
  name: s.string().min(1).optional().describe("The new name of the filter."),
7346
7377
  query: s.string().min(1).optional().describe(
@@ -7355,9 +7386,9 @@ const $u = s.object({
7355
7386
  ).optional(),
7356
7387
  color: je,
7357
7388
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
7358
- }), Eu = {
7359
- filters: s.array($u).min(1).max(D.ITEMS_PER_OPERATION).describe("The filters to update.")
7360
- }, Au = {
7389
+ }), Ou = {
7390
+ filters: s.array(xu).min(1).max(D.ITEMS_PER_OPERATION).describe("The filters to update.")
7391
+ }, _u = {
7361
7392
  filters: s.array(Gt).describe(
7362
7393
  "The updated filters, as read back after the update. Empty if they could not be read back; updatedFilterIds still lists what was updated."
7363
7394
  ),
@@ -7369,15 +7400,15 @@ const $u = s.object({
7369
7400
  skippedCount: s.number().describe("The number of filters skipped (no changes)."),
7370
7401
  failureCount: s.number()
7371
7402
  }).describe("Summary of operations performed.")
7372
- }, Du = {
7403
+ }, Pu = {
7373
7404
  name: y.UPDATE_FILTERS,
7374
7405
  description: "Update one or more existing personal filters with new values.",
7375
- parameters: Eu,
7376
- outputSchema: Au,
7406
+ parameters: Ou,
7407
+ outputSchema: _u,
7377
7408
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
7378
7409
  async execute(e, t) {
7379
7410
  const { filters: o } = e, r = [], a = o.map((m) => {
7380
- const b = _u(m);
7411
+ const b = Nu(m);
7381
7412
  return b !== null ? { kind: "skipped", reason: b } : (r.push(m), { kind: "updated", filter: m });
7382
7413
  }).filter((m) => m.kind === "skipped").length;
7383
7414
  if (r.length === 0)
@@ -7415,11 +7446,11 @@ const $u = s.object({
7415
7446
  error: f
7416
7447
  });
7417
7448
  }
7418
- m && (p = xu(m, new Set(l)));
7449
+ m && (p = Uu(m, new Set(l)));
7419
7450
  }
7420
7451
  return {
7421
- textContent: R(
7422
- Ou({
7452
+ textContent: U(
7453
+ Ru({
7423
7454
  filters: p,
7424
7455
  updatedIds: l,
7425
7456
  skippedCount: a,
@@ -7441,7 +7472,7 @@ const $u = s.object({
7441
7472
  };
7442
7473
  }
7443
7474
  };
7444
- function xu(e, t) {
7475
+ function Uu(e, t) {
7445
7476
  return e.filter((o) => !o.isDeleted && t.has(o.id)).map((o) => ({
7446
7477
  id: o.id,
7447
7478
  name: o.name,
@@ -7452,7 +7483,7 @@ function xu(e, t) {
7452
7483
  itemOrder: o.itemOrder
7453
7484
  }));
7454
7485
  }
7455
- function Ou({
7486
+ function Ru({
7456
7487
  filters: e,
7457
7488
  updatedIds: t,
7458
7489
  skippedCount: o,
@@ -7471,24 +7502,24 @@ ${i}`;
7471
7502
  }
7472
7503
  return a;
7473
7504
  }
7474
- function _u({ id: e, ...t }) {
7505
+ function Nu({ id: e, ...t }) {
7475
7506
  return Object.values(t).every((r) => r === void 0) ? "no-fields" : null;
7476
7507
  }
7477
- const Pu = s.object({
7508
+ const Lu = s.object({
7478
7509
  id: s.string().min(1).describe("The ID of the folder to rename."),
7479
7510
  name: s.string().min(1).describe("The new name of the folder.")
7480
- }), Ru = {
7481
- folders: s.array(Pu).min(1).max(D.ITEMS_PER_OPERATION).describe("The folders to rename.")
7482
- }, Uu = {
7511
+ }), Mu = {
7512
+ folders: s.array(Lu).min(1).max(D.ITEMS_PER_OPERATION).describe("The folders to rename.")
7513
+ }, Fu = {
7483
7514
  folders: s.array(Wt).describe("The renamed folders."),
7484
7515
  failures: s.array(_).describe("Folders that could not be renamed, with the reason for each."),
7485
7516
  successCount: s.number(),
7486
7517
  failureCount: s.number()
7487
- }, Nu = {
7518
+ }, Hu = {
7488
7519
  name: y.UPDATE_FOLDERS,
7489
7520
  description: "Rename one or more workspace folders.",
7490
- parameters: Ru,
7491
- outputSchema: Uu,
7521
+ parameters: Mu,
7522
+ outputSchema: Fu,
7492
7523
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
7493
7524
  async execute({ folders: e }, t) {
7494
7525
  const o = await Promise.allSettled(
@@ -7497,7 +7528,7 @@ const Pu = s.object({
7497
7528
  )
7498
7529
  ), { succeeded: r, failures: n } = P(e, o, (i) => i.id), a = r.map(({ value: i }) => i);
7499
7530
  return O(y.UPDATE_FOLDERS, e.length, n), {
7500
- textContent: Lu(a, n),
7531
+ textContent: Wu(a, n),
7501
7532
  structuredContent: {
7502
7533
  folders: a.map(Bt),
7503
7534
  failures: n,
@@ -7507,38 +7538,38 @@ const Pu = s.object({
7507
7538
  };
7508
7539
  }
7509
7540
  };
7510
- function Lu(e, t) {
7541
+ function Wu(e, t) {
7511
7542
  const o = e.length, r = e.map((a) => `• ${a.name} (id=${a.id})`), n = o > 0 ? `Renamed ${o} folder${o === 1 ? "" : "s"}:
7512
7543
  ${r.join(`
7513
7544
  `)}` : "Renamed 0 folders";
7514
- return R(n, t);
7545
+ return U(n, t);
7515
7546
  }
7516
- const Mu = s.object({
7547
+ const Bu = s.object({
7517
7548
  labelType: s.literal("personal").describe("Update a personal label, identified by its ID."),
7518
7549
  id: s.string().min(1).describe("The ID of the personal label to update."),
7519
7550
  name: s.string().min(1).max(128).optional().describe("The new name of the label."),
7520
7551
  color: je,
7521
7552
  order: s.number().int().optional().describe("The new position of the label in the label list."),
7522
7553
  isFavorite: s.boolean().optional().describe("Whether to mark the label as a favorite.")
7523
- }), Fu = s.object({
7554
+ }), Ku = s.object({
7524
7555
  labelType: s.literal("shared").describe(
7525
7556
  "Rename a shared label across all tasks. Shared labels are identified by name; only renaming is supported (no color, order, or favorite)."
7526
7557
  ),
7527
7558
  name: s.string().min(1).describe("The current name of the shared label."),
7528
7559
  newName: s.string().min(1).describe("The new name for the shared label.")
7529
- }), Hu = s.discriminatedUnion("labelType", [
7530
- Mu,
7531
- Fu
7532
- ]), Wu = {
7533
- labels: s.array(Hu).min(1).max(D.ITEMS_PER_OPERATION).describe(
7560
+ }), zu = s.discriminatedUnion("labelType", [
7561
+ Bu,
7562
+ Ku
7563
+ ]), qu = {
7564
+ labels: s.array(zu).min(1).max(D.ITEMS_PER_OPERATION).describe(
7534
7565
  'The labels to update. Use labelType="personal" with an ID to update a personal label, or labelType="shared" with name+newName to rename a shared label.'
7535
7566
  )
7536
- }, Bu = s.object({
7567
+ }, Gu = s.object({
7537
7568
  name: s.string().describe("The previous name of the shared label."),
7538
7569
  newName: s.string().describe("The new name of the shared label.")
7539
- }), Ku = {
7570
+ }), Yu = {
7540
7571
  updatedLabels: s.array(Ee).describe("The updated personal labels."),
7541
- renamedSharedLabels: s.array(Bu).describe("The shared labels that were renamed."),
7572
+ renamedSharedLabels: s.array(Gu).describe("The shared labels that were renamed."),
7542
7573
  totalCount: s.number().describe("The total number of successful operations (personal + shared)."),
7543
7574
  failures: s.array(_).describe(
7544
7575
  "Labels that could not be updated, identified by ID (personal) or name (shared), with the reason for each."
@@ -7549,17 +7580,17 @@ const Mu = s.object({
7549
7580
  skippedCount: s.number().describe("Number of operations skipped (no changes or shared label not found)."),
7550
7581
  failureCount: s.number()
7551
7582
  }).describe("Summary of operations performed.")
7552
- }, zu = {
7583
+ }, Vu = {
7553
7584
  name: y.UPDATE_LABELS,
7554
7585
  description: "Update one or more existing labels. Personal labels (identified by ID) can have their name, color, order, and favorite flag updated. Shared labels (identified by name) can only be renamed.",
7555
- parameters: Wu,
7556
- outputSchema: Ku,
7586
+ parameters: qu,
7587
+ outputSchema: Yu,
7557
7588
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
7558
7589
  async execute(e, t) {
7559
7590
  const { labels: o } = e, r = await Promise.allSettled(
7560
7591
  o.map(async (h) => {
7561
7592
  if (h.labelType === "personal") {
7562
- const b = Gu(h);
7593
+ const b = Xu(h);
7563
7594
  if (b !== null) return { kind: "skipped", reason: b };
7564
7595
  const { id: g, labelType: w, ...I } = h;
7565
7596
  return { kind: "updated", label: await j(() => t.updateLabel(g, I)) };
@@ -7582,8 +7613,8 @@ const Mu = s.object({
7582
7613
  (h) => h.kind === "skipped" && h.reason === "not-found"
7583
7614
  ).length;
7584
7615
  return {
7585
- textContent: R(
7586
- qu({
7616
+ textContent: U(
7617
+ Ju({
7587
7618
  updatedLabels: c,
7588
7619
  renamedSharedLabels: d,
7589
7620
  skippedNoFields: l,
@@ -7606,7 +7637,7 @@ const Mu = s.object({
7606
7637
  };
7607
7638
  }
7608
7639
  };
7609
- function qu({
7640
+ function Ju({
7610
7641
  updatedLabels: e,
7611
7642
  renamedSharedLabels: t,
7612
7643
  skippedNoFields: o,
@@ -7628,14 +7659,14 @@ function qu({
7628
7659
  return c.join(`
7629
7660
  `);
7630
7661
  }
7631
- function Gu({
7662
+ function Xu({
7632
7663
  id: e,
7633
7664
  labelType: t,
7634
7665
  ...o
7635
7666
  }) {
7636
7667
  return Object.values(o).every((n) => n === void 0) ? "no-fields" : null;
7637
7668
  }
7638
- const { FIND_FOLDERS: Yu } = y, Vu = s.object({
7669
+ const { FIND_FOLDERS: Zu } = y, Qu = s.object({
7639
7670
  id: s.string().min(1).describe("The ID of the project to update."),
7640
7671
  name: s.string().min(1).optional().describe("The new name of the project."),
7641
7672
  isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
@@ -7652,11 +7683,11 @@ const { FIND_FOLDERS: Yu } = y, Vu = s.object({
7652
7683
  color: je,
7653
7684
  icon: s.enum([...Vo, "remove"]).optional().describe('The project icon, or "remove" to restore the default # icon.'),
7654
7685
  folderId: s.string().min(1).optional().describe(
7655
- `Move a workspace project into this folder (see ${Yu}), or "remove" for the workspace's top level.`
7686
+ `Move a workspace project into this folder (see ${Zu}), or "remove" for the workspace's top level.`
7656
7687
  )
7657
- }), Ju = {
7658
- projects: s.array(Vu).min(1).max(D.ITEMS_PER_OPERATION).describe("The projects to update.")
7659
- }, Xu = {
7688
+ }), ep = {
7689
+ projects: s.array(Qu).min(1).max(D.ITEMS_PER_OPERATION).describe("The projects to update.")
7690
+ }, tp = {
7660
7691
  projects: s.array(me).describe("The updated projects."),
7661
7692
  totalCount: s.number().describe("The total number of projects updated."),
7662
7693
  updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
@@ -7666,16 +7697,16 @@ const { FIND_FOLDERS: Yu } = y, Vu = s.object({
7666
7697
  skippedCount: s.number().describe("The number of projects skipped (no changes)."),
7667
7698
  failureCount: s.number()
7668
7699
  }).describe("Summary of operations performed.")
7669
- }, Zu = {
7700
+ }, op = {
7670
7701
  name: y.UPDATE_PROJECTS,
7671
7702
  description: "Update multiple existing projects with new values.",
7672
- parameters: Ju,
7673
- outputSchema: Xu,
7703
+ parameters: ep,
7704
+ outputSchema: tp,
7674
7705
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
7675
7706
  async execute(e, t) {
7676
7707
  const { projects: o } = e, r = await Promise.allSettled(
7677
7708
  o.map(async (l) => {
7678
- const p = ep(l);
7709
+ const p = rp(l);
7679
7710
  if (p !== null) return { kind: "skipped", reason: p };
7680
7711
  const { id: f, folderId: h, icon: m, ...b } = l, g = {
7681
7712
  ...b,
@@ -7689,7 +7720,7 @@ const { FIND_FOLDERS: Yu } = y, Vu = s.object({
7689
7720
  for (const { value: l } of n)
7690
7721
  l.kind === "updated" ? i.push(he(l.project)) : l.reason === "no-fields" ? c++ : d++;
7691
7722
  return O(y.UPDATE_PROJECTS, o.length, a), {
7692
- textContent: Qu({
7723
+ textContent: sp({
7693
7724
  projects: i,
7694
7725
  skippedNoFields: c,
7695
7726
  skippedNoValidValues: d,
@@ -7709,7 +7740,7 @@ const { FIND_FOLDERS: Yu } = y, Vu = s.object({
7709
7740
  };
7710
7741
  }
7711
7742
  };
7712
- function Qu({
7743
+ function sp({
7713
7744
  projects: e,
7714
7745
  skippedNoFields: t,
7715
7746
  skippedNoValidValues: o,
@@ -7720,27 +7751,27 @@ function Qu({
7720
7751
  let i = `Updated ${n} project${n === 1 ? "" : "s"}`;
7721
7752
  const c = [];
7722
7753
  return t > 0 && c.push(`${t} skipped - no changes`), o > 0 && c.push(`${o} skipped - no valid field values`), c.length > 0 && (i += ` (${c.join(", ")})`), n > 0 && (i += `:
7723
- ${a}`), R(i, r);
7754
+ ${a}`), U(i, r);
7724
7755
  }
7725
- function ep({ id: e, ...t }) {
7756
+ function rp({ id: e, ...t }) {
7726
7757
  const o = Object.values(t);
7727
7758
  return o.length === 0 ? "no-fields" : o.every((r) => r === void 0) ? "no-valid-values" : null;
7728
7759
  }
7729
- const tp = s.object({
7760
+ const np = s.object({
7730
7761
  type: s.literal("relative"),
7731
7762
  id: s.string().min(1).describe("The ID of the relative reminder to update."),
7732
7763
  minuteOffset: s.number().int().min(0).optional().describe("New minute offset before task due time."),
7733
7764
  service: Je.optional().describe('New delivery method: "email" or "push".'),
7734
7765
  isUrgent: Xe,
7735
7766
  notifyUser: Xt
7736
- }), op = s.object({
7767
+ }), ap = s.object({
7737
7768
  type: s.literal("absolute"),
7738
7769
  id: s.string().min(1).describe("The ID of the absolute reminder to update."),
7739
7770
  due: _s.optional().describe("New due date/time for the reminder."),
7740
7771
  service: Je.optional().describe('New delivery method: "email" or "push".'),
7741
7772
  isUrgent: Xe,
7742
7773
  notifyUser: Xt
7743
- }), sp = s.object({
7774
+ }), ip = s.object({
7744
7775
  type: s.literal("location"),
7745
7776
  id: s.string().min(1).describe("The ID of the location reminder to update."),
7746
7777
  name: s.string().optional().describe("New location name."),
@@ -7751,15 +7782,15 @@ const tp = s.object({
7751
7782
  ),
7752
7783
  radius: s.number().int().optional().describe("New radius in meters."),
7753
7784
  notifyUser: Xt
7754
- }), rp = s.discriminatedUnion("type", [
7755
- tp,
7756
- op,
7757
- sp
7758
- ]), np = {
7759
- reminders: s.array(rp).min(1).max(Be).describe(
7785
+ }), cp = s.discriminatedUnion("type", [
7786
+ np,
7787
+ ap,
7788
+ ip
7789
+ ]), dp = {
7790
+ reminders: s.array(cp).min(1).max(Be).describe(
7760
7791
  `Array of reminders to update (max ${Be}). Each must include the reminder type and ID. Only include fields that need to change.`
7761
7792
  )
7762
- }, ap = {
7793
+ }, lp = {
7763
7794
  reminders: s.array(Kt).describe("The updated reminders."),
7764
7795
  totalCount: s.number().describe("Total reminders updated."),
7765
7796
  updatedReminderIds: s.array(s.string()).describe("IDs of updated reminders."),
@@ -7768,11 +7799,11 @@ const tp = s.object({
7768
7799
  updateCount: s.number(),
7769
7800
  failureCount: s.number()
7770
7801
  })
7771
- }, ip = {
7802
+ }, up = {
7772
7803
  name: y.UPDATE_REMINDERS,
7773
7804
  description: 'Update existing reminders. Each reminder must specify its type ("relative", "absolute", or "location") and ID. Only include fields that need to change.',
7774
- parameters: np,
7775
- outputSchema: ap,
7805
+ parameters: dp,
7806
+ outputSchema: lp,
7776
7807
  annotations: {
7777
7808
  readOnlyHint: !1,
7778
7809
  destructiveHint: !0,
@@ -7829,7 +7860,7 @@ const tp = s.object({
7829
7860
  O(y.UPDATE_REMINDERS, o.length, i);
7830
7861
  const u = c.length === 1 ? "reminder" : "reminders";
7831
7862
  return {
7832
- textContent: R(
7863
+ textContent: U(
7833
7864
  [
7834
7865
  `Updated ${c.length} ${u}`,
7835
7866
  ...Os(c, d)
@@ -7849,7 +7880,7 @@ const tp = s.object({
7849
7880
  }
7850
7881
  };
7851
7882
  }
7852
- }, cp = s.object({
7883
+ }, pp = s.object({
7853
7884
  id: s.string().min(1).describe("The ID of the section to update."),
7854
7885
  name: s.string().min(1).optional().describe("The new name of the section."),
7855
7886
  description: s.preprocess(
@@ -7864,9 +7895,9 @@ const tp = s.object({
7864
7895
  ).optional()
7865
7896
  }).refine((e) => e.name !== void 0 || e.description !== void 0, {
7866
7897
  message: 'Provide at least one of "name" or "description" to update.'
7867
- }), dp = {
7868
- sections: s.array(cp).min(1).max(D.ITEMS_PER_OPERATION).describe("The sections to update.")
7869
- }, lp = {
7898
+ }), hp = {
7899
+ sections: s.array(pp).min(1).max(D.ITEMS_PER_OPERATION).describe("The sections to update.")
7900
+ }, mp = {
7870
7901
  sections: s.array(re).describe("The updated sections."),
7871
7902
  totalCount: s.number().describe("The total number of sections updated."),
7872
7903
  updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections."),
@@ -7875,11 +7906,11 @@ const tp = s.object({
7875
7906
  updateCount: s.number(),
7876
7907
  failureCount: s.number()
7877
7908
  })
7878
- }, up = {
7909
+ }, fp = {
7879
7910
  name: y.UPDATE_SECTIONS,
7880
7911
  description: "Update multiple existing sections with new values.",
7881
- parameters: dp,
7882
- outputSchema: lp,
7912
+ parameters: hp,
7913
+ outputSchema: mp,
7883
7914
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
7884
7915
  async execute({ sections: e }, t) {
7885
7916
  const o = await Promise.allSettled(
@@ -7892,7 +7923,7 @@ const tp = s.object({
7892
7923
  })
7893
7924
  ), { succeeded: r, failures: n } = P(e, o, (c) => c.id), a = r.map(({ value: c }) => c);
7894
7925
  return O(y.UPDATE_SECTIONS, e.length, n), {
7895
- textContent: pp({
7926
+ textContent: bp({
7896
7927
  sections: a,
7897
7928
  failures: n
7898
7929
  }),
@@ -7909,39 +7940,39 @@ const tp = s.object({
7909
7940
  };
7910
7941
  }
7911
7942
  };
7912
- function pp({
7943
+ function bp({
7913
7944
  sections: e,
7914
7945
  failures: t
7915
7946
  }) {
7916
7947
  const o = e.length, r = e.map((a) => `• ${a.name} (id=${a.id}, projectId=${a.projectId})`).join(`
7917
7948
  `), n = o > 0 ? `Updated ${o} section${o === 1 ? "" : "s"}:
7918
7949
  ${r}` : "Updated 0 sections";
7919
- return R(n, t);
7950
+ return U(n, t);
7920
7951
  }
7921
7952
  function ir(e, t) {
7922
7953
  return t.projectId !== void 0 ? e.projectId === t.projectId && !e.sectionId && !e.parentId : t.sectionId !== void 0 ? e.sectionId === t.sectionId && !e.parentId : e.parentId === t.parentId;
7923
7954
  }
7924
- function hp(e, t) {
7955
+ function gp(e, t) {
7925
7956
  return t.projectId !== void 0 ? e.projectId === t.projectId : t.sectionId !== void 0 ? e.sectionId === t.sectionId : e.parentId === t.parentId;
7926
7957
  }
7927
- function mp(e) {
7958
+ function yp(e) {
7928
7959
  return e.projectId !== void 0 ? `project:${e.projectId}` : e.sectionId !== void 0 ? `section:${e.sectionId}` : `parent:${e.parentId}`;
7929
7960
  }
7930
- function fp(e) {
7961
+ function wp(e) {
7931
7962
  const t = [];
7932
7963
  return e.projectId && t.push({ projectId: e.projectId }), e.sectionId && t.push({ sectionId: e.sectionId }), e.parentId && t.push({ parentId: e.parentId }), t;
7933
7964
  }
7934
- function bp({
7965
+ function Tp({
7935
7966
  taskId: e,
7936
7967
  request: t,
7937
7968
  current: o
7938
7969
  }) {
7939
- const r = fp(t);
7970
+ const r = wp(t);
7940
7971
  if (r.length === 0)
7941
7972
  return { redundantMoveSkipped: !1 };
7942
7973
  let n = r, a = !1;
7943
7974
  if (o) {
7944
- const i = r.length === 1 ? (c) => ir(o, c) : (c) => hp(o, c);
7975
+ const i = r.length === 1 ? (c) => ir(o, c) : (c) => gp(o, c);
7945
7976
  n = r.filter((c) => !i(c)), a = n.length < r.length;
7946
7977
  }
7947
7978
  if (n.length === 0)
@@ -7952,7 +7983,7 @@ function bp({
7952
7983
  );
7953
7984
  return { move: n[0], redundantMoveSkipped: a };
7954
7985
  }
7955
- const gp = s.object({
7986
+ const kp = s.object({
7956
7987
  id: s.string().min(1).describe("The ID of the task to update."),
7957
7988
  content: s.string().optional().describe(
7958
7989
  'The new task name/title. Should be concise and actionable (e.g., "Review PR #123", "Call dentist"). For longer content, use the description field instead. Supports Markdown.'
@@ -7968,7 +7999,7 @@ const gp = s.object({
7968
7999
  ),
7969
8000
  parentId: s.string().optional().describe("Make the task a subtask of this task ID. Omit unless the parent should change."),
7970
8001
  order: s.number().optional().describe("The new order of the task within its parent/section."),
7971
- priority: Nt.optional().describe(Ut),
8002
+ priority: Nt.optional().describe(Rt),
7972
8003
  dueString: s.preprocess(
7973
8004
  // Keep accepting legacy null while exposing a Gemini-compatible string schema.
7974
8005
  (e) => e === null ? "remove" : e,
@@ -7998,9 +8029,9 @@ const gp = s.object({
7998
8029
  isUncompletable: s.boolean().optional().describe(
7999
8030
  "Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
8000
8031
  )
8001
- }), yp = (e) => !!(e.projectId || e.sectionId || e.parentId), cr = (e) => Object.keys(e).length > 0, wp = ["remove", "no date"], Tp = ["remove", "no date", "no deadline"], Ho = "no date", jt = D.TASKS_PER_OPERATION, Wo = {
8002
- tasks: s.array(gp).min(1).max(jt).describe(`The tasks to update (max ${jt}).`)
8003
- }, kp = {
8032
+ }), Ip = (e) => !!(e.projectId || e.sectionId || e.parentId), cr = (e) => Object.keys(e).length > 0, vp = ["remove", "no date"], Sp = ["remove", "no date", "no deadline"], Ho = "no date", jt = D.TASKS_PER_OPERATION, Wo = {
8033
+ tasks: s.array(kp).min(1).max(jt).describe(`The tasks to update (max ${jt}).`)
8034
+ }, Cp = {
8004
8035
  tasks: s.array(te).describe("The updated tasks."),
8005
8036
  totalCount: s.number().describe("The total number of tasks updated."),
8006
8037
  updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
@@ -8013,11 +8044,11 @@ const gp = s.object({
8013
8044
  "Moves not performed because the task was already in the requested destination. A non-zero count means container fields were sent that did not need to be."
8014
8045
  )
8015
8046
  }).describe("Summary of operations performed.")
8016
- }, Ip = {
8047
+ }, jp = {
8017
8048
  name: y.UPDATE_TASKS,
8018
8049
  description: "Update existing tasks including content, dates, priorities, and assignments. Send only the fields that change.",
8019
8050
  parameters: Wo,
8020
- outputSchema: kp,
8051
+ outputSchema: Cp,
8021
8052
  // Open world: assigning a task notifies the new assignee.
8022
8053
  annotations: {
8023
8054
  readOnlyHint: !1,
@@ -8030,11 +8061,11 @@ const gp = s.object({
8030
8061
  r[T] = { kind: "failed", error: v };
8031
8062
  }, a = (T, v) => {
8032
8063
  n(T, K(v));
8033
- }, i = o.map((T, v) => ({ task: T, index: v })).filter(({ task: T }) => Op(T)), c = await Sp(
8064
+ }, i = o.map((T, v) => ({ task: T, index: v })).filter(({ task: T }) => Rp(T)), c = await Ep(
8034
8065
  i.map(({ task: T }) => T),
8035
8066
  t
8036
8067
  ), d = await Promise.allSettled(
8037
- i.map(({ task: T, index: v }) => Ap({ task: T, index: v, client: t, inbox: c }))
8068
+ i.map(({ task: T, index: v }) => _p({ task: T, index: v, client: t, inbox: c }))
8038
8069
  ), u = [];
8039
8070
  for (const [T, v] of d.entries()) {
8040
8071
  const A = i[T]?.index ?? T;
@@ -8044,14 +8075,14 @@ const gp = s.object({
8044
8075
  client: t,
8045
8076
  ids: [
8046
8077
  ...new Set(
8047
- u.filter((T) => yp(T.moveRequest) || T.checkRecurrence).map((T) => T.id)
8078
+ u.filter((T) => Ip(T.moveRequest) || T.checkRecurrence).map((T) => T.id)
8048
8079
  )
8049
8080
  ]
8050
8081
  });
8051
8082
  for (const T of u) {
8052
8083
  if (!T.checkRecurrence)
8053
8084
  continue;
8054
- const v = Cp({
8085
+ const v = Ap({
8055
8086
  id: T.id,
8056
8087
  current: l.get(T.id),
8057
8088
  readFailed: p
@@ -8062,7 +8093,7 @@ const gp = s.object({
8062
8093
  for (const T of u)
8063
8094
  if (!T.failed)
8064
8095
  try {
8065
- const v = bp({
8096
+ const v = Tp({
8066
8097
  taskId: T.id,
8067
8098
  request: T.moveRequest,
8068
8099
  current: l.get(T.id)
@@ -8074,7 +8105,7 @@ const gp = s.object({
8074
8105
  const h = /* @__PURE__ */ new Map(), m = [], b = (T) => {
8075
8106
  const v = T.filter((A) => !A.failed);
8076
8107
  v.length !== 0 && m.push(
8077
- Ep({
8108
+ Op({
8078
8109
  client: t,
8079
8110
  items: v,
8080
8111
  onUpdated: (A, x) => {
@@ -8095,7 +8126,7 @@ const gp = s.object({
8095
8126
  })
8096
8127
  );
8097
8128
  }, g = new Set(f.map(({ item: T }) => T.index));
8098
- b(u.filter((T) => !g.has(T.index))), await jp({
8129
+ b(u.filter((T) => !g.has(T.index))), await Dp({
8099
8130
  client: t,
8100
8131
  moving: f,
8101
8132
  results: h,
@@ -8118,9 +8149,9 @@ const gp = s.object({
8118
8149
  const v = h.get(T.index);
8119
8150
  v && "task" in v && (r[T.index] = { kind: "updated", task: v.task });
8120
8151
  }
8121
- const { updatedTasks: w, failures: I, skippedCount: k } = vp({ tasks: o, outcomes: r }), S = u.filter((T) => T.redundantMoveSkipped).length, E = w.map(z);
8152
+ const { updatedTasks: w, failures: I, skippedCount: k } = $p({ tasks: o, outcomes: r }), S = u.filter((T) => T.redundantMoveSkipped).length, E = w.map(z);
8122
8153
  return O(y.UPDATE_TASKS, o.length, I), {
8123
- textContent: xp({
8154
+ textContent: Up({
8124
8155
  tasks: E,
8125
8156
  failures: I,
8126
8157
  skippedCount: k,
@@ -8141,7 +8172,7 @@ const gp = s.object({
8141
8172
  };
8142
8173
  }
8143
8174
  };
8144
- function vp({ tasks: e, outcomes: t }) {
8175
+ function $p({ tasks: e, outcomes: t }) {
8145
8176
  const o = [], r = [];
8146
8177
  let n = 0;
8147
8178
  for (const [a, i] of t.entries()) {
@@ -8158,7 +8189,7 @@ function vp({ tasks: e, outcomes: t }) {
8158
8189
  }
8159
8190
  return { updatedTasks: o, failures: r, skippedCount: n };
8160
8191
  }
8161
- async function Sp(e, t) {
8192
+ async function Ep(e, t) {
8162
8193
  if (!e.some((o) => ee(o.projectId)))
8163
8194
  return {};
8164
8195
  try {
@@ -8183,7 +8214,7 @@ async function dr({
8183
8214
  }
8184
8215
  return { states: o, readFailed: !1 };
8185
8216
  }
8186
- function Cp({
8217
+ function Ap({
8187
8218
  id: e,
8188
8219
  current: t,
8189
8220
  readFailed: o
@@ -8193,7 +8224,7 @@ function Cp({
8193
8224
  if (t?.due?.isRecurring)
8194
8225
  return `Task ${e} recurs ("${t.due.string}"). dueString would replace that rule and make it a one-time task, so nothing was changed. To move it to another date or time, use ${y.RESCHEDULE_TASKS} (it also accepts duration). To change or drop the recurrence on purpose, resend with replaceRecurrence: true.`;
8195
8226
  }
8196
- async function jp({
8227
+ async function Dp({
8197
8228
  client: e,
8198
8229
  moving: t,
8199
8230
  results: o,
@@ -8203,10 +8234,10 @@ async function jp({
8203
8234
  return;
8204
8235
  const n = /* @__PURE__ */ new Map();
8205
8236
  for (const c of t) {
8206
- const d = mp(c.move), u = n.get(d);
8237
+ const d = yp(c.move), u = n.get(d);
8207
8238
  u ? u.push(c) : n.set(d, [c]);
8208
8239
  }
8209
- const a = hn(e), i = [];
8240
+ const a = sn(e), i = [];
8210
8241
  for (const c of n.values()) {
8211
8242
  const d = [...new Set(c.map(({ item: p }) => p.id))], u = c[0]?.move, l = c.length === 1 ? c[0] : void 0;
8212
8243
  try {
@@ -8234,12 +8265,12 @@ async function jp({
8234
8265
  }
8235
8266
  }
8236
8267
  if (i.length > 0) {
8237
- await $p({ client: e, unresolved: i, results: o });
8268
+ await xp({ client: e, unresolved: i, results: o });
8238
8269
  for (const { group: c } of i)
8239
8270
  r(c);
8240
8271
  }
8241
8272
  }
8242
- async function $p({
8273
+ async function xp({
8243
8274
  client: e,
8244
8275
  unresolved: t,
8245
8276
  results: o
@@ -8257,7 +8288,7 @@ async function $p({
8257
8288
  }
8258
8289
  }
8259
8290
  }
8260
- async function Ep({
8291
+ async function Op({
8261
8292
  client: e,
8262
8293
  items: t,
8263
8294
  onUpdated: o,
@@ -8277,7 +8308,7 @@ async function Ep({
8277
8308
  })
8278
8309
  );
8279
8310
  }
8280
- async function Ap({
8311
+ async function _p({
8281
8312
  task: e,
8282
8313
  index: t,
8283
8314
  client: o,
@@ -8307,18 +8338,18 @@ async function Ap({
8307
8338
  p && (w.priority = gs(p));
8308
8339
  const I = Bo(
8309
8340
  d,
8310
- wp,
8341
+ vp,
8311
8342
  Ho
8312
8343
  );
8313
8344
  I !== void 0 && (w = { ...w, dueString: I });
8314
- const k = Bo(h, Tp, null);
8345
+ const k = Bo(h, Sp, null);
8315
8346
  if (k !== void 0 && (w = { ...w, deadlineDate: k }), u) {
8316
- const { amount: S, unit: E } = Rt(`Task ${n}`, u);
8347
+ const { amount: S, unit: E } = Ut(`Task ${n}`, u);
8317
8348
  w = { ...w, duration: S, durationUnit: E };
8318
8349
  }
8319
8350
  return l !== void 0 && (w = {
8320
8351
  ...w,
8321
- assigneeId: await Dp(o, n, l)
8352
+ assigneeId: await Pp(o, n, l)
8322
8353
  }), {
8323
8354
  index: t,
8324
8355
  id: n,
@@ -8333,7 +8364,7 @@ async function Ap({
8333
8364
  failed: !1
8334
8365
  };
8335
8366
  }
8336
- async function Dp(e, t, o) {
8367
+ async function Pp(e, t, o) {
8337
8368
  if (o === null || o === "unassign")
8338
8369
  return null;
8339
8370
  const r = await Zt.validateTaskUpdateAssignment(
@@ -8347,7 +8378,7 @@ async function Dp(e, t, o) {
8347
8378
  }
8348
8379
  return r.resolvedUser?.userId;
8349
8380
  }
8350
- function xp({
8381
+ function Up({
8351
8382
  tasks: e,
8352
8383
  failures: t,
8353
8384
  skippedCount: o,
@@ -8368,7 +8399,7 @@ function xp({
8368
8399
  Failed (${t.length}) - address or drop these items:
8369
8400
  ${u}${l}`;
8370
8401
  }
8371
- function Op({
8402
+ function Rp({
8372
8403
  id: e,
8373
8404
  replaceRecurrence: t,
8374
8405
  ...o
@@ -8383,7 +8414,7 @@ function Bo(e, t, o) {
8383
8414
  const r = e.trim().toLowerCase();
8384
8415
  return t.includes(r) ? o : e;
8385
8416
  }
8386
- const _p = {}, Pp = {
8417
+ const Np = {}, Lp = {
8387
8418
  type: s.literal("user_info").describe("The type of the response."),
8388
8419
  userId: s.string().describe("The user ID."),
8389
8420
  fullName: s.string().describe("The full name of the user."),
@@ -8400,25 +8431,29 @@ const _p = {}, Pp = {
8400
8431
  email: s.string().describe("The email address of the user."),
8401
8432
  plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
8402
8433
  };
8403
- function Rp(e) {
8434
+ function Mp(e) {
8404
8435
  return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
8405
8436
  }
8406
- function Up(e, t) {
8437
+ function Fp(e, t) {
8407
8438
  const r = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
8408
8439
  return n.setDate(e.getDate() - r), n;
8409
8440
  }
8410
- function Np(e) {
8441
+ function Hp(e) {
8411
8442
  const t = new Date(e);
8412
8443
  return t.setDate(e.getDate() + 6), t;
8413
8444
  }
8414
- function Lp(e) {
8415
- const t = new Date(e.getFullYear(), 0, 1), o = (e.getTime() - t.getTime()) / 864e5;
8416
- return Math.ceil((o + t.getDay() + 1) / 7);
8445
+ function Wp(e) {
8446
+ const t = Date.UTC(
8447
+ e.getFullYear(),
8448
+ e.getMonth(),
8449
+ e.getDate() + 3
8450
+ ), o = new Date(t).getUTCFullYear(), r = (t - Date.UTC(o, 0, 1)) / 864e5;
8451
+ return Math.floor(r / 7) + 1;
8417
8452
  }
8418
- function Mp(e) {
8453
+ function Bp(e) {
8419
8454
  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
8420
8455
  }
8421
- function Fp(e) {
8456
+ function Kp(e) {
8422
8457
  try {
8423
8458
  return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
8424
8459
  } catch {
@@ -8426,9 +8461,9 @@ function Fp(e) {
8426
8461
  }
8427
8462
  }
8428
8463
  function lr(e) {
8429
- return Fp(e) ? e : "UTC";
8464
+ return Kp(e) ? e : "UTC";
8430
8465
  }
8431
- function Hp(e, t) {
8466
+ function zp(e, t) {
8432
8467
  const o = lr(t);
8433
8468
  return e.toLocaleString("en-US", {
8434
8469
  timeZone: o,
@@ -8441,8 +8476,8 @@ function Hp(e, t) {
8441
8476
  hour12: !1
8442
8477
  });
8443
8478
  }
8444
- async function Wp(e) {
8445
- const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r = lr(o), n = /* @__PURE__ */ new Date(), a = Hp(n, r), i = t.startDay ?? 1, c = Mp(i), d = Rp(t), u = new Date(n.toLocaleString("en-US", { timeZone: r })), l = Up(u, i), p = Np(l), f = Lp(u), m = [
8479
+ async function qp(e) {
8480
+ const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", r = lr(o), n = /* @__PURE__ */ new Date(), a = zp(n, r), i = t.startDay ?? 1, c = Bp(i), d = Mp(t), u = new Date(n.toLocaleString("en-US", { timeZone: r })), l = Fp(u, i), p = Hp(l), f = Wp(l), m = [
8446
8481
  "# User Information",
8447
8482
  "",
8448
8483
  `**User ID:** ${t.id}`,
@@ -8484,26 +8519,26 @@ async function Wp(e) {
8484
8519
  };
8485
8520
  return { textContent: m, structuredContent: b };
8486
8521
  }
8487
- const Bp = {
8522
+ const Gp = {
8488
8523
  name: y.USER_INFO,
8489
8524
  description: "Get comprehensive user information including user ID, full name, email, timezone with current local time, week start day preferences, current week dates, daily/weekly goal progress, and user plan (Free/Pro/Business).",
8490
- parameters: _p,
8491
- outputSchema: Pp,
8525
+ parameters: Np,
8526
+ outputSchema: Lp,
8492
8527
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
8493
8528
  async execute(e, t) {
8494
- const o = await Wp(t);
8529
+ const o = await qp(t);
8495
8530
  return {
8496
8531
  textContent: o.textContent,
8497
8532
  structuredContent: o.structuredContent
8498
8533
  };
8499
8534
  }
8500
- }, Ko = 10 * 1024 * 1024, Kp = /* @__PURE__ */ new Set([
8535
+ }, Ko = 10 * 1024 * 1024, Yp = /* @__PURE__ */ new Set([
8501
8536
  "image/png",
8502
8537
  "image/jpeg",
8503
8538
  "image/gif",
8504
8539
  "image/webp",
8505
8540
  "image/svg+xml"
8506
- ]), zp = /* @__PURE__ */ new Set([
8541
+ ]), Vp = /* @__PURE__ */ new Set([
8507
8542
  "text/plain",
8508
8543
  "text/csv",
8509
8544
  "text/html",
@@ -8511,7 +8546,7 @@ const Bp = {
8511
8546
  "application/json",
8512
8547
  "application/xml",
8513
8548
  "text/xml"
8514
- ]), qp = {
8549
+ ]), Jp = {
8515
8550
  ".png": "image/png",
8516
8551
  ".jpg": "image/jpeg",
8517
8552
  ".jpeg": "image/jpeg",
@@ -8526,23 +8561,23 @@ const Bp = {
8526
8561
  ".xml": "application/xml",
8527
8562
  ".pdf": "application/pdf"
8528
8563
  };
8529
- function Gp(e) {
8530
- return Kp.has(e) ? "image" : zp.has(e) || e.startsWith("text/") ? "text" : "binary";
8564
+ function Xp(e) {
8565
+ return Yp.has(e) ? "image" : Vp.has(e) || e.startsWith("text/") ? "text" : "binary";
8531
8566
  }
8532
- function Yp(e) {
8567
+ function Zp(e) {
8533
8568
  return (e.split(";")[0] ?? e).trim().toLowerCase();
8534
8569
  }
8535
- function Vp(e) {
8570
+ function Qp(e) {
8536
8571
  try {
8537
8572
  const t = new URL(e).pathname, o = t.lastIndexOf(".");
8538
8573
  if (o === -1) return;
8539
8574
  const r = t.slice(o).toLowerCase();
8540
- return qp[r];
8575
+ return Jp[r];
8541
8576
  } catch {
8542
8577
  return;
8543
8578
  }
8544
8579
  }
8545
- function Jp(e) {
8580
+ function eh(e) {
8546
8581
  try {
8547
8582
  const t = new URL(e).pathname, o = t.lastIndexOf("/");
8548
8583
  return o === -1 ? void 0 : t.slice(o + 1) || void 0;
@@ -8550,23 +8585,23 @@ function Jp(e) {
8550
8585
  return;
8551
8586
  }
8552
8587
  }
8553
- const Xp = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl\.cloudfront\.net)\/\S*$/, Zp = {
8554
- fileUrl: s.url().regex(Xp, {
8588
+ const th = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl\.cloudfront\.net)\/\S*$/, oh = {
8589
+ fileUrl: s.url().regex(th, {
8555
8590
  error: "Pass the fileUrl from a comment's fileAttachment: an https URL on files.todoist.com, todoist.b-cdn.net or d1ysz50cxb9zwl.cloudfront.net."
8556
8591
  }).describe(
8557
8592
  "The URL of the attachment file to view. Get this from the fileUrl field in a comment's fileAttachment."
8558
8593
  )
8559
- }, Qp = {
8594
+ }, sh = {
8560
8595
  name: y.VIEW_ATTACHMENT,
8561
8596
  description: "View a file attachment from a Todoist comment. Pass the fileUrl from a comment's fileAttachment field. Supports images (returned inline), text files (returned as text), and binary files like PDFs (returned as embedded resources).",
8562
- parameters: Zp,
8597
+ parameters: oh,
8563
8598
  annotations: {
8564
8599
  readOnlyHint: !0,
8565
8600
  destructiveHint: !1,
8566
8601
  idempotentHint: !0
8567
8602
  },
8568
8603
  async execute({ fileUrl: e }, t) {
8569
- const o = await t.viewAttachment(e), r = o.headers["content-length"], n = r ? Number.parseInt(r, 10) : void 0, a = Jp(e), i = o.headers["content-type"], c = i ? Yp(i) : void 0, d = c && c !== "application/octet-stream" ? c : Vp(e) ?? c ?? "application/octet-stream";
8604
+ const o = await t.viewAttachment(e), r = o.headers["content-length"], n = r ? Number.parseInt(r, 10) : void 0, a = eh(e), i = o.headers["content-type"], c = i ? Zp(i) : void 0, d = c && c !== "application/octet-stream" ? c : Qp(e) ?? c ?? "application/octet-stream";
8570
8605
  if (n && n > Ko)
8571
8606
  return {
8572
8607
  textContent: `Attachment "${a ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
@@ -8576,7 +8611,7 @@ const Xp = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
8576
8611
  return {
8577
8612
  textContent: `Attachment "${a ?? e}" is too large to display inline (${(l / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
8578
8613
  };
8579
- const p = Gp(d), f = [];
8614
+ const p = Xp(d), f = [];
8580
8615
  return p === "image" ? f.push({
8581
8616
  type: "image",
8582
8617
  data: u.toString("base64"),
@@ -8596,83 +8631,83 @@ const Xp = /^https:\/\/(?:files\.todoist\.com|todoist\.b-cdn\.net|d1ysz50cxb9zwl
8596
8631
  contentItems: f
8597
8632
  };
8598
8633
  }
8599
- }, eh = {
8600
- ...Td,
8634
+ }, rh = {
8635
+ ...Sd,
8601
8636
  _meta: {
8602
8637
  ui: {
8603
- resourceUri: pt
8638
+ resourceUri: ft
8604
8639
  }
8605
8640
  }
8606
- }, th = {
8641
+ }, nh = {
8607
8642
  // Task management tools
8608
8643
  addTasks: xi,
8609
8644
  completeTasks: Ki,
8610
- uncompleteTasks: wu,
8611
- updateTasks: Ip,
8612
- rescheduleTasks: ou,
8613
- findTasks: xd,
8614
- findTasksByDate: eh,
8615
- findCompletedTasks: Pc,
8645
+ uncompleteTasks: vu,
8646
+ updateTasks: jp,
8647
+ rescheduleTasks: au,
8648
+ findTasks: Ud,
8649
+ findTasksByDate: rh,
8650
+ findCompletedTasks: Lc,
8616
8651
  // Project management tools
8617
8652
  addProjects: di,
8618
- updateProjects: Zu,
8619
- findProjects: rd,
8620
- projectManagement: _l,
8621
- projectMove: Nl,
8653
+ updateProjects: op,
8654
+ findProjects: cd,
8655
+ projectManagement: Nl,
8656
+ projectMove: Hl,
8622
8657
  // Folder management tools
8623
8658
  addFolders: Za,
8624
- updateFolders: Nu,
8625
- findFolders: Wc,
8659
+ updateFolders: Hu,
8660
+ findFolders: qc,
8626
8661
  // Section management tools
8627
8662
  addSections: ji,
8628
- updateSections: up,
8629
- findSections: fd,
8663
+ updateSections: fp,
8664
+ findSections: wd,
8630
8665
  // Comment management tools
8631
8666
  addComments: Da,
8632
- findComments: vc,
8633
- updateComments: Cu,
8667
+ findComments: $c,
8668
+ updateComments: Au,
8634
8669
  // Reminder management tools
8635
8670
  addReminders: ki,
8636
- findReminders: ld,
8637
- updateReminders: ip,
8671
+ findReminders: md,
8672
+ updateReminders: up,
8638
8673
  // Attachment tools
8639
- viewAttachment: Qp,
8674
+ viewAttachment: sh,
8640
8675
  // Label management tools
8641
8676
  addLabels: si,
8642
- updateLabels: zu,
8643
- findLabels: Gc,
8677
+ updateLabels: Vu,
8678
+ findLabels: Xc,
8644
8679
  // Filter management tools
8645
8680
  findFilters: Na,
8646
8681
  addFilters: Wa,
8647
- updateFilters: Du,
8682
+ updateFilters: Pu,
8648
8683
  // Activity and audit tools
8649
8684
  findActivity: bc,
8650
- getProductivityStats: Gd,
8685
+ getProductivityStats: Xd,
8651
8686
  // Health and insights tools
8652
- getProjectHealth: ol,
8653
- getProjectActivityStats: Zd,
8687
+ getProjectHealth: al,
8688
+ getProjectActivityStats: ol,
8654
8689
  analyzeProjectHealth: Hi,
8655
- getWorkspaceInsights: ul,
8690
+ getWorkspaceInsights: fl,
8656
8691
  // General tools
8657
- getOverview: Kd,
8692
+ getOverview: Yd,
8658
8693
  deleteObject: Xi,
8659
8694
  fetchObject: dc,
8660
- reorderObjects: ql,
8661
- userInfo: Bp,
8662
- getUserStatus: il,
8663
- setUserStatus: bu,
8695
+ reorderObjects: Jl,
8696
+ userInfo: Gp,
8697
+ getUserStatus: ul,
8698
+ setUserStatus: Tu,
8664
8699
  // Assignment and collaboration tools
8665
- findProjectCollaborators: Xc,
8666
- manageAssignments: El,
8700
+ findProjectCollaborators: td,
8701
+ manageAssignments: Ol,
8667
8702
  // Template tools
8668
8703
  exportProjectTemplate: ec,
8669
- importProjectTemplate: gl,
8704
+ importProjectTemplate: kl,
8670
8705
  // Workspace tools
8671
- listWorkspaces: vl,
8706
+ listWorkspaces: $l,
8672
8707
  // OpenAI MCP tools
8673
- search: iu,
8708
+ search: uu,
8674
8709
  fetch: pc
8675
- }, oh = Object.values(th), sh = `
8710
+ }, ah = Object.values(nh), ih = `
8676
8711
  ## Todoist Task and Project Management Tools
8677
8712
 
8678
8713
  You have access to comprehensive Todoist management tools for personal productivity and team collaboration. Use these tools to help users manage tasks, projects, sections, comments, and assignments effectively.
@@ -8729,8 +8764,8 @@ What each tool does and how to fill its parameters is in the tool's own descript
8729
8764
  For a productivity review, call **get-productivity-stats**, then find what the user completed as described under "Finding things".
8730
8765
 
8731
8766
  Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
8732
- `, De = { ttlMs: At, cacheScope: "private" };
8733
- function Th({
8767
+ `, De = { ttlMs: xt, cacheScope: "private" };
8768
+ function Sh({
8734
8769
  token: e,
8735
8770
  baseUrl: t,
8736
8771
  features: o = []
@@ -8742,7 +8777,7 @@ function Th({
8742
8777
  tools: { listChanged: !0 },
8743
8778
  prompts: { listChanged: !0 }
8744
8779
  },
8745
- instructions: sh,
8780
+ instructions: ih,
8746
8781
  cacheHints: {
8747
8782
  "server/discover": De,
8748
8783
  "tools/list": De,
@@ -8751,8 +8786,8 @@ function Th({
8751
8786
  "resources/templates/list": De
8752
8787
  }
8753
8788
  }
8754
- ), n = jn(e, { baseUrl: t });
8755
- return Hr(r), Wn({ tools: oh, server: r, client: n, features: o }), r.registerPrompt(
8789
+ ), n = gn(e, { baseUrl: t });
8790
+ return Wn(r), _n({ tools: ah, server: r, client: n, features: o }), r.registerPrompt(
8756
8791
  Ae.name,
8757
8792
  {
8758
8793
  title: Ae.title,
@@ -8763,62 +8798,62 @@ function Th({
8763
8798
  ), r;
8764
8799
  }
8765
8800
  export {
8766
- Ip as $,
8767
- xd as A,
8768
- Td as B,
8769
- Kd as C,
8770
- Gd as D,
8771
- Zd as E,
8772
- wh as F,
8773
- ol as G,
8774
- il as H,
8775
- ul as I,
8776
- gl as J,
8777
- vl as K,
8778
- El as L,
8779
- _l as M,
8780
- Nl as N,
8781
- oh as O,
8782
- ql as P,
8783
- ou as Q,
8784
- iu as R,
8785
- bu as S,
8786
- wu as T,
8787
- Cu as U,
8788
- Du as V,
8789
- Nu as W,
8790
- zu as X,
8791
- Zu as Y,
8792
- ip as Z,
8793
- up as _,
8801
+ jp as $,
8802
+ Sd as A,
8803
+ Sh as B,
8804
+ Yd as C,
8805
+ Xd as D,
8806
+ ol as E,
8807
+ vh as F,
8808
+ al as G,
8809
+ ul as H,
8810
+ fl as I,
8811
+ kl as J,
8812
+ $l as K,
8813
+ Ol as L,
8814
+ Nl as M,
8815
+ Hl as N,
8816
+ ah as O,
8817
+ Jl as P,
8818
+ au as Q,
8819
+ uu as R,
8820
+ Tu as S,
8821
+ vu as T,
8822
+ Au as U,
8823
+ Pu as V,
8824
+ Hu as W,
8825
+ Vu as X,
8826
+ op as Y,
8827
+ up as Z,
8828
+ fp as _,
8794
8829
  Da as a,
8795
- Bp as a0,
8796
- Qp as a1,
8797
- yh as a2,
8798
- wn as a3,
8830
+ Gp as a0,
8831
+ sh as a1,
8832
+ Ih as a2,
8833
+ ln as a3,
8799
8834
  Wa as b,
8800
8835
  Za as c,
8801
8836
  si as d,
8802
8837
  di as e,
8803
8838
  ki as f,
8804
- Th as g,
8805
- ji as h,
8806
- xi as i,
8807
- Hi as j,
8808
- Ki as k,
8809
- Xi as l,
8810
- ec as m,
8811
- pc as n,
8812
- dc as o,
8813
- bc as p,
8814
- vc as q,
8815
- Pc as r,
8816
- Na as s,
8817
- th as t,
8818
- Wc as u,
8819
- Gc as v,
8820
- Xc as w,
8821
- rd as x,
8822
- ld as y,
8823
- fd as z
8839
+ ji as g,
8840
+ xi as h,
8841
+ Hi as i,
8842
+ Ki as j,
8843
+ Xi as k,
8844
+ ec as l,
8845
+ pc as m,
8846
+ dc as n,
8847
+ bc as o,
8848
+ $c as p,
8849
+ Lc as q,
8850
+ Na as r,
8851
+ qc as s,
8852
+ nh as t,
8853
+ Xc as u,
8854
+ td as v,
8855
+ cd as w,
8856
+ md as x,
8857
+ wd as y,
8858
+ Ud as z
8824
8859
  };