@doist/todoist-ai 8.8.2 → 8.8.3

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,4 +1,4 @@
1
- import { colors as $e, LOCATION_TRIGGERS as ut, REMINDER_TYPES as Nt, createCommand as z, REMINDER_DELIVERY_SERVICES as Lt, HEALTH_STATUSES as Re, getTaskUrl as pt, getProjectUrl as mt, WORKSPACE_ROLES as Mt, WORKSPACE_PLANS as Ft, TodoistApi as Ht } from "@doist/todoist-sdk";
1
+ import { colors as $e, LOCATION_TRIGGERS as ut, REMINDER_TYPES as Nt, createCommand as z, REMINDER_DELIVERY_SERVICES as Lt, HEALTH_STATUSES as Ue, getTaskUrl as pt, getProjectUrl as mt, WORKSPACE_ROLES as Mt, WORKSPACE_PLANS as Ft, TodoistApi as Ht } from "@doist/todoist-sdk";
2
2
  import { McpServer as Wt } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { createHash as Bt } from "node:crypto";
4
4
  import { readFileSync as zt } from "node:fs";
@@ -118,7 +118,7 @@ function W(e) {
118
118
  if (t)
119
119
  return P(t);
120
120
  if (Array.isArray(e)) {
121
- const n = e.map((i) => Y(i) ? y(i.message) || y(i.error) : y(i)).filter((i) => !!i);
121
+ const n = e.map((a) => Y(a) ? y(a.message) || y(a.error) : y(a)).filter((a) => !!a);
122
122
  return n.length > 0 ? P(n.slice(0, 2).join("; ")) : void 0;
123
123
  }
124
124
  if (!Y(e))
@@ -133,9 +133,9 @@ function W(e) {
133
133
  if (r)
134
134
  return P(r);
135
135
  const o = [];
136
- for (const [n, i] of Object.entries(e)) {
137
- const a = y(i);
138
- if (a && (o.push(`${n}: ${a}`), o.length >= 2))
136
+ for (const [n, a] of Object.entries(e)) {
137
+ const i = y(a);
138
+ if (i && (o.push(`${n}: ${i}`), o.length >= 2))
139
139
  break;
140
140
  }
141
141
  return o.length > 0 ? P(o.join("; ")) : void 0;
@@ -143,8 +143,8 @@ function W(e) {
143
143
  function rs(e) {
144
144
  if (!e)
145
145
  return [];
146
- const t = /* @__PURE__ */ new Set(), r = (a) => {
147
- a && t.add(P(a, 120));
146
+ const t = /* @__PURE__ */ new Set(), r = (i) => {
147
+ i && t.add(P(i, 120));
148
148
  }, o = _(
149
149
  y(e.field),
150
150
  y(e.parameter),
@@ -159,46 +159,46 @@ function rs(e) {
159
159
  e.error_extra
160
160
  );
161
161
  if (n) {
162
- const a = _(
162
+ const i = _(
163
163
  y(n.field),
164
164
  y(n.parameter),
165
165
  y(n.param),
166
166
  y(n.path),
167
167
  y(n.argument)
168
168
  );
169
- r(a);
169
+ r(i);
170
170
  }
171
- const i = e.errors;
172
- if (Array.isArray(i))
173
- for (const a of i) {
174
- if (!Y(a)) {
175
- r(y(a));
171
+ const a = e.errors;
172
+ if (Array.isArray(a))
173
+ for (const i of a) {
174
+ if (!Y(i)) {
175
+ r(y(i));
176
176
  continue;
177
177
  }
178
178
  const c = _(
179
- y(a.field),
180
- y(a.parameter),
181
- y(a.param),
182
- y(a.path),
183
- y(a.name)
179
+ y(i.field),
180
+ y(i.parameter),
181
+ y(i.param),
182
+ y(i.path),
183
+ y(i.name)
184
184
  ), d = _(
185
- y(a.message),
186
- y(a.error),
187
- y(a.detail),
188
- y(a.description)
185
+ y(i.message),
186
+ y(i.error),
187
+ y(i.detail),
188
+ y(i.description)
189
189
  );
190
190
  r(c && d ? `${c}: ${d}` : c || d);
191
191
  }
192
- else if (Y(i))
193
- for (const [a, c] of Object.entries(i)) {
192
+ else if (Y(a))
193
+ for (const [i, c] of Object.entries(a)) {
194
194
  const d = y(c);
195
195
  if (d) {
196
- r(`${a}: ${d}`);
196
+ r(`${i}: ${d}`);
197
197
  continue;
198
198
  }
199
199
  if (Array.isArray(c)) {
200
200
  const l = c.map((u) => y(u)).filter((u) => !!u).join(", ");
201
- r(l ? `${a}: ${l}` : a);
201
+ r(l ? `${i}: ${l}` : i);
202
202
  }
203
203
  }
204
204
  return Array.from(t).slice(0, 3);
@@ -217,17 +217,17 @@ const os = [
217
217
  function ns(e) {
218
218
  return e ? os.some((t) => e[t] !== void 0) : !1;
219
219
  }
220
- function is(e, t) {
220
+ function as(e, t) {
221
221
  return e === 401 || e === 403 ? "Verify your API token and access permissions, then retry." : e === 404 ? "Confirm the referenced IDs exist and are accessible, then retry." : e === 429 ? "Rate limit reached. Wait briefly and retry." : e !== void 0 && e >= 500 ? "Todoist API may be temporarily unavailable. Retry shortly." : t ? "Fix the field hints above and retry." : e === 400 || e === 422 ? "Check parameter values and formats, then retry." : "Check the request parameters and retry.";
222
222
  }
223
- function as(e) {
223
+ function is(e) {
224
224
  const t = Y(e) ? e : void 0, r = e instanceof Error && Y(e.cause) ? e.cause : void 0, o = Ae(t?.response, r?.response), n = Ae(
225
225
  t?.responseData,
226
226
  o?.data,
227
227
  t?.data,
228
228
  r?.responseData,
229
229
  r?.data
230
- ), i = _(
230
+ ), a = _(
231
231
  E(t?.httpStatusCode),
232
232
  E(t?.statusCode),
233
233
  E(t?.status),
@@ -240,7 +240,7 @@ function as(e) {
240
240
  Ie(y(t?.message)),
241
241
  Ie(y(r?.message)),
242
242
  Ie(typeof e == "string" ? e : void 0)
243
- ), a = _(
243
+ ), i = _(
244
244
  X(n?.errorCode),
245
245
  X(n?.error_code),
246
246
  X(n?.code),
@@ -269,9 +269,9 @@ function as(e) {
269
269
  W(n?.errors),
270
270
  W(t?.details)
271
271
  ), p = rs(n);
272
- return i !== void 0 || ns(n) || c !== void 0 || a !== void 0 || (l ? et(l) : !1) ? {
273
- statusCode: i,
274
- code: a,
272
+ return a !== void 0 || ns(n) || c !== void 0 || i !== void 0 || (l ? et(l) : !1) ? {
273
+ statusCode: a,
274
+ code: i,
275
275
  tag: c ? P(c, 80) : void 0,
276
276
  message: l ? P(l) : void 0,
277
277
  details: u ? P(u) : void 0,
@@ -284,7 +284,7 @@ function cs(e) {
284
284
  const r = [
285
285
  t.length > 0 ? `Todoist API request failed (${t.join(", ")}).` : "Todoist API request failed."
286
286
  ];
287
- return e.message && r.push(`Message: ${e.message}`), e.details && e.details !== e.message && r.push(`Details: ${e.details}`), e.fieldHints.length > 0 && r.push(`Field hints: ${e.fieldHints.join("; ")}`), r.push(`Try next: ${is(e.statusCode, e.fieldHints.length > 0)}`), r.join(`
287
+ return e.message && r.push(`Message: ${e.message}`), e.details && e.details !== e.message && r.push(`Details: ${e.details}`), e.fieldHints.length > 0 && r.push(`Field hints: ${e.fieldHints.join("; ")}`), r.push(`Try next: ${as(e.statusCode, e.fieldHints.length > 0)}`), r.join(`
288
288
  `);
289
289
  }
290
290
  function ds(e) {
@@ -293,9 +293,57 @@ function ds(e) {
293
293
  function ls(e) {
294
294
  if (e instanceof Jt)
295
295
  return e.message;
296
- const t = as(e);
296
+ const t = is(e);
297
297
  return t ? cs(t) : ds(e);
298
298
  }
299
+ const us = 2, ps = 500, ms = 2e3, hs = /* @__PURE__ */ new Set([502, 503, 504]);
300
+ function fs(e) {
301
+ if (e == null || typeof e != "object")
302
+ return;
303
+ const t = e;
304
+ if (typeof t.httpStatusCode == "number")
305
+ return t.httpStatusCode;
306
+ if (typeof t.statusCode == "number")
307
+ return t.statusCode;
308
+ if (typeof t.status == "number")
309
+ return t.status;
310
+ if (e instanceof Error) {
311
+ const r = e.message.match(/\bHTTP\s+(\d{3})\b/i);
312
+ if (r?.[1])
313
+ return Number(r[1]);
314
+ }
315
+ }
316
+ function bs(e) {
317
+ const t = fs(e);
318
+ return t !== void 0 && hs.has(t);
319
+ }
320
+ function gs({
321
+ attempt: e,
322
+ baseDelayMs: t,
323
+ maxDelayMs: r
324
+ }) {
325
+ const o = t * 2 ** e;
326
+ return Math.min(o, r);
327
+ }
328
+ function ys(e) {
329
+ return new Promise((t) => setTimeout(t, e));
330
+ }
331
+ async function ks(e, t = {}) {
332
+ const r = t.maxRetries ?? us, o = t.baseDelayMs ?? ps, n = t.maxDelayMs ?? ms;
333
+ let a;
334
+ for (let i = 0; i <= r; i++)
335
+ try {
336
+ return await e();
337
+ } catch (c) {
338
+ if (a = c, i < r && bs(c)) {
339
+ const d = gs({ attempt: i, baseDelayMs: o, maxDelayMs: n });
340
+ await ys(d);
341
+ continue;
342
+ }
343
+ throw c;
344
+ }
345
+ throw a;
346
+ }
299
347
  function Ee(e) {
300
348
  if (e == null)
301
349
  return e;
@@ -373,48 +421,48 @@ const f = {
373
421
  // OpenAI MCP tools
374
422
  SEARCH: "search",
375
423
  FETCH: "fetch"
376
- }, Sa = {
424
+ }, Ri = {
377
425
  /**
378
426
  * Strips email addresses from tool outputs that expose user data.
379
427
  * Affects: find-project-collaborators, find-completed-tasks
380
428
  */
381
429
  STRIP_EMAILS: "strip_emails"
382
- }, us = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test";
383
- function ps({
430
+ }, Ts = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test";
431
+ function ws({
384
432
  textContent: e,
385
433
  structuredContent: t,
386
434
  contentItems: r
387
435
  }) {
388
- const o = Ee(t), n = {}, i = [];
389
- if (e && i.push({ type: "text", text: e }), r && i.push(...r), i.length > 0 && (n.content = i), t && (n.structuredContent = o), !us && t) {
390
- const a = JSON.stringify(o);
436
+ const o = Ee(t), n = {}, a = [];
437
+ if (e && a.push({ type: "text", text: e }), r && a.push(...r), a.length > 0 && (n.content = a), t && (n.structuredContent = o), !Ts && t) {
438
+ const i = JSON.stringify(o);
391
439
  n.content || (n.content = []), n.content.push({
392
440
  type: "text",
393
441
  mimeType: "application/json",
394
- text: a
442
+ text: i
395
443
  });
396
444
  }
397
445
  return n;
398
446
  }
399
- function ms(e) {
447
+ function Is(e) {
400
448
  return {
401
449
  content: [{ type: "text", text: e }],
402
450
  isError: !0
403
451
  };
404
452
  }
405
- function hs(e) {
453
+ function vs(e) {
406
454
  return { ...{
407
- title: `Todoist: ${fs(e.name)}`,
455
+ title: `Todoist: ${js(e.name)}`,
408
456
  openWorldHint: !1
409
457
  }, ...e.annotations };
410
458
  }
411
- function fs(e) {
459
+ function js(e) {
412
460
  return e.split("-").filter(Boolean).map((t) => `${t.charAt(0).toUpperCase()}${t.slice(1)}`).join(" ");
413
461
  }
414
- function bs(e) {
462
+ function Ss(e) {
415
463
  return e ? typeof e["ui/resourceUri"] == "string" ? !0 : typeof e.ui == "object" && e.ui !== null : !1;
416
464
  }
417
- const gs = [
465
+ const Cs = [
418
466
  f.FIND_PROJECT_COLLABORATORS,
419
467
  f.FIND_COMPLETED_TASKS
420
468
  ];
@@ -431,7 +479,7 @@ function Oe(e) {
431
479
  }
432
480
  return e;
433
481
  }
434
- function ys(e) {
482
+ function $s(e) {
435
483
  const t = /\s*\([^)]*@[^)]+\)/g, r = /\S+@\S+\.\S+/g;
436
484
  return e.replace(t, "").replace(r, "[email hidden]");
437
485
  }
@@ -441,38 +489,37 @@ function k({
441
489
  client: r,
442
490
  features: o = []
443
491
  }) {
444
- const n = o.some((c) => c.name === "strip_emails") && gs.includes(e.name), i = async (c, d) => {
492
+ const n = o.some((c) => c.name === "strip_emails") && Cs.includes(e.name), a = async (c, d) => {
445
493
  try {
446
- let { textContent: l, structuredContent: u, contentItems: p } = await e.execute(
447
- c,
448
- r
494
+ let { textContent: l, structuredContent: u, contentItems: p } = await ks(
495
+ () => e.execute(c, r)
449
496
  );
450
- return n && (l && (l = ys(l)), u && (u = Oe(u))), ps({ textContent: l, structuredContent: u, contentItems: p });
497
+ return n && (l && (l = $s(l)), u && (u = Oe(u))), ws({ textContent: l, structuredContent: u, contentItems: p });
451
498
  } catch (l) {
452
- return console.error(`Error executing tool ${e.name}:`, { args: c, error: l }), ms(ls(l));
499
+ return console.error(`Error executing tool ${e.name}:`, { args: c, error: l }), Is(ls(l));
453
500
  }
454
- }, a = {
501
+ }, i = {
455
502
  description: e.description,
456
503
  inputSchema: e.parameters,
457
504
  outputSchema: e.outputSchema,
458
- annotations: hs(e),
505
+ annotations: vs(e),
459
506
  ...e._meta ? { _meta: e._meta } : {}
460
507
  };
461
- if (bs(e._meta)) {
508
+ if (Ss(e._meta)) {
462
509
  Vt(
463
510
  t,
464
511
  e.name,
465
512
  {
466
- ...a,
513
+ ...i,
467
514
  _meta: e._meta
468
515
  },
469
- i
516
+ a
470
517
  );
471
518
  return;
472
519
  }
473
- t.registerTool(e.name, a, i);
520
+ t.registerTool(e.name, i, a);
474
521
  }
475
- const ks = {
522
+ const Ds = {
476
523
  period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
477
524
  '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.'
478
525
  ),
@@ -481,7 +528,7 @@ const ks = {
481
528
  ),
482
529
  projectId: s.string().optional().describe("Optional project ID to scope the analysis to a specific project.")
483
530
  };
484
- function Ts(e, t = /* @__PURE__ */ new Date()) {
531
+ function xs(e, t = /* @__PURE__ */ new Date()) {
485
532
  const r = (n) => n.toISOString().slice(0, 10), o = r(t);
486
533
  switch (e) {
487
534
  case "today":
@@ -511,9 +558,9 @@ function Ts(e, t = /* @__PURE__ */ new Date()) {
511
558
  };
512
559
  }
513
560
  case "this-week": {
514
- const n = t.getUTCDay(), i = new Date(t);
515
- return i.setDate(t.getDate() - (n + 6) % 7), {
516
- since: r(i),
561
+ const n = t.getUTCDay(), a = new Date(t);
562
+ return a.setDate(t.getDate() - (n + 6) % 7), {
563
+ since: r(a),
517
564
  until: o,
518
565
  periodDescription: "this week (Monday to today)"
519
566
  };
@@ -528,7 +575,7 @@ function Ts(e, t = /* @__PURE__ */ new Date()) {
528
575
  }
529
576
  }
530
577
  }
531
- function ws(e) {
578
+ function As(e) {
532
579
  const t = {
533
580
  goals: `### Goal Tracking
534
581
  - Compare tasks completed today vs the daily goal
@@ -559,8 +606,8 @@ function ws(e) {
559
606
 
560
607
  `) : t[e] ?? "";
561
608
  }
562
- function Is(e) {
563
- const { since: t, until: r, periodDescription: o } = Ts(e.period), n = e.projectId ? `
609
+ function Es(e) {
610
+ const { since: t, until: r, periodDescription: o } = xs(e.period), n = e.projectId ? `
564
611
  Scope this analysis to project ID: ${e.projectId}. Pass this projectId when calling find-completed-tasks and get-overview.` : "";
565
612
  return `Analyze my Todoist productivity for ${o} (${t} to ${r}).${n}
566
613
 
@@ -581,7 +628,7 @@ ${e.focus === "overall" || e.focus === "projects" ? `4. **get-overview** — Get
581
628
 
582
629
  Using the collected data, produce an analysis covering the following sections:
583
630
 
584
- ${ws(e.focus)}
631
+ ${As(e.focus)}
585
632
 
586
633
  ### Step 3: Format
587
634
 
@@ -591,25 +638,25 @@ Present the analysis as a clear, well-structured markdown report with:
591
638
  - Specific numbers and comparisons (not vague statements)
592
639
  - Actionable takeaways highlighted clearly`;
593
640
  }
594
- function vs(e) {
641
+ function Os(e) {
595
642
  return {
596
643
  messages: [
597
644
  {
598
645
  role: "user",
599
646
  content: {
600
647
  type: "text",
601
- text: Is(e)
648
+ text: Es(e)
602
649
  }
603
650
  }
604
651
  ]
605
652
  };
606
653
  }
607
- const ae = {
654
+ const ie = {
608
655
  name: "productivity-analysis",
609
656
  title: "Productivity Analysis",
610
657
  description: "Analyze your Todoist productivity with insights on completion trends, goal streaks, project distribution, and actionable recommendations. Gathers data from multiple tools and synthesizes a comprehensive report.",
611
- argsSchema: ks,
612
- callback: vs
658
+ argsSchema: Ds,
659
+ callback: Os
613
660
  }, C = {
614
661
  /** Default limit for task listings */
615
662
  TASKS_DEFAULT: 10,
@@ -658,23 +705,23 @@ function bt(e) {
658
705
  if (!r || !r[1] && !r[2])
659
706
  throw new O(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
660
707
  let o = 0;
661
- const [, n, i] = r;
708
+ const [, n, a] = r;
662
709
  if (n) {
663
- const a = Number.parseFloat(n);
664
- if (Number.isNaN(a) || a < 0)
710
+ const i = Number.parseFloat(n);
711
+ if (Number.isNaN(i) || i < 0)
665
712
  throw new O(e, "Hours must be a positive number");
666
- o += a * 60;
713
+ o += i * 60;
667
714
  }
668
- if (i) {
669
- const a = Number.parseFloat(i);
670
- if (Number.isNaN(a) || a < 0)
715
+ if (a) {
716
+ const i = Number.parseFloat(a);
717
+ if (Number.isNaN(i) || i < 0)
671
718
  throw new O(e, "Minutes must be a positive number");
672
- if (a % 1 !== 0)
719
+ if (i % 1 !== 0)
673
720
  throw new O(
674
721
  e,
675
722
  "Minutes must be a whole number (use decimal hours instead)"
676
723
  );
677
- o += a;
724
+ o += i;
678
725
  }
679
726
  if (o = Math.round(o), o === 0)
680
727
  throw new O(e, "Duration must be greater than 0 minutes");
@@ -682,20 +729,20 @@ function bt(e) {
682
729
  throw new O(e, "Duration cannot exceed 24 hours (1440 minutes)");
683
730
  return { minutes: o };
684
731
  }
685
- function js(e) {
732
+ function Ps(e) {
686
733
  if (e <= 0) return "0m";
687
734
  const t = Math.floor(e / 60), r = e % 60;
688
735
  return t === 0 ? `${r}m` : r === 0 ? `${t}h` : `${t}h${r}m`;
689
736
  }
690
- const Ss = ["p1", "p2", "p3", "p4"], _e = '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.', Ne = s.enum(Ss).describe(_e);
737
+ const Rs = ["p1", "p2", "p3", "p4"], _e = '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.', Ne = s.enum(Rs).describe(_e);
691
738
  function gt(e) {
692
739
  return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
693
740
  }
694
- function Cs(e) {
741
+ function Us(e) {
695
742
  return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
696
743
  }
697
- const A = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), je = 300 * 1e3, $s = "me";
698
- class Ds {
744
+ const A = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), je = 300 * 1e3, _s = "me";
745
+ class Ns {
699
746
  /**
700
747
  * Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
701
748
  * Supports exact name matches, partial matches, email matches, and the "me" keyword.
@@ -706,23 +753,23 @@ class Ds {
706
753
  const o = r.trim(), n = A.get(o);
707
754
  if (n && Date.now() - n.timestamp < je)
708
755
  return n.result;
709
- if (o.toLowerCase() === $s)
756
+ if (o.toLowerCase() === _s)
710
757
  try {
711
- const i = await t.getUser();
758
+ const a = await t.getUser();
712
759
  return {
713
- userId: i.id,
714
- displayName: i.fullName,
715
- email: i.email
760
+ userId: a.id,
761
+ displayName: a.fullName,
762
+ email: a.email
716
763
  };
717
764
  } catch {
718
765
  return null;
719
766
  }
720
767
  if (/^[0-9]+$/.test(o) || /^[a-f0-9-]{8,}$/i.test(o) && o.includes("-") || /^[a-z0-9_]{6,}$/i.test(o) && !/^[a-z]+[\s-]/.test(o) && /[0-9_]/.test(o)) {
721
- const i = { userId: o, displayName: o, email: o };
722
- return A.set(o, { result: i, timestamp: Date.now() }), i;
768
+ const a = { userId: o, displayName: o, email: o };
769
+ return A.set(o, { result: a, timestamp: Date.now() }), a;
723
770
  }
724
771
  try {
725
- let i = await this.getAllCollaborators(t);
772
+ let a = await this.getAllCollaborators(t);
726
773
  try {
727
774
  const l = await t.getUser();
728
775
  if (l) {
@@ -731,31 +778,31 @@ class Ds {
731
778
  name: l.fullName,
732
779
  email: l.email
733
780
  };
734
- i.some((p) => p.id === l.id) || (i = [u, ...i]);
781
+ a.some((p) => p.id === l.id) || (a = [u, ...a]);
735
782
  }
736
783
  } catch {
737
784
  }
738
- if (i.length === 0)
785
+ if (a.length === 0)
739
786
  return A.set(o, { result: null, timestamp: Date.now() }), null;
740
- const a = r.toLowerCase().trim();
741
- let c = i.find((l) => l.id === o);
787
+ const i = r.toLowerCase().trim();
788
+ let c = a.find((l) => l.id === o);
742
789
  if (c) {
743
790
  const l = { userId: c.id, displayName: c.name, email: c.email };
744
791
  return A.set(o, { result: l, timestamp: Date.now() }), l;
745
792
  }
746
- if (c = i.find((l) => l.name.toLowerCase() === a), c) {
793
+ if (c = a.find((l) => l.name.toLowerCase() === i), c) {
747
794
  const l = { userId: c.id, displayName: c.name, email: c.email };
748
795
  return A.set(o, { result: l, timestamp: Date.now() }), l;
749
796
  }
750
- if (c = i.find((l) => l.email.toLowerCase() === a), c) {
797
+ if (c = a.find((l) => l.email.toLowerCase() === i), c) {
751
798
  const l = { userId: c.id, displayName: c.name, email: c.email };
752
799
  return A.set(o, { result: l, timestamp: Date.now() }), l;
753
800
  }
754
- if (c = i.find((l) => l.name.toLowerCase().includes(a)), c) {
801
+ if (c = a.find((l) => l.name.toLowerCase().includes(i)), c) {
755
802
  const l = { userId: c.id, displayName: c.name, email: c.email };
756
803
  return A.set(o, { result: l, timestamp: Date.now() }), l;
757
804
  }
758
- if (c = i.find((l) => l.email.toLowerCase().includes(a)), c) {
805
+ if (c = a.find((l) => l.email.toLowerCase().includes(i)), c) {
759
806
  const l = { userId: c.id, displayName: c.name, email: c.email };
760
807
  return A.set(o, { result: l, timestamp: Date.now() }), l;
761
808
  }
@@ -770,7 +817,7 @@ class Ds {
770
817
  */
771
818
  async validateProjectCollaborator(t, r, o) {
772
819
  try {
773
- return (await this.getProjectCollaborators(t, r)).some((i) => i.id === o);
820
+ return (await this.getProjectCollaborators(t, r)).some((a) => a.id === o);
774
821
  } catch {
775
822
  return !1;
776
823
  }
@@ -783,7 +830,7 @@ class Ds {
783
830
  if (n && Date.now() - n.timestamp < je)
784
831
  return n.result;
785
832
  try {
786
- const i = await t.getProjectCollaborators(r), c = (Array.isArray(i) ? i : i.results || []).filter((d) => d?.id && d.name && d.email);
833
+ const a = await t.getProjectCollaborators(r), c = (Array.isArray(a) ? a : a.results || []).filter((d) => d?.id && d.name && d.email);
787
834
  return Z.set(o, {
788
835
  result: c,
789
836
  timestamp: Date.now()
@@ -800,22 +847,22 @@ class Ds {
800
847
  if (o && Date.now() - o.timestamp < je)
801
848
  return o.result;
802
849
  try {
803
- const { results: n } = await t.getProjects({}), i = n.filter((u) => u.isShared);
804
- if (i.length === 0) {
850
+ const { results: n } = await t.getProjects({}), a = n.filter((u) => u.isShared);
851
+ if (a.length === 0) {
805
852
  const u = [];
806
853
  return Z.set(r, { result: u, timestamp: Date.now() }), u;
807
854
  }
808
- const a = [], c = /* @__PURE__ */ new Set(), d = i.map(
855
+ const i = [], c = /* @__PURE__ */ new Set(), d = a.map(
809
856
  (u) => this.getProjectCollaborators(t, u.id)
810
857
  ), l = await Promise.allSettled(d);
811
858
  for (const u of l)
812
859
  if (u.status === "fulfilled")
813
860
  for (const p of u.value)
814
- p && !c.has(p.id) && (a.push(p), c.add(p.id));
861
+ p && !c.has(p.id) && (i.push(p), c.add(p.id));
815
862
  return Z.set(r, {
816
- result: a,
863
+ result: i,
817
864
  timestamp: Date.now()
818
- }), a;
865
+ }), i;
819
866
  } catch {
820
867
  return [];
821
868
  }
@@ -827,15 +874,15 @@ class Ds {
827
874
  A.clear(), Z.clear();
828
875
  }
829
876
  }
830
- const B = new Ds();
831
- async function xs(e, t) {
877
+ const B = new Ns();
878
+ async function Ls(e, t) {
832
879
  return B.resolveUser(e, t);
833
880
  }
834
881
  const yt = ["assigned", "unassignedOrMe", "all"];
835
882
  async function Le(e, t) {
836
883
  if (!t)
837
884
  return;
838
- const r = await xs(e, t);
885
+ const r = await Ls(e, t);
839
886
  if (!r)
840
887
  throw new Error(
841
888
  `Could not find user: "${t}". Make sure the user is a collaborator on a shared project.`
@@ -852,7 +899,7 @@ function kt({
852
899
  }) {
853
900
  return e && t ? `assigned to: ${t}` : r === "unassignedOrMe" ? "!assigned to: others" : r === "assigned" ? "assigned to: others" : "";
854
901
  }
855
- function As({
902
+ function Ms({
856
903
  tasks: e,
857
904
  resolvedAssigneeId: t,
858
905
  currentUserId: r,
@@ -880,15 +927,15 @@ async function G(e) {
880
927
  }
881
928
  async function oe(e) {
882
929
  const { apiMethod: t, args: r, limit: o = 100 } = e, n = [];
883
- let i = null;
930
+ let a = null;
884
931
  do {
885
- const a = await t({
932
+ const i = await t({
886
933
  ...r,
887
- cursor: i,
934
+ cursor: a,
888
935
  limit: o
889
936
  });
890
- n.push(...a.results), i = a.nextCursor ?? null;
891
- } while (i !== null);
937
+ n.push(...i.results), a = i.nextCursor ?? null;
938
+ } while (a !== null);
892
939
  return n;
893
940
  }
894
941
  function Me(e) {
@@ -901,21 +948,21 @@ async function Tt(e, t) {
901
948
  limit: C.PROJECTS_MAX
902
949
  });
903
950
  }
904
- async function Es(e, t) {
951
+ async function Fs(e, t) {
905
952
  return oe({
906
953
  apiMethod: e.searchLabels.bind(e),
907
954
  args: { query: Me(t) },
908
955
  limit: C.LABELS_MAX
909
956
  });
910
957
  }
911
- async function Os(e) {
958
+ async function Hs(e) {
912
959
  return oe({
913
960
  apiMethod: e.getSharedLabels.bind(e),
914
961
  args: {},
915
962
  limit: C.LABELS_MAX
916
963
  });
917
964
  }
918
- async function Ps(e, t, r) {
965
+ async function Ws(e, t, r) {
919
966
  const o = Me(t);
920
967
  return oe({
921
968
  apiMethod: e.searchSections.bind(e),
@@ -923,7 +970,7 @@ async function Ps(e, t, r) {
923
970
  limit: C.SECTIONS_MAX
924
971
  });
925
972
  }
926
- function Us(e, t, r, o) {
973
+ function Bs(e, t, r, o) {
927
974
  const n = [t, r, o].filter(Boolean);
928
975
  if (n.length > 1)
929
976
  throw new Error(
@@ -938,7 +985,7 @@ function Us(e, t, r, o) {
938
985
  if (o) return { parentId: o };
939
986
  throw new Error("Unexpected error: No valid move parameter found");
940
987
  }
941
- function U(e) {
988
+ function R(e) {
942
989
  return {
943
990
  id: e.id,
944
991
  content: e.content,
@@ -946,12 +993,12 @@ function U(e) {
946
993
  dueDate: e.due?.date,
947
994
  recurring: e.due?.isRecurring && e.due.string ? e.due.string : !1,
948
995
  deadlineDate: e.deadline?.date,
949
- priority: Cs(e.priority) ?? "p4",
996
+ priority: Us(e.priority) ?? "p4",
950
997
  projectId: e.projectId,
951
998
  sectionId: e.sectionId ?? void 0,
952
999
  parentId: e.parentId ?? void 0,
953
1000
  labels: e.labels,
954
- duration: e.duration ? js(e.duration.amount) : void 0,
1001
+ duration: e.duration ? Ps(e.duration.amount) : void 0,
955
1002
  responsibleUid: e.responsibleUid ?? void 0,
956
1003
  assignedByUid: e.assignedByUid ?? void 0,
957
1004
  checked: e.checked,
@@ -997,7 +1044,7 @@ function pe(e) {
997
1044
  } : void 0
998
1045
  };
999
1046
  }
1000
- function Rs(e) {
1047
+ function zs(e) {
1001
1048
  return {
1002
1049
  id: e.id ?? void 0,
1003
1050
  objectType: e.objectType,
@@ -1010,7 +1057,7 @@ function Rs(e) {
1010
1057
  extraData: e.extraData ?? void 0
1011
1058
  };
1012
1059
  }
1013
- const _s = J.object({
1060
+ const Ys = J.object({
1014
1061
  httpStatusCode: J.number(),
1015
1062
  responseData: J.object({
1016
1063
  error: J.string(),
@@ -1025,15 +1072,15 @@ async function Fe({
1025
1072
  cursor: o
1026
1073
  }) {
1027
1074
  try {
1028
- const { results: n, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1029
- return { tasks: n.map(U), nextCursor: i };
1075
+ const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1076
+ return { tasks: n.map(R), nextCursor: a };
1030
1077
  } catch (n) {
1031
- const i = _s.safeParse(n);
1032
- if (!i.success)
1078
+ const a = Ys.safeParse(n);
1079
+ if (!a.success)
1033
1080
  throw n;
1034
- const { responseData: a } = i.data;
1035
- throw a.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1036
- `${a.error} (tag: ${a.errorTag}, code: ${a.errorCode})`
1081
+ const { responseData: i } = a.data;
1082
+ throw i.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1083
+ `${i.error} (tag: ${i.errorTag}, code: ${i.errorCode})`
1037
1084
  );
1038
1085
  }
1039
1086
  }
@@ -1084,12 +1131,12 @@ function wt(e) {
1084
1131
  return { timeBasedCount: t, locationCount: r };
1085
1132
  }
1086
1133
  const me = $e.map((e) => e.key);
1087
- function Ns(e) {
1134
+ function Gs(e) {
1088
1135
  if (typeof e != "string") return;
1089
1136
  const t = e.toLowerCase();
1090
1137
  return ($e.find((o) => o.key === t) ?? $e.find((o) => o.displayName.toLowerCase() === t))?.key;
1091
1138
  }
1092
- const Ls = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${me.join(", ")}. Unrecognized colors are omitted and charcoal will be used as the default.`, le = s.preprocess(Ns, s.enum(me).optional()).describe(Ls);
1139
+ const qs = `Color for the entity. Accepts a color key (e.g. "berry_red") or display name (e.g. "Berry Red"). Valid colors: ${me.join(", ")}. Unrecognized colors are omitted and charcoal will be used as the default.`, le = s.preprocess(Gs, s.enum(me).optional()).describe(qs);
1093
1140
  s.enum(me).describe("The color key of the entity.");
1094
1141
  const ne = s.enum(me).optional().catch(void 0).describe("The color key of the entity."), K = s.object({
1095
1142
  id: s.string().describe("The unique ID of the task."),
@@ -1111,7 +1158,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1111
1158
  assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
1112
1159
  checked: s.boolean().describe("Whether the task is checked/completed."),
1113
1160
  completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
1114
- }), ie = s.object({
1161
+ }), ae = s.object({
1115
1162
  id: s.string().describe("The unique ID of the project."),
1116
1163
  name: s.string().describe("The name of the project."),
1117
1164
  color: ne,
@@ -1128,7 +1175,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1128
1175
  }), he = s.object({
1129
1176
  id: s.string().describe("The unique ID of the section."),
1130
1177
  name: s.string().describe("The name of the section.")
1131
- }), Ms = s.object({
1178
+ }), Ks = s.object({
1132
1179
  resourceType: s.string().describe("The type of resource (file, url, image, etc)."),
1133
1180
  fileName: s.string().optional().describe("The name of the file."),
1134
1181
  fileSize: s.number().optional().describe("The size of the file in bytes."),
@@ -1148,8 +1195,8 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1148
1195
  content: s.string().describe("The content of the comment."),
1149
1196
  postedAt: s.string().describe("When the comment was posted (ISO 8601 format)."),
1150
1197
  postedUid: s.string().optional().describe("The UID of the user who posted this comment."),
1151
- fileAttachment: Ms.optional().describe("File attachment information, if any.")
1152
- }), Fs = s.object({
1198
+ fileAttachment: Ks.optional().describe("File attachment information, if any.")
1199
+ }), Vs = s.object({
1153
1200
  id: s.string().optional().describe("The unique ID of the activity event."),
1154
1201
  objectType: s.string().describe("The type of object this event relates to (task, project, etc)."),
1155
1202
  objectId: s.string().describe("The ID of the object this event relates to."),
@@ -1159,7 +1206,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1159
1206
  parentItemId: s.string().optional().describe("The ID of the parent item."),
1160
1207
  initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
1161
1208
  extraData: s.record(s.string(), s.unknown()).optional().describe("Additional event data.")
1162
- }), Hs = s.object({
1209
+ }), Js = s.object({
1163
1210
  id: s.string().describe("The unique ID of the user."),
1164
1211
  name: s.string().describe("The full name of the user."),
1165
1212
  email: s.string().describe("The email address of the user.")
@@ -1169,7 +1216,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1169
1216
  color: ne,
1170
1217
  order: s.number().optional().catch(void 0).describe("The display order of the label."),
1171
1218
  isFavorite: s.boolean().describe("Whether the label is marked as favorite.")
1172
- }), Ws = s.object({
1219
+ }), Xs = s.object({
1173
1220
  isRecurring: s.boolean().describe("Whether this is a recurring reminder."),
1174
1221
  string: s.string().describe("Human-readable due string."),
1175
1222
  date: s.string().describe("Due date in ISO format."),
@@ -1180,7 +1227,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1180
1227
  taskId: s.string().describe("The task ID this reminder belongs to."),
1181
1228
  type: s.enum(Nt).describe("The type of reminder: relative, absolute, or location."),
1182
1229
  minuteOffset: s.number().optional().describe("Minutes before due time to trigger (relative reminders only)."),
1183
- due: Ws.optional().describe(
1230
+ due: Xs.optional().describe(
1184
1231
  "Due date info (absolute and sometimes relative reminders)."
1185
1232
  ),
1186
1233
  name: s.string().optional().describe("Location name (location reminders only)."),
@@ -1193,23 +1240,23 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1193
1240
  item: s.string().describe("The item that failed (usually an ID or identifier)."),
1194
1241
  error: s.string().describe("The error message."),
1195
1242
  code: s.string().optional().describe("The error code, if available.")
1196
- }), Bs = s.object({
1243
+ }), Zs = s.object({
1197
1244
  taskId: s.string().optional().describe("The ID of the task to comment on."),
1198
1245
  projectId: s.string().optional().describe(
1199
1246
  'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
1200
1247
  ),
1201
1248
  content: s.string().min(1).describe("The content of the comment.")
1202
- }), zs = {
1203
- comments: s.array(Bs).min(1).describe("The array of comments to add.")
1204
- }, Ys = {
1249
+ }), Qs = {
1250
+ comments: s.array(Zs).min(1).describe("The array of comments to add.")
1251
+ }, er = {
1205
1252
  comments: s.array(fe).describe("The created comments."),
1206
1253
  totalCount: s.number().describe("The total number of comments created."),
1207
1254
  addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
1208
- }, Gs = {
1255
+ }, tr = {
1209
1256
  name: f.ADD_COMMENTS,
1210
1257
  description: "Add multiple comments to tasks or projects. Each comment must specify either taskId or projectId.",
1211
- parameters: zs,
1212
- outputSchema: Ys,
1258
+ parameters: Qs,
1259
+ outputSchema: er,
1213
1260
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1214
1261
  async execute(e, t) {
1215
1262
  const { comments: r } = e;
@@ -1223,7 +1270,7 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1223
1270
  `Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
1224
1271
  );
1225
1272
  }
1226
- const n = r.some((l) => de(l.projectId)) ? await t.getUser() : void 0, i = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1273
+ const n = r.some((l) => de(l.projectId)) ? await t.getUser() : void 0, a = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1227
1274
  const m = await G({
1228
1275
  projectId: p,
1229
1276
  user: n,
@@ -1233,9 +1280,9 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1233
1280
  content: l,
1234
1281
  ...u ? { taskId: u } : { projectId: m }
1235
1282
  });
1236
- }), c = (await Promise.all(i)).map(pe);
1283
+ }), c = (await Promise.all(a)).map(pe);
1237
1284
  return {
1238
- textContent: qs({ comments: c }),
1285
+ textContent: sr({ comments: c }),
1239
1286
  structuredContent: {
1240
1287
  comments: c,
1241
1288
  totalCount: c.length,
@@ -1244,19 +1291,19 @@ const ne = s.enum(me).optional().catch(void 0).describe("The color key of the en
1244
1291
  };
1245
1292
  }
1246
1293
  };
1247
- function qs({ comments: e }) {
1248
- const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
1294
+ function sr({ comments: e }) {
1295
+ const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
1249
1296
  if (t > 0) {
1250
- const i = t > 1 ? "comments" : "comment";
1251
- o.push(`${t} task ${i}`);
1297
+ const a = t > 1 ? "comments" : "comment";
1298
+ o.push(`${t} task ${a}`);
1252
1299
  }
1253
1300
  if (r > 0) {
1254
- const i = r > 1 ? "comments" : "comment";
1255
- o.push(`${r} project ${i}`);
1301
+ const a = r > 1 ? "comments" : "comment";
1302
+ o.push(`${r} project ${a}`);
1256
1303
  }
1257
1304
  return o.length > 0 ? `Added ${o.join(" and ")}` : "No comments added";
1258
1305
  }
1259
- const Ks = {
1306
+ const rr = {
1260
1307
  search: s.string().optional().describe(
1261
1308
  "Search for a filter by name (partial and case insensitive match). If omitted, all filters are returned."
1262
1309
  )
@@ -1267,32 +1314,32 @@ const Ks = {
1267
1314
  color: ne,
1268
1315
  isFavorite: s.boolean().describe("Whether the filter is marked as favorite."),
1269
1316
  itemOrder: s.number().describe("The display order of the filter.")
1270
- }), Vs = {
1317
+ }), or = {
1271
1318
  filters: s.array(Be).describe("The found filters."),
1272
1319
  totalCount: s.number().describe("The total number of filters returned.")
1273
- }, Js = {
1320
+ }, nr = {
1274
1321
  name: f.FIND_FILTERS,
1275
1322
  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").',
1276
- parameters: Ks,
1277
- outputSchema: Vs,
1323
+ parameters: rr,
1324
+ outputSchema: or,
1278
1325
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
1279
1326
  async execute(e, t) {
1280
- let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((a) => !a.isDeleted);
1327
+ let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((i) => !i.isDeleted);
1281
1328
  if (e.search) {
1282
- const a = e.search.toLowerCase();
1283
- o = o.filter((c) => c.name.toLowerCase().includes(a));
1329
+ const i = e.search.toLowerCase();
1330
+ o = o.filter((c) => c.name.toLowerCase().includes(i));
1284
1331
  }
1285
- o.sort((a, c) => a.itemOrder - c.itemOrder);
1286
- const n = o.map((a) => ({
1287
- id: a.id,
1288
- name: a.name,
1289
- query: a.query,
1290
- color: ne.parse(a.color),
1291
- isFavorite: a.isFavorite,
1292
- itemOrder: a.itemOrder
1332
+ o.sort((i, c) => i.itemOrder - c.itemOrder);
1333
+ const n = o.map((i) => ({
1334
+ id: i.id,
1335
+ name: i.name,
1336
+ query: i.query,
1337
+ color: ne.parse(i.color),
1338
+ isFavorite: i.isFavorite,
1339
+ itemOrder: i.itemOrder
1293
1340
  }));
1294
1341
  return {
1295
- textContent: Xs({ filters: n, search: e.search }),
1342
+ textContent: ar({ filters: n, search: e.search }),
1296
1343
  structuredContent: {
1297
1344
  filters: n,
1298
1345
  totalCount: n.length
@@ -1300,7 +1347,7 @@ const Ks = {
1300
1347
  };
1301
1348
  }
1302
1349
  };
1303
- function Xs({
1350
+ function ar({
1304
1351
  filters: e,
1305
1352
  search: t
1306
1353
  }) {
@@ -1310,34 +1357,34 @@ function Xs({
1310
1357
  return `${r}: 0 found
1311
1358
 
1312
1359
  Suggestions:
1313
- ${n.map((i) => `- ${i}`).join(`
1360
+ ${n.map((a) => `- ${a}`).join(`
1314
1361
  `)}`;
1315
1362
  }
1316
1363
  const o = [`${r}: ${e.length} found`, ""];
1317
1364
  for (const n of e) {
1318
- const i = n.isFavorite ? " ★" : "";
1319
- o.push(`• ${n.name}${i} (id=${n.id})`), o.push(` Query: ${n.query}`);
1365
+ const a = n.isFavorite ? " ★" : "";
1366
+ o.push(`• ${n.name}${a} (id=${n.id})`), o.push(` Query: ${n.query}`);
1320
1367
  }
1321
1368
  return o.join(`
1322
1369
  `);
1323
1370
  }
1324
- const Zs = s.object({
1371
+ const ir = s.object({
1325
1372
  name: s.string().min(1).describe("The name of the filter."),
1326
1373
  query: s.string().min(1).describe(
1327
1374
  'The filter query string. Examples: "today & p1", "#Work & overdue", "@email & today", "(p1 | p2) & !assigned". Operators: | (OR), & (AND), ! (NOT), () grouping, , (multiple queries).'
1328
1375
  ),
1329
1376
  color: le,
1330
1377
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite. Defaults to false.")
1331
- }), Qs = {
1332
- filters: s.array(Zs).min(1).describe("The array of filters to add.")
1333
- }, er = {
1378
+ }), cr = {
1379
+ filters: s.array(ir).min(1).describe("The array of filters to add.")
1380
+ }, dr = {
1334
1381
  filters: s.array(Be).describe("The created filters."),
1335
1382
  totalCount: s.number().describe("The total number of filters created.")
1336
- }, tr = {
1383
+ }, lr = {
1337
1384
  name: f.ADD_FILTERS,
1338
1385
  description: "Add one or more new personal filters. Filters are saved custom views using query syntax to organize tasks.",
1339
- parameters: Qs,
1340
- outputSchema: er,
1386
+ parameters: cr,
1387
+ outputSchema: dr,
1341
1388
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1342
1389
  async execute({ filters: e }, t) {
1343
1390
  const r = Date.now(), o = e.map((p, m) => `tempFilterAdd${m}${r}`), n = e.map((p, m) => z(
@@ -1349,8 +1396,8 @@ const Zs = s.object({
1349
1396
  ...p.isFavorite !== void 0 ? { isFavorite: p.isFavorite } : {}
1350
1397
  },
1351
1398
  o[m]
1352
- )), a = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1353
- const h = o[m], g = h !== void 0 ? a[h] : void 0;
1399
+ )), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1400
+ const h = o[m], g = h !== void 0 ? i[h] : void 0;
1354
1401
  if (!g) return null;
1355
1402
  const I = p.color !== void 0 ? ne.parse(p.color) : void 0;
1356
1403
  return {
@@ -1372,26 +1419,26 @@ ${l}`,
1372
1419
  }
1373
1420
  };
1374
1421
  }
1375
- }, sr = s.object({
1422
+ }, ur = s.object({
1376
1423
  name: s.string().min(1).max(128).describe("The name of the label."),
1377
1424
  color: le,
1378
1425
  order: s.number().int().optional().describe("The position of the label in the label list."),
1379
1426
  isFavorite: s.boolean().optional().describe("Whether the label is a favorite. Defaults to false.")
1380
- }), rr = {
1381
- labels: s.array(sr).min(1).describe("The array of labels to add.")
1382
- }, or = {
1427
+ }), pr = {
1428
+ labels: s.array(ur).min(1).describe("The array of labels to add.")
1429
+ }, mr = {
1383
1430
  labels: s.array(be).describe("The created labels."),
1384
1431
  totalCount: s.number().describe("The total number of labels created.")
1385
- }, nr = {
1432
+ }, hr = {
1386
1433
  name: f.ADD_LABELS,
1387
1434
  description: "Add one or more new personal labels.",
1388
- parameters: rr,
1389
- outputSchema: or,
1435
+ parameters: pr,
1436
+ outputSchema: mr,
1390
1437
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1391
1438
  async execute({ labels: e }, t) {
1392
1439
  const r = await Promise.all(e.map((n) => t.addLabel(n)));
1393
1440
  return {
1394
- textContent: ir({ labels: r }),
1441
+ textContent: fr({ labels: r }),
1395
1442
  structuredContent: {
1396
1443
  labels: r.map((n) => be.parse(n)),
1397
1444
  totalCount: r.length
@@ -1399,22 +1446,22 @@ ${l}`,
1399
1446
  };
1400
1447
  }
1401
1448
  };
1402
- function ir({ labels: e }) {
1449
+ function fr({ labels: e }) {
1403
1450
  const t = e.length, r = e.map((o) => `• ${o.name} (id=${o.id})`).join(`
1404
1451
  `);
1405
1452
  return `Added ${t} label${t === 1 ? "" : "s"}:
1406
1453
  ${r}`;
1407
1454
  }
1408
- const ar = 300 * 1e3;
1409
- function cr(e) {
1455
+ const br = 300 * 1e3;
1456
+ function gr(e) {
1410
1457
  return /^\d+$/.test(e);
1411
1458
  }
1412
- class dr {
1459
+ class yr {
1413
1460
  constructor() {
1414
1461
  this.cache = null;
1415
1462
  }
1416
1463
  async getWorkspaces(t) {
1417
- if (this.cache && Date.now() - this.cache.timestamp < ar)
1464
+ if (this.cache && Date.now() - this.cache.timestamp < br)
1418
1465
  return this.cache.workspaces;
1419
1466
  const r = await t.getWorkspaces();
1420
1467
  return this.cache = { workspaces: r, timestamp: Date.now() }, r;
@@ -1434,15 +1481,15 @@ class dr {
1434
1481
  const o = r.trim();
1435
1482
  if (!o)
1436
1483
  throw new Error("Workspace reference cannot be empty");
1437
- const n = await this.getWorkspaces(t), i = n.find((u) => u.id === o);
1438
- if (i)
1439
- return { workspaceId: i.id, workspaceName: i.name };
1440
- if (cr(o))
1484
+ const n = await this.getWorkspaces(t), a = n.find((u) => u.id === o);
1485
+ if (a)
1486
+ return { workspaceId: a.id, workspaceName: a.name };
1487
+ if (gr(o))
1441
1488
  return { workspaceId: o, workspaceName: o };
1442
- const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
1489
+ const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
1443
1490
  if (c)
1444
1491
  return { workspaceId: c.id, workspaceName: c.name };
1445
- const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
1492
+ const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
1446
1493
  if (l)
1447
1494
  return { workspaceId: l.id, workspaceName: l.name };
1448
1495
  if (d.length > 1) {
@@ -1465,7 +1512,7 @@ ${u}` + (d.length > 5 ? `
1465
1512
  this.cache = null;
1466
1513
  }
1467
1514
  }
1468
- const It = new dr(), lr = s.object({
1515
+ const It = new yr(), kr = s.object({
1469
1516
  name: s.string().min(1).describe("The name of the project."),
1470
1517
  parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
1471
1518
  isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
@@ -1474,16 +1521,16 @@ const It = new dr(), lr = s.object({
1474
1521
  workspace: s.string().trim().min(1).optional().describe(
1475
1522
  "The workspace to create the project in. Accepts a workspace name or workspace ID. If not provided, creates a personal project. Use list-workspaces to see available workspaces."
1476
1523
  )
1477
- }), ur = {
1478
- projects: s.array(lr).min(1).describe("The array of projects to add.")
1479
- }, pr = {
1480
- projects: s.array(ie).describe("The created projects."),
1524
+ }), Tr = {
1525
+ projects: s.array(kr).min(1).describe("The array of projects to add.")
1526
+ }, wr = {
1527
+ projects: s.array(ae).describe("The created projects."),
1481
1528
  totalCount: s.number().describe("The total number of projects created.")
1482
- }, mr = {
1529
+ }, Ir = {
1483
1530
  name: f.ADD_PROJECTS,
1484
1531
  description: "Add one or more new projects.",
1485
- parameters: ur,
1486
- outputSchema: pr,
1532
+ parameters: Tr,
1533
+ outputSchema: wr,
1487
1534
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1488
1535
  async execute({ projects: e }, t) {
1489
1536
  const r = [
@@ -1498,17 +1545,17 @@ const It = new dr(), lr = s.object({
1498
1545
  const l = c ? o.get(c) : void 0;
1499
1546
  return t.addProject({ ...d, ...l ? { workspaceId: l } : {} });
1500
1547
  })
1501
- ), i = hr({ projects: n }), a = n.map(q);
1548
+ ), a = vr({ projects: n }), i = n.map(q);
1502
1549
  return {
1503
- textContent: i,
1550
+ textContent: a,
1504
1551
  structuredContent: {
1505
- projects: a,
1506
- totalCount: a.length
1552
+ projects: i,
1553
+ totalCount: i.length
1507
1554
  }
1508
1555
  };
1509
1556
  }
1510
1557
  };
1511
- function hr({ projects: e }) {
1558
+ function vr({ projects: e }) {
1512
1559
  const t = e.length, r = e.map((n) => `• ${n.name} (id=${n.id})`).join(`
1513
1560
  `);
1514
1561
  return `Added ${t} project${t === 1 ? "" : "s"}:
@@ -1519,7 +1566,7 @@ const ue = 25, ge = s.enum(Lt), vt = s.object({
1519
1566
  string: s.string().optional().describe('Natural language due string, e.g. "tomorrow at 3pm".'),
1520
1567
  timezone: s.string().optional().describe('Timezone for the reminder, e.g. "America/New_York".'),
1521
1568
  lang: s.string().optional().describe('Language for parsing the due string, e.g. "en".')
1522
- }), jt = s.enum(ut), ye = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), fr = s.object({
1569
+ }), jt = s.enum(ut), ye = s.boolean().optional().describe("Whether this is an urgent reminder. Applies to relative and absolute reminders."), jr = s.object({
1523
1570
  type: s.literal("relative"),
1524
1571
  taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
1525
1572
  minuteOffset: s.number().int().min(0).describe(
@@ -1529,7 +1576,7 @@ const ue = 25, ge = s.enum(Lt), vt = s.object({
1529
1576
  'Delivery method: "email" or "push" notification. Defaults to push.'
1530
1577
  ),
1531
1578
  isUrgent: ye
1532
- }), br = s.object({
1579
+ }), Sr = s.object({
1533
1580
  type: s.literal("absolute"),
1534
1581
  taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
1535
1582
  due: vt.describe("The specific date/time for the reminder."),
@@ -1537,7 +1584,7 @@ const ue = 25, ge = s.enum(Lt), vt = s.object({
1537
1584
  'Delivery method: "email" or "push" notification. Defaults to push.'
1538
1585
  ),
1539
1586
  isUrgent: ye
1540
- }), gr = s.object({
1587
+ }), Cr = s.object({
1541
1588
  type: s.literal("location"),
1542
1589
  taskId: s.string().min(1).describe("The ID of the task to set a reminder for."),
1543
1590
  name: s.string().min(1).describe('Name of the location, e.g. "Office", "Home".'),
@@ -1547,23 +1594,23 @@ const ue = 25, ge = s.enum(Lt), vt = s.object({
1547
1594
  'When to trigger: "on_enter" (arriving) or "on_leave" (departing).'
1548
1595
  ),
1549
1596
  radius: s.number().int().optional().describe("Radius in meters for the geofence. Defaults to server default.")
1550
- }), yr = s.discriminatedUnion("type", [
1551
- fr,
1552
- br,
1553
- gr
1554
- ]), kr = {
1555
- reminders: s.array(yr).min(1).max(ue).describe(
1597
+ }), $r = s.discriminatedUnion("type", [
1598
+ jr,
1599
+ Sr,
1600
+ Cr
1601
+ ]), Dr = {
1602
+ reminders: s.array($r).min(1).max(ue).describe(
1556
1603
  `Array of reminders to create (max ${ue}). Each reminder must specify a type: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence trigger).`
1557
1604
  )
1558
- }, Tr = {
1605
+ }, xr = {
1559
1606
  reminders: s.array(He).describe("The created reminders."),
1560
1607
  totalCount: s.number().describe("Total number of reminders created."),
1561
1608
  addedReminderIds: s.array(s.string()).describe("IDs of the created reminders.")
1562
- }, wr = {
1609
+ }, Ar = {
1563
1610
  name: f.ADD_REMINDERS,
1564
1611
  description: 'Add reminders to tasks. Supports three types: "relative" (minutes before due), "absolute" (specific date/time), or "location" (geofence-triggered). Each reminder must specify a taskId.',
1565
- parameters: kr,
1566
- outputSchema: Tr,
1612
+ parameters: Dr,
1613
+ outputSchema: xr,
1567
1614
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1568
1615
  async execute(e, t) {
1569
1616
  const { reminders: r } = e, o = r.map(async (c) => {
@@ -1594,18 +1641,18 @@ const ue = 25, ge = s.enum(Lt), vt = s.object({
1594
1641
  radius: c.radius
1595
1642
  });
1596
1643
  }
1597
- }), i = (await Promise.all(o)).map(ce);
1644
+ }), a = (await Promise.all(o)).map(ce);
1598
1645
  return {
1599
- textContent: Ir(i),
1646
+ textContent: Er(a),
1600
1647
  structuredContent: {
1601
- reminders: i,
1602
- totalCount: i.length,
1603
- addedReminderIds: i.map((c) => c.id)
1648
+ reminders: a,
1649
+ totalCount: a.length,
1650
+ addedReminderIds: a.map((c) => c.id)
1604
1651
  }
1605
1652
  };
1606
1653
  }
1607
1654
  };
1608
- function Ir(e) {
1655
+ function Er(e) {
1609
1656
  const { timeBasedCount: t, locationCount: r } = wt(e), o = [];
1610
1657
  if (t > 0) {
1611
1658
  const n = t > 1 ? "reminders" : "reminder";
@@ -1617,21 +1664,21 @@ function Ir(e) {
1617
1664
  }
1618
1665
  return o.length > 0 ? `Added ${o.join(" and ")}` : "No reminders added";
1619
1666
  }
1620
- const vr = s.object({
1667
+ const Or = s.object({
1621
1668
  name: s.string().min(1).describe("The name of the section."),
1622
1669
  projectId: s.string().min(1).describe(
1623
1670
  'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
1624
1671
  )
1625
- }), jr = {
1626
- sections: s.array(vr).min(1).describe("The array of sections to add.")
1627
- }, Sr = {
1672
+ }), Pr = {
1673
+ sections: s.array(Or).min(1).describe("The array of sections to add.")
1674
+ }, Rr = {
1628
1675
  sections: s.array(he).describe("The created sections."),
1629
1676
  totalCount: s.number().describe("The total number of sections created.")
1630
- }, Cr = {
1677
+ }, Ur = {
1631
1678
  name: f.ADD_SECTIONS,
1632
1679
  description: "Add one or more new sections to projects.",
1633
- parameters: jr,
1634
- outputSchema: Sr,
1680
+ parameters: Pr,
1681
+ outputSchema: Rr,
1635
1682
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
1636
1683
  async execute({ sections: e }, t) {
1637
1684
  const o = e.some((c) => de(c.projectId)) ? await t.getUser() : void 0, n = await Promise.all(
@@ -1643,19 +1690,19 @@ const vr = s.object({
1643
1690
  client: o ? void 0 : t
1644
1691
  }) ?? c.projectId
1645
1692
  }))
1646
- ), i = await Promise.all(
1693
+ ), a = await Promise.all(
1647
1694
  n.map((c) => t.addSection(c))
1648
1695
  );
1649
1696
  return {
1650
- textContent: $r({ sections: i }),
1697
+ textContent: _r({ sections: a }),
1651
1698
  structuredContent: {
1652
- sections: i,
1653
- totalCount: i.length
1699
+ sections: a,
1700
+ totalCount: a.length
1654
1701
  }
1655
1702
  };
1656
1703
  }
1657
1704
  };
1658
- function $r({ sections: e }) {
1705
+ function _r({ sections: e }) {
1659
1706
  const t = e.length, r = e.map((n) => `• ${n.name} (id=${n.id}, projectId=${n.projectId})`).join(`
1660
1707
  `);
1661
1708
  return `Added ${t} section${t === 1 ? "" : "s"}:
@@ -1670,20 +1717,20 @@ const Q = {
1670
1717
  PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
1671
1718
  TASK_NOT_FOUND: "TASK_NOT_FOUND"
1672
1719
  };
1673
- class Dr {
1720
+ class Nr {
1674
1721
  /**
1675
1722
  * Validate a single assignment operation
1676
1723
  */
1677
1724
  async validateAssignment(t, r) {
1678
- const { taskId: o, projectId: n, responsibleUid: i } = r, a = await B.resolveUser(t, i);
1679
- if (!a)
1725
+ const { taskId: o, projectId: n, responsibleUid: a } = r, i = await B.resolveUser(t, a);
1726
+ if (!i)
1680
1727
  return {
1681
1728
  isValid: !1,
1682
1729
  taskId: o,
1683
1730
  projectId: n,
1684
1731
  error: {
1685
1732
  type: Q.USER_NOT_FOUND,
1686
- message: `User "${i}" not found`,
1733
+ message: `User "${a}" not found`,
1687
1734
  suggestions: [
1688
1735
  "Check the spelling of the user name or email",
1689
1736
  "Ensure the user is a collaborator on at least one shared project",
@@ -1698,7 +1745,7 @@ class Dr {
1698
1745
  isValid: !1,
1699
1746
  taskId: o,
1700
1747
  projectId: n,
1701
- resolvedUser: a,
1748
+ resolvedUser: i,
1702
1749
  error: {
1703
1750
  type: Q.PROJECT_NOT_SHARED,
1704
1751
  message: `Project "${c.name}" is not shared. Task assignments require a shared project with collaborators. Share the project with at least one other person to enable assignments.`,
@@ -1711,16 +1758,16 @@ class Dr {
1711
1758
  if (!await B.validateProjectCollaborator(
1712
1759
  t,
1713
1760
  n,
1714
- a.userId
1761
+ i.userId
1715
1762
  ))
1716
1763
  return {
1717
1764
  isValid: !1,
1718
1765
  taskId: o,
1719
1766
  projectId: n,
1720
- resolvedUser: a,
1767
+ resolvedUser: i,
1721
1768
  error: {
1722
1769
  type: Q.USER_NOT_COLLABORATOR,
1723
- message: `User "${a.displayName}" is not a collaborator on project "${c.name}"`,
1770
+ message: `User "${i.displayName}" is not a collaborator on project "${c.name}"`,
1724
1771
  suggestions: [
1725
1772
  "Invite the user to collaborate on this project first",
1726
1773
  "Check if the user has been removed from the project",
@@ -1736,7 +1783,7 @@ class Dr {
1736
1783
  isValid: !1,
1737
1784
  taskId: o,
1738
1785
  projectId: n,
1739
- resolvedUser: a,
1786
+ resolvedUser: i,
1740
1787
  error: {
1741
1788
  type: Q.TASK_NOT_FOUND,
1742
1789
  message: `Task "${o}" not found or not accessible`,
@@ -1752,14 +1799,14 @@ class Dr {
1752
1799
  isValid: !0,
1753
1800
  taskId: o,
1754
1801
  projectId: n,
1755
- resolvedUser: a
1802
+ resolvedUser: i
1756
1803
  };
1757
1804
  } catch {
1758
1805
  return {
1759
1806
  isValid: !1,
1760
1807
  taskId: o,
1761
1808
  projectId: n,
1762
- resolvedUser: a,
1809
+ resolvedUser: i,
1763
1810
  error: {
1764
1811
  type: Q.PERMISSION_DENIED,
1765
1812
  message: "Permission denied or API error occurred",
@@ -1826,8 +1873,8 @@ class Dr {
1826
1873
  * Get detailed assignment eligibility information for troubleshooting
1827
1874
  */
1828
1875
  async getAssignmentEligibility(t, r, o, n) {
1829
- const i = [];
1830
- let a = !1, c;
1876
+ const a = [];
1877
+ let i = !1, c;
1831
1878
  try {
1832
1879
  c = await t.getProject(r);
1833
1880
  } catch {
@@ -1847,18 +1894,18 @@ class Dr {
1847
1894
  collaboratorCount: d.length
1848
1895
  };
1849
1896
  if (!c.isShared)
1850
- return i.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: i };
1897
+ return a.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: a };
1851
1898
  const u = await B.resolveUser(t, o);
1852
1899
  if (!u)
1853
- return i.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: i };
1900
+ return a.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: a };
1854
1901
  const p = d.some((g) => g.id === u.userId), m = {
1855
1902
  resolvedName: u.displayName,
1856
1903
  isCollaborator: p
1857
1904
  };
1858
1905
  if (!p)
1859
- return i.push(
1906
+ return a.push(
1860
1907
  `Invite ${u.displayName} to collaborate on project "${c.name}"`
1861
- ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: i };
1908
+ ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: a };
1862
1909
  let h;
1863
1910
  if (n && n.length > 0) {
1864
1911
  let g = 0, I = 0;
@@ -1868,44 +1915,44 @@ class Dr {
1868
1915
  } catch {
1869
1916
  I++;
1870
1917
  }
1871
- h = { accessibleTasks: g, inaccessibleTasks: I }, I > 0 && i.push(`${I} task(s) are not accessible`);
1918
+ h = { accessibleTasks: g, inaccessibleTasks: I }, I > 0 && a.push(`${I} task(s) are not accessible`);
1872
1919
  }
1873
- return a = !0, i.push(`Ready to assign tasks to ${u.displayName}`), {
1874
- canAssign: a,
1920
+ return i = !0, a.push(`Ready to assign tasks to ${u.displayName}`), {
1921
+ canAssign: i,
1875
1922
  projectInfo: l,
1876
1923
  userInfo: m,
1877
1924
  taskInfo: h,
1878
- recommendations: i
1925
+ recommendations: a
1879
1926
  };
1880
1927
  }
1881
1928
  }
1882
- const ze = new Dr();
1929
+ const ze = new Nr();
1883
1930
  function te(e = /* @__PURE__ */ new Date()) {
1884
1931
  const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
1885
1932
  return `${t}-${r}-${o}`;
1886
1933
  }
1887
1934
  function Ye(e, t, r = {}) {
1888
- const { context: o, showDetails: n = !1 } = r, i = t.length, a = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1889
- a.push(d);
1935
+ const { context: o, showDetails: n = !1 } = r, a = t.length, i = [], d = `${e} ${a} ${a === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1936
+ i.push(d);
1890
1937
  const l = 5;
1891
- if (n || i <= l) {
1938
+ if (n || a <= l) {
1892
1939
  const u = ke(t, l);
1893
1940
  if (u.length > 0) {
1894
- const p = i > l ? `, +${i - l} more` : "";
1895
- a.push(`Tasks:
1941
+ const p = a > l ? `, +${a - l} more` : "";
1942
+ i.push(`Tasks:
1896
1943
  ${u}${p}.`);
1897
1944
  }
1898
1945
  }
1899
- return a.join(`
1946
+ return i.join(`
1900
1947
  `);
1901
1948
  }
1902
1949
  function Ge(e) {
1903
- const { action: t, success: r, total: o, successItems: n, successLabel: i = "Completed", failures: a } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1904
- if (c.push(d), n?.length && n.length <= 5 && c.push(`${i}:
1950
+ const { action: t, success: r, total: o, successItems: n, successLabel: a = "Completed", failures: i } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1951
+ if (c.push(d), n?.length && n.length <= 5 && c.push(`${a}:
1905
1952
  ${n.map((l) => ` ${l}`).join(`
1906
- `)}.`), a?.length) {
1907
- const l = a.length, u = `Failed (${l}):
1908
- ${a.slice(0, ve.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1953
+ `)}.`), i?.length) {
1954
+ const l = i.length, u = `Failed (${l}):
1955
+ ${i.slice(0, ve.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1909
1956
  `
1910
1957
  `
1911
1958
  )}${l > ve.MAX_FAILURES_SHOWN ? `, +${l - ve.MAX_FAILURES_SHOWN} more` : ""}.`;
@@ -1914,20 +1961,20 @@ ${a.slice(0, ve.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
1914
1961
  return c.join(`
1915
1962
  `);
1916
1963
  }
1917
- function xr(e) {
1918
- const t = e.content || e.title || "Untitled", r = e.dueDate ? ` • due ${e.dueDate}` : "", o = e.priority ? ` • ${e.priority.toUpperCase()}` : "", n = e.projectName ? ` • ${e.projectName}` : "", i = e.id ? ` • id=${e.id}` : "";
1919
- return ` ${t}${r}${o}${n}${i}`;
1964
+ function Lr(e) {
1965
+ const t = e.content || e.title || "Untitled", r = e.dueDate ? ` • due ${e.dueDate}` : "", o = e.priority ? ` • ${e.priority.toUpperCase()}` : "", n = e.projectName ? ` • ${e.projectName}` : "", a = e.id ? ` • id=${e.id}` : "";
1966
+ return ` ${t}${r}${o}${n}${a}`;
1920
1967
  }
1921
- function Ar(e) {
1968
+ function Mr(e) {
1922
1969
  const t = ` (${e.color})`, r = e.isFavorite ? " • ⭐" : "", o = ` • id=${e.id}`;
1923
1970
  return ` ${e.name}${t}${r}${o}`;
1924
1971
  }
1925
- function Er(e) {
1926
- const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
1927
- return ` ${e.name}${t}${r}${o}${n}${i}`;
1972
+ function Fr(e) {
1973
+ const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", a = ` • id=${e.id}`;
1974
+ return ` ${e.name}${t}${r}${o}${n}${a}`;
1928
1975
  }
1929
1976
  function ke(e, t = 5) {
1930
- const o = e.slice(0, t).map(xr).join(`
1977
+ const o = e.slice(0, t).map(Lr).join(`
1931
1978
  `);
1932
1979
  if (e.length > t) {
1933
1980
  const n = e.length - t;
@@ -1942,13 +1989,13 @@ function F({
1942
1989
  limit: r,
1943
1990
  nextCursor: o,
1944
1991
  filterHints: n,
1945
- previewLines: i,
1946
- zeroReasonHints: a,
1992
+ previewLines: a,
1993
+ zeroReasonHints: i,
1947
1994
  nextSteps: c
1948
1995
  }) {
1949
1996
  const d = [], l = `${e}: ${t}${typeof r == "number" ? ` (limit ${r})` : ""}${o ? ", more available" : ""}.`;
1950
- return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), i?.length && d.push(`Preview:
1951
- ${i}`), !t && a?.length && d.push(`No results. ${a.join("; ")}.`), (c?.length || o) && d.push(St(c || [], o)), d.join(`
1997
+ return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), a?.length && d.push(`Preview:
1998
+ ${a}`), !t && i?.length && d.push(`No results. ${i.join("; ")}.`), (c?.length || o) && d.push(St(c || [], o)), d.join(`
1952
1999
  `);
1953
2000
  }
1954
2001
  function St(e, t) {
@@ -1957,7 +2004,7 @@ function St(e, t) {
1957
2004
  ${r.map((n) => `- ${n}`).join(`
1958
2005
  `)}`;
1959
2006
  }
1960
- const st = 25, Or = s.object({
2007
+ const st = 25, Hr = s.object({
1961
2008
  content: s.string().min(1).describe(
1962
2009
  'The 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.'
1963
2010
  ),
@@ -1985,25 +2032,25 @@ const st = 25, Or = s.object({
1985
2032
  isUncompletable: s.boolean().optional().describe(
1986
2033
  "Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
1987
2034
  )
1988
- }), Pr = {
1989
- tasks: s.array(Or).min(1).max(st).describe(`The array of tasks to add (max ${st}).`)
1990
- }, Ur = {
2035
+ }), Wr = {
2036
+ tasks: s.array(Hr).min(1).max(st).describe(`The array of tasks to add (max ${st}).`)
2037
+ }, Br = {
1991
2038
  tasks: s.array(K).describe("The created tasks."),
1992
2039
  totalCount: s.number().describe("The total number of tasks created."),
1993
2040
  failures: s.array(We).describe("Failed task creations with error details."),
1994
2041
  totalRequested: s.number().describe("The total number of tasks requested."),
1995
2042
  successCount: s.number().describe("The number of successfully created tasks."),
1996
2043
  failureCount: s.number().describe("The number of failed task creations.")
1997
- }, Rr = {
2044
+ }, zr = {
1998
2045
  name: f.ADD_TASKS,
1999
2046
  description: "Add one or more tasks to a project, section, or parent. Supports assignment to project collaborators.",
2000
- parameters: Pr,
2001
- outputSchema: Ur,
2047
+ parameters: Wr,
2048
+ outputSchema: Br,
2002
2049
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
2003
2050
  async execute({ tasks: e }, t) {
2004
2051
  const r = /* @__PURE__ */ new Map();
2005
2052
  e.forEach((l, u) => {
2006
- const p = _r(l), m = r.get(p);
2053
+ const p = Yr(l), m = r.get(p);
2007
2054
  m ? m.push({ task: l, index: u }) : r.set(p, [{ task: l, index: u }]);
2008
2055
  });
2009
2056
  const n = (await Promise.all(
@@ -2011,7 +2058,7 @@ const st = 25, Or = s.object({
2011
2058
  const u = [];
2012
2059
  for (const { task: p, index: m } of l)
2013
2060
  try {
2014
- const h = await Nr(p, t);
2061
+ const h = await Gr(p, t);
2015
2062
  u.push({ index: m, result: { status: "fulfilled", value: h } });
2016
2063
  } catch (h) {
2017
2064
  u.push({
@@ -2021,44 +2068,44 @@ const st = 25, Or = s.object({
2021
2068
  }
2022
2069
  return u;
2023
2070
  })
2024
- )).flat().sort((l, u) => l.index - u.index), i = [], a = [];
2071
+ )).flat().sort((l, u) => l.index - u.index), a = [], i = [];
2025
2072
  for (const { index: l, result: u } of n)
2026
- u.status === "fulfilled" ? i.push(u.value) : a.push({
2073
+ u.status === "fulfilled" ? a.push(u.value) : i.push({
2027
2074
  item: e[l]?.content ?? `Task ${l + 1}`,
2028
2075
  error: u.reason instanceof Error ? u.reason.message : String(u.reason)
2029
2076
  });
2030
- if (i.length === 0 && a.length > 0) {
2031
- const l = a.map((u) => `"${u.item}": ${u.error}`).join("; ");
2032
- throw new Error(`All ${a.length} task(s) failed to create: ${l}`);
2077
+ if (a.length === 0 && i.length > 0) {
2078
+ const l = i.map((u) => `"${u.item}": ${u.error}`).join("; ");
2079
+ throw new Error(`All ${i.length} task(s) failed to create: ${l}`);
2033
2080
  }
2034
- const c = i.map(U);
2081
+ const c = a.map(R);
2035
2082
  return {
2036
- textContent: Lr({
2083
+ textContent: qr({
2037
2084
  tasks: c,
2038
- failures: a,
2085
+ failures: i,
2039
2086
  args: { tasks: e }
2040
2087
  }),
2041
2088
  structuredContent: {
2042
2089
  tasks: c,
2043
2090
  totalCount: c.length,
2044
- failures: a,
2091
+ failures: i,
2045
2092
  totalRequested: e.length,
2046
- successCount: i.length,
2047
- failureCount: a.length
2093
+ successCount: a.length,
2094
+ failureCount: i.length
2048
2095
  }
2049
2096
  };
2050
2097
  }
2051
2098
  };
2052
- function _r(e) {
2099
+ function Yr(e) {
2053
2100
  return `${e.projectId ?? ""}|${e.sectionId ?? ""}|${e.parentId ?? ""}`;
2054
2101
  }
2055
- async function Nr(e, t) {
2102
+ async function Gr(e, t) {
2056
2103
  const {
2057
2104
  duration: r,
2058
2105
  projectId: o,
2059
2106
  sectionId: n,
2060
- parentId: i,
2061
- order: a,
2107
+ parentId: a,
2108
+ order: i,
2062
2109
  responsibleUser: c,
2063
2110
  priority: d,
2064
2111
  labels: l,
@@ -2076,12 +2123,12 @@ async function Nr(e, t) {
2076
2123
  ...p,
2077
2124
  projectId: m,
2078
2125
  sectionId: n,
2079
- parentId: i,
2080
- order: a,
2126
+ parentId: a,
2127
+ order: i,
2081
2128
  labels: l,
2082
2129
  deadlineDate: u
2083
2130
  };
2084
- if (d && (h.priority = gt(d)), c && !m && !n && !i)
2131
+ if (d && (h.priority = gt(d)), c && !m && !n && !a)
2085
2132
  throw new Error(
2086
2133
  `Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
2087
2134
  );
@@ -2098,11 +2145,11 @@ async function Nr(e, t) {
2098
2145
  }
2099
2146
  if (c) {
2100
2147
  let g = m;
2101
- if (!g && i)
2148
+ if (!g && a)
2102
2149
  try {
2103
- g = (await t.getTask(i)).projectId;
2150
+ g = (await t.getTask(a)).projectId;
2104
2151
  } catch {
2105
- throw new Error(`Task "${e.content}": Parent task "${i}" not found`);
2152
+ throw new Error(`Task "${e.content}": Parent task "${a}" not found`);
2106
2153
  }
2107
2154
  else if (!g && n)
2108
2155
  throw new Error(
@@ -2127,24 +2174,24 @@ async function Nr(e, t) {
2127
2174
  }
2128
2175
  return await t.addTask(h);
2129
2176
  }
2130
- function Lr({
2177
+ function qr({
2131
2178
  tasks: e,
2132
2179
  failures: t,
2133
2180
  args: r
2134
2181
  }) {
2135
2182
  const o = /* @__PURE__ */ new Set();
2136
- for (const i of r.tasks)
2137
- i.projectId && !de(i.projectId) ? o.add("projects") : i.sectionId ? o.add("sections") : i.parentId ? o.add("subtasks") : o.add("inbox");
2183
+ for (const a of r.tasks)
2184
+ a.projectId && !de(a.projectId) ? o.add("projects") : a.sectionId ? o.add("sections") : a.parentId ? o.add("subtasks") : o.add("inbox");
2138
2185
  let n = "";
2139
2186
  if (o.size === 1) {
2140
- const i = Array.from(o)[0];
2141
- n = i === "inbox" ? "" : `to ${i}`;
2187
+ const a = Array.from(o)[0];
2188
+ n = a === "inbox" ? "" : `to ${a}`;
2142
2189
  } else o.size > 1 && (n = "to multiple contexts");
2143
2190
  return t.length > 0 ? Ge({
2144
2191
  action: `Added tasks${n ? ` ${n}` : ""}`,
2145
2192
  success: e.length,
2146
2193
  total: r.tasks.length,
2147
- successItems: e.map((i) => i.content ?? "Untitled"),
2194
+ successItems: e.map((a) => a.content ?? "Untitled"),
2148
2195
  successLabel: "Created",
2149
2196
  failures: t
2150
2197
  }) : Ye("Added", e, {
@@ -2152,23 +2199,23 @@ function Lr({
2152
2199
  showDetails: !0
2153
2200
  });
2154
2201
  }
2155
- const Mr = {
2202
+ const Kr = {
2156
2203
  projectId: s.string().min(1).describe(
2157
2204
  "The ID of the project to analyze. This triggers a new health analysis which may take some time to complete."
2158
2205
  )
2159
- }, Fr = {
2206
+ }, Vr = {
2160
2207
  projectId: s.string().describe("The project ID."),
2161
2208
  health: s.object({
2162
- status: s.enum(Re).describe("The health status after triggering analysis."),
2209
+ status: s.enum(Ue).describe("The health status after triggering analysis."),
2163
2210
  isStale: s.boolean().describe("Whether the health data is still stale after the request."),
2164
2211
  updateInProgress: s.boolean().describe("Whether an analysis update is currently in progress.")
2165
2212
  }).describe("The health response returned after triggering analysis."),
2166
2213
  message: s.string().describe("A human-readable message about the analysis status.")
2167
- }, Hr = {
2214
+ }, Jr = {
2168
2215
  name: f.ANALYZE_PROJECT_HEALTH,
2169
2216
  description: "Trigger a new health analysis for a project. Use this when the health data is stale or you want a fresh assessment. The analysis may take time to complete — use get-project-health afterward to see updated results.",
2170
- parameters: Mr,
2171
- outputSchema: Fr,
2217
+ parameters: Kr,
2218
+ outputSchema: Vr,
2172
2219
  annotations: {
2173
2220
  readOnlyHint: !1,
2174
2221
  destructiveHint: !1,
@@ -2191,34 +2238,34 @@ ${n}`,
2191
2238
  }
2192
2239
  };
2193
2240
  }
2194
- }, Wr = {
2241
+ }, Xr = {
2195
2242
  ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to complete.")
2196
- }, Br = {
2243
+ }, Zr = {
2197
2244
  completed: s.array(s.string()).describe("The IDs of successfully completed tasks."),
2198
2245
  failures: s.array(We).describe("Failed task completions with error details."),
2199
2246
  totalRequested: s.number().describe("The total number of tasks requested to complete."),
2200
2247
  successCount: s.number().describe("The number of successfully completed tasks."),
2201
2248
  failureCount: s.number().describe("The number of failed task completions.")
2202
- }, zr = {
2249
+ }, Qr = {
2203
2250
  name: f.COMPLETE_TASKS,
2204
2251
  description: "Complete one or more tasks by their IDs.",
2205
- parameters: Wr,
2206
- outputSchema: Br,
2252
+ parameters: Xr,
2253
+ outputSchema: Zr,
2207
2254
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
2208
2255
  async execute(e, t) {
2209
2256
  const r = [], o = [];
2210
- for (const i of e.ids)
2257
+ for (const a of e.ids)
2211
2258
  try {
2212
- await t.closeTask(i), r.push(i);
2213
- } catch (a) {
2214
- const c = a instanceof Error ? a.message : "Unknown error";
2259
+ await t.closeTask(a), r.push(a);
2260
+ } catch (i) {
2261
+ const c = i instanceof Error ? i.message : "Unknown error";
2215
2262
  o.push({
2216
- item: i,
2263
+ item: a,
2217
2264
  error: c
2218
2265
  });
2219
2266
  }
2220
2267
  return {
2221
- textContent: Yr({
2268
+ textContent: eo({
2222
2269
  completed: r,
2223
2270
  failures: o,
2224
2271
  args: e
@@ -2233,7 +2280,7 @@ ${n}`,
2233
2280
  };
2234
2281
  }
2235
2282
  };
2236
- function Yr({
2283
+ function eo({
2237
2284
  completed: e,
2238
2285
  failures: t,
2239
2286
  args: r
@@ -2255,20 +2302,20 @@ const Ct = [
2255
2302
  "filter",
2256
2303
  "reminder",
2257
2304
  "location_reminder"
2258
- ], Gr = {
2305
+ ], to = {
2259
2306
  type: s.enum(Ct).describe("The type of entity to delete."),
2260
2307
  id: s.string().min(1).describe("The ID of the entity to delete.")
2261
- }, qr = {
2308
+ }, so = {
2262
2309
  deletedEntity: s.object({
2263
2310
  type: s.enum(Ct).describe("The type of deleted entity."),
2264
2311
  id: s.string().describe("The ID of the deleted entity.")
2265
2312
  }).describe("Information about the deleted entity."),
2266
2313
  success: s.boolean().describe("Whether the deletion was successful.")
2267
- }, Kr = {
2314
+ }, ro = {
2268
2315
  name: f.DELETE_OBJECT,
2269
2316
  description: "Delete a project, section, task, comment, label, filter, reminder, or location_reminder by its ID.",
2270
- parameters: Gr,
2271
- outputSchema: qr,
2317
+ parameters: to,
2318
+ outputSchema: so,
2272
2319
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
2273
2320
  async execute(e, t) {
2274
2321
  switch (e.type) {
@@ -2307,21 +2354,21 @@ const Ct = [
2307
2354
  }
2308
2355
  };
2309
2356
  }
2310
- }, Vr = {
2357
+ }, oo = {
2311
2358
  id: s.string().min(1).describe(
2312
2359
  'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
2313
2360
  )
2314
- }, Jr = {
2361
+ }, no = {
2315
2362
  id: s.string().describe("The ID of the fetched document."),
2316
2363
  title: s.string().describe("The title of the document."),
2317
2364
  text: s.string().describe("The text content of the document."),
2318
2365
  url: s.string().describe("The URL of the document."),
2319
2366
  metadata: s.record(s.string(), s.unknown()).optional().describe("Additional metadata about the document.")
2320
- }, Xr = {
2367
+ }, ao = {
2321
2368
  name: f.FETCH,
2322
2369
  description: 'Fetch the full contents of a task or project by its ID. The ID should be in the format "task:{id}" or "project:{id}".',
2323
- parameters: Vr,
2324
- outputSchema: Jr,
2370
+ parameters: oo,
2371
+ outputSchema: no,
2325
2372
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2326
2373
  async execute(e, t) {
2327
2374
  const { id: r } = e, [o, n] = r.split(":", 2);
@@ -2329,14 +2376,14 @@ const Ct = [
2329
2376
  throw new Error(
2330
2377
  'Invalid ID format. Expected "task:{id}" or "project:{id}". Example: "task:8485093748" or "project:6cfCcrrCFg2xP94Q"'
2331
2378
  );
2332
- let i;
2379
+ let a;
2333
2380
  if (o === "task") {
2334
- const a = await t.getTask(n), c = U(a), d = [c.content];
2381
+ const i = await t.getTask(n), c = R(i), d = [c.content];
2335
2382
  c.description && d.push(`
2336
2383
 
2337
2384
  Description: ${c.description}`), c.dueDate && d.push(`
2338
2385
  Due: ${c.dueDate}`), c.labels.length > 0 && d.push(`
2339
- Labels: ${c.labels.join(", ")}`), i = {
2386
+ Labels: ${c.labels.join(", ")}`), a = {
2340
2387
  id: `task:${c.id}`,
2341
2388
  title: c.content,
2342
2389
  text: d.join(""),
@@ -2355,11 +2402,11 @@ Labels: ${c.labels.join(", ")}`), i = {
2355
2402
  }
2356
2403
  };
2357
2404
  } else {
2358
- const a = await t.getProject(n), c = q(a), d = [c.name];
2405
+ const i = await t.getProject(n), c = q(i), d = [c.name];
2359
2406
  c.isShared && d.push(`
2360
2407
 
2361
2408
  Shared project`), c.isFavorite && d.push(`
2362
- Favorite: Yes`), i = {
2409
+ Favorite: Yes`), a = {
2363
2410
  id: `project:${c.id}`,
2364
2411
  title: c.name,
2365
2412
  text: d.join(""),
@@ -2375,57 +2422,57 @@ Favorite: Yes`), i = {
2375
2422
  };
2376
2423
  }
2377
2424
  return {
2378
- textContent: JSON.stringify(i),
2379
- structuredContent: i
2425
+ textContent: JSON.stringify(a),
2426
+ structuredContent: a
2380
2427
  };
2381
2428
  }
2382
- }, $t = ["task", "project", "comment", "section"], Zr = {
2429
+ }, $t = ["task", "project", "comment", "section"], io = {
2383
2430
  type: s.enum($t).describe("The type of object to fetch."),
2384
2431
  id: s.string().min(1).describe("The unique ID of the object to fetch.")
2385
- }, Qr = {
2432
+ }, co = {
2386
2433
  type: s.enum($t).describe("The type of object fetched."),
2387
2434
  id: s.string().describe("The ID of the fetched object."),
2388
- object: s.union([K, ie, fe, he]).describe("The fetched object data.")
2389
- }, eo = {
2435
+ object: s.union([K, ae, fe, he]).describe("The fetched object data.")
2436
+ }, lo = {
2390
2437
  name: f.FETCH_OBJECT,
2391
2438
  description: "Fetch a single task, project, comment, or section by its ID. Use this when you have a specific object ID and want to retrieve its full details.",
2392
- parameters: Zr,
2393
- outputSchema: Qr,
2439
+ parameters: io,
2440
+ outputSchema: co,
2394
2441
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2395
2442
  async execute(e, t) {
2396
2443
  const { type: r, id: o } = e;
2397
2444
  try {
2398
2445
  switch (r) {
2399
2446
  case "task": {
2400
- const n = await t.getTask(o), i = U(n);
2447
+ const n = await t.getTask(o), a = R(n);
2401
2448
  return {
2402
- textContent: `Found task: ${i.content} • id=${i.id} • priority=${i.priority} • project=${i.projectId}`,
2449
+ textContent: `Found task: ${a.content} • id=${a.id} • priority=${a.priority} • project=${a.projectId}`,
2403
2450
  structuredContent: {
2404
2451
  type: r,
2405
2452
  id: o,
2406
- object: i
2453
+ object: a
2407
2454
  }
2408
2455
  };
2409
2456
  }
2410
2457
  case "project": {
2411
- const n = await t.getProject(o), i = q(n);
2458
+ const n = await t.getProject(o), a = q(n);
2412
2459
  return {
2413
- textContent: `Found project: ${i.name} • id=${i.id} • color=${i.color} • viewStyle=${i.viewStyle}`,
2460
+ textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color} • viewStyle=${a.viewStyle}`,
2414
2461
  structuredContent: {
2415
2462
  type: r,
2416
2463
  id: o,
2417
- object: i
2464
+ object: a
2418
2465
  }
2419
2466
  };
2420
2467
  }
2421
2468
  case "comment": {
2422
- const n = await t.getComment(o), i = pe(n), a = i.content.length > 50 ? `${i.content.substring(0, 50)}...` : i.content;
2469
+ const n = await t.getComment(o), a = pe(n), i = a.content.length > 50 ? `${a.content.substring(0, 50)}...` : a.content;
2423
2470
  return {
2424
- textContent: `Found comment • id=${i.id} • content="${a}" • posted=${i.postedAt}`,
2471
+ textContent: `Found comment • id=${a.id} • content="${i}" • posted=${a.postedAt}`,
2425
2472
  structuredContent: {
2426
2473
  type: r,
2427
2474
  id: o,
2428
- object: i
2475
+ object: a
2429
2476
  }
2430
2477
  };
2431
2478
  }
@@ -2433,16 +2480,16 @@ Favorite: Yes`), i = {
2433
2480
  const n = await t.getSection(o);
2434
2481
  if (!n)
2435
2482
  throw new Error(`Section ${o} not found.`);
2436
- const i = {
2483
+ const a = {
2437
2484
  id: n.id,
2438
2485
  name: n.name
2439
2486
  };
2440
2487
  return {
2441
- textContent: `Found section: ${i.name} • id=${i.id}`,
2488
+ textContent: `Found section: ${a.name} • id=${a.id}`,
2442
2489
  structuredContent: {
2443
2490
  type: r,
2444
2491
  id: o,
2445
- object: i
2492
+ object: a
2446
2493
  }
2447
2494
  };
2448
2495
  }
@@ -2453,7 +2500,7 @@ Favorite: Yes`), i = {
2453
2500
  );
2454
2501
  }
2455
2502
  }
2456
- }, to = {
2503
+ }, uo = {
2457
2504
  objectType: s.enum(["task", "project", "comment"]).optional().describe("Type of object to filter by."),
2458
2505
  objectId: s.string().optional().describe("Filter by specific object ID (task, project, or comment)."),
2459
2506
  eventType: s.enum([
@@ -2472,27 +2519,27 @@ Favorite: Yes`), i = {
2472
2519
  initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
2473
2520
  limit: s.number().int().min(1).max(C.ACTIVITY_MAX).default(C.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
2474
2521
  cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
2475
- }, so = {
2476
- events: s.array(Fs).describe("The activity events."),
2522
+ }, po = {
2523
+ events: s.array(Vs).describe("The activity events."),
2477
2524
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
2478
2525
  totalCount: s.number().describe("The total number of events in this page."),
2479
2526
  hasMore: s.boolean().describe("Whether there are more results available."),
2480
2527
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
2481
- }, ro = {
2528
+ }, mo = {
2482
2529
  name: f.FIND_ACTIVITY,
2483
2530
  description: "Retrieve recent activity logs to monitor and audit changes in Todoist. Shows events from all users by default (use initiatorId to filter by specific user). Track task completions, updates, deletions, project changes, and more with flexible filtering. Note: Date-based filtering is not supported by the Todoist API.",
2484
- parameters: to,
2485
- outputSchema: so,
2531
+ parameters: uo,
2532
+ outputSchema: po,
2486
2533
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2487
2534
  async execute(e, t) {
2488
- const { objectType: r, objectId: o, eventType: n, projectId: i, taskId: a, initiatorId: c, limit: d, cursor: l } = e, u = {
2535
+ const { objectType: r, objectId: o, eventType: n, projectId: a, taskId: i, initiatorId: c, limit: d, cursor: l } = e, u = {
2489
2536
  limit: d,
2490
2537
  cursor: l ?? null
2491
2538
  };
2492
- r && n ? u.objectEventTypes = `${r}:${n}` : r ? u.objectEventTypes = `${r}:` : n && (u.objectEventTypes = `:${n}`), o && o !== "remove" && (u.objectId = o), i && (u.parentProjectId = i), a && (u.parentItemId = a), c && (u.initiatorId = c);
2493
- const { results: p, nextCursor: m } = await t.getActivityLogs(u), h = p.map(Rs);
2539
+ r && n ? u.objectEventTypes = `${r}:${n}` : r ? u.objectEventTypes = `${r}:` : n && (u.objectEventTypes = `:${n}`), o && o !== "remove" && (u.objectId = o), a && (u.parentProjectId = a), i && (u.parentItemId = i), c && (u.initiatorId = c);
2540
+ const { results: p, nextCursor: m } = await t.getActivityLogs(u), h = p.map(zs);
2494
2541
  return {
2495
- textContent: oo({ events: h, args: e, nextCursor: m }),
2542
+ textContent: ho({ events: h, args: e, nextCursor: m }),
2496
2543
  structuredContent: {
2497
2544
  events: h,
2498
2545
  nextCursor: m ?? void 0,
@@ -2503,7 +2550,7 @@ Favorite: Yes`), i = {
2503
2550
  };
2504
2551
  }
2505
2552
  };
2506
- function oo({
2553
+ function ho({
2507
2554
  events: e,
2508
2555
  args: t,
2509
2556
  nextCursor: r
@@ -2515,21 +2562,21 @@ function oo({
2515
2562
  n.push(c);
2516
2563
  }
2517
2564
  n.length > 0 && (o = `Activity: ${n.join(" ")}`);
2518
- const i = [];
2519
- 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}`);
2520
2565
  const a = [];
2521
- return e.length === 0 && (a.push("No activity events match the specified filters"), a.push("Note: Activity logs only show recent events"), t.eventType && a.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && a.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && a.push("Verify the object ID is correct")), F({
2566
+ t.objectId && a.push(`object ID: ${t.objectId}`), t.projectId && a.push(`project: ${t.projectId}`), t.taskId && a.push(`task: ${t.taskId}`), t.initiatorId && a.push(`initiator: ${t.initiatorId}`);
2567
+ const i = [];
2568
+ return e.length === 0 && (i.push("No activity events match the specified filters"), i.push("Note: Activity logs only show recent events"), t.eventType && i.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && i.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && i.push("Verify the object ID is correct")), F({
2522
2569
  subject: o,
2523
2570
  count: e.length,
2524
2571
  limit: t.limit,
2525
2572
  nextCursor: r ?? void 0,
2526
- filterHints: i,
2527
- previewLines: no(e, Math.min(e.length, t.limit)),
2528
- zeroReasonHints: a
2573
+ filterHints: a,
2574
+ previewLines: fo(e, Math.min(e.length, t.limit)),
2575
+ zeroReasonHints: i
2529
2576
  });
2530
2577
  }
2531
- function no(e, t = 10) {
2532
- const o = e.slice(0, t).map(io).join(`
2578
+ function fo(e, t = 10) {
2579
+ const o = e.slice(0, t).map(bo).join(`
2533
2580
  `);
2534
2581
  if (e.length > t) {
2535
2582
  const n = e.length - t;
@@ -2538,17 +2585,17 @@ function no(e, t = 10) {
2538
2585
  }
2539
2586
  return o;
2540
2587
  }
2541
- function io(e) {
2542
- const t = ao(e.eventDate), r = `${e.eventType} ${e.objectType}`;
2588
+ function bo(e) {
2589
+ const t = go(e.eventDate), r = `${e.eventType} ${e.objectType}`;
2543
2590
  let o = "";
2544
2591
  if (e.extraData) {
2545
2592
  const c = e.extraData.content || e.extraData.name || e.extraData.last_content;
2546
2593
  c && typeof c == "string" && (o = ` • "${c.length > 50 ? `${c.substring(0, 47)}...` : c}"`);
2547
2594
  }
2548
- const n = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", a = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
2549
- return ` [${t}] ${r}${o}${n}${i}${a}`;
2595
+ const n = e.objectId ? ` • id=${e.objectId}` : "", a = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", i = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
2596
+ return ` [${t}] ${r}${o}${n}${a}${i}`;
2550
2597
  }
2551
- function ao(e) {
2598
+ function go(e) {
2552
2599
  try {
2553
2600
  const t = new Date(e), r = t.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" }), o = t.toLocaleDateString("en-US", { day: "numeric", timeZone: "UTC" }), n = t.toLocaleTimeString("en-US", {
2554
2601
  hour: "2-digit",
@@ -2561,7 +2608,7 @@ function ao(e) {
2561
2608
  return e;
2562
2609
  }
2563
2610
  }
2564
- const co = {
2611
+ const yo = {
2565
2612
  taskId: s.string().optional().describe("Find comments for a specific task."),
2566
2613
  projectId: s.string().optional().describe(
2567
2614
  'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
@@ -2569,7 +2616,7 @@ const co = {
2569
2616
  commentId: s.string().optional().describe("Get a specific comment by ID."),
2570
2617
  cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
2571
2618
  limit: s.number().int().min(1).max(C.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
2572
- }, lo = {
2619
+ }, ko = {
2573
2620
  comments: s.array(fe).describe("The found comments."),
2574
2621
  searchType: s.string().describe(
2575
2622
  'The type of search performed: "single" (comment ID), "task" (task ID), or "project" (project ID).'
@@ -2578,11 +2625,11 @@ const co = {
2578
2625
  hasMore: s.boolean().describe("Whether there are more results available."),
2579
2626
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
2580
2627
  totalCount: s.number().describe("The total number of comments in this page.")
2581
- }, uo = {
2628
+ }, To = {
2582
2629
  name: f.FIND_COMMENTS,
2583
2630
  description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
2584
- parameters: co,
2585
- outputSchema: lo,
2631
+ parameters: yo,
2632
+ outputSchema: ko,
2586
2633
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2587
2634
  async execute(e, t) {
2588
2635
  const r = [e.taskId, e.projectId, e.commentId].filter(Boolean);
@@ -2596,46 +2643,46 @@ const co = {
2596
2643
  projectId: e.projectId,
2597
2644
  client: t
2598
2645
  });
2599
- let n = !1, i = null, a;
2646
+ let n = !1, a = null, i;
2600
2647
  if (e.commentId)
2601
- a = [await t.getComment(e.commentId)];
2648
+ i = [await t.getComment(e.commentId)];
2602
2649
  else if (e.taskId) {
2603
2650
  const l = await t.getComments({
2604
2651
  taskId: e.taskId,
2605
2652
  cursor: e.cursor || null,
2606
2653
  limit: e.limit || C.COMMENTS_DEFAULT
2607
2654
  });
2608
- a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
2655
+ i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2609
2656
  } else if (o) {
2610
2657
  const l = await t.getComments({
2611
2658
  projectId: o,
2612
2659
  cursor: e.cursor || null,
2613
2660
  limit: e.limit || C.COMMENTS_DEFAULT
2614
2661
  });
2615
- a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
2662
+ i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2616
2663
  } else
2617
2664
  throw new Error("Invalid state: no search parameter provided");
2618
- const c = a.map(pe);
2665
+ const c = i.map(pe);
2619
2666
  return {
2620
- textContent: po({
2667
+ textContent: wo({
2621
2668
  comments: c,
2622
2669
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
2623
2670
  searchId: e.commentId || e.taskId || e.projectId || "",
2624
2671
  hasMore: n,
2625
- nextCursor: i
2672
+ nextCursor: a
2626
2673
  }),
2627
2674
  structuredContent: {
2628
2675
  comments: c,
2629
2676
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
2630
2677
  searchId: e.commentId || e.taskId || e.projectId || "",
2631
2678
  hasMore: n,
2632
- nextCursor: i ?? void 0,
2679
+ nextCursor: a ?? void 0,
2633
2680
  totalCount: c.length
2634
2681
  }
2635
2682
  };
2636
2683
  }
2637
2684
  };
2638
- function po({
2685
+ function wo({
2639
2686
  comments: e,
2640
2687
  searchType: t,
2641
2688
  searchId: r,
@@ -2644,70 +2691,70 @@ function po({
2644
2691
  }) {
2645
2692
  if (e.length === 0)
2646
2693
  return `No comments found for ${t}${t !== "single" ? ` ${r}` : ""}`;
2647
- let i;
2694
+ let a;
2648
2695
  if (t === "single") {
2649
- const a = e[0];
2650
- if (!a)
2696
+ const i = e[0];
2697
+ if (!i)
2651
2698
  return "Comment not found";
2652
- i = `Found comment${a.fileAttachment !== void 0 ? ` • Has attachment: ${a.fileAttachment?.fileName || "file"}` : ""} • id=${a.id}`;
2699
+ a = `Found comment${i.fileAttachment !== void 0 ? ` • Has attachment: ${i.fileAttachment?.fileName || "file"}` : ""} • id=${i.id}`;
2653
2700
  } else {
2654
- const a = e.filter((l) => l.fileAttachment !== void 0).length, c = a > 0 ? ` (${a} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
2655
- i = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (i += " • More available");
2701
+ const i = e.filter((l) => l.fileAttachment !== void 0).length, c = i > 0 ? ` (${i} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
2702
+ a = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (a += " • More available");
2656
2703
  }
2657
2704
  if (n) {
2658
- const a = St([], n);
2659
- return `${i}
2660
- ${a}`;
2705
+ const i = St([], n);
2706
+ return `${a}
2707
+ ${i}`;
2661
2708
  }
2662
- return i;
2709
+ return a;
2663
2710
  }
2664
2711
  function Dt(e) {
2665
2712
  const t = e.getUTCFullYear(), r = String(e.getUTCMonth() + 1).padStart(2, "0"), o = String(e.getUTCDate()).padStart(2, "0");
2666
2713
  return `${t}-${r}-${o}`;
2667
2714
  }
2668
- function mo(e) {
2715
+ function Io(e) {
2669
2716
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
2670
2717
  if (!t)
2671
2718
  return 0;
2672
- const [, r, o, n] = t, i = Number(o) * 60 + Number(n);
2673
- return r === "-" ? -i : i;
2719
+ const [, r, o, n] = t, a = Number(o) * 60 + Number(n);
2720
+ return r === "-" ? -a : a;
2674
2721
  }
2675
- function ho(e, t) {
2722
+ function vo(e, t) {
2676
2723
  const r = new Date(e.getTime() + t * 60 * 1e3);
2677
2724
  return Dt(r);
2678
2725
  }
2679
2726
  function rt(e, t) {
2680
- const [r, o, n] = e.split("-"), i = Number(r), a = Number(o), c = Number(n);
2681
- if (!Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(c))
2727
+ const [r, o, n] = e.split("-"), a = Number(r), i = Number(o), c = Number(n);
2728
+ if (!Number.isFinite(a) || !Number.isFinite(i) || !Number.isFinite(c))
2682
2729
  throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD.`);
2683
- const d = new Date(Date.UTC(i, a - 1, c));
2730
+ const d = new Date(Date.UTC(a, i - 1, c));
2684
2731
  return d.setUTCDate(d.getUTCDate() + t), Dt(d);
2685
2732
  }
2686
- const fo = ["and", "or"], qe = {
2733
+ const jo = ["and", "or"], qe = {
2687
2734
  labels: s.string().array().optional().describe("The labels to filter the tasks by"),
2688
- labelsOperator: s.enum(fo).optional().describe(
2735
+ labelsOperator: s.enum(jo).optional().describe(
2689
2736
  'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
2690
2737
  )
2691
2738
  };
2692
2739
  function Ke(e = [], t = "or") {
2693
2740
  if (e.length === 0) return "";
2694
2741
  const r = t === "and" ? " & " : " | ";
2695
- return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${r} `)})`;
2742
+ return `(${e.map((a) => a.startsWith("@") ? a : `@${a}`).join(` ${r} `)})`;
2696
2743
  }
2697
- const bo = 7;
2698
- function go({
2744
+ const So = 7;
2745
+ function Co({
2699
2746
  since: e,
2700
2747
  until: t,
2701
2748
  userGmtOffset: r,
2702
2749
  now: o = /* @__PURE__ */ new Date()
2703
2750
  }) {
2704
- const n = mo(r), i = ho(o, n), a = bo - 1, c = t ?? (e ? rt(e, a) : i);
2751
+ const n = Io(r), a = vo(o, n), i = So - 1, c = t ?? (e ? rt(e, i) : a);
2705
2752
  return {
2706
- since: e ?? rt(c, -a),
2753
+ since: e ?? rt(c, -i),
2707
2754
  until: c
2708
2755
  };
2709
2756
  }
2710
- const yo = {
2757
+ const $o = {
2711
2758
  getBy: s.enum(["completion", "due"]).default("completion").describe(
2712
2759
  '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).'
2713
2760
  ),
@@ -2731,21 +2778,21 @@ const yo = {
2731
2778
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
2732
2779
  ),
2733
2780
  ...qe
2734
- }, ko = {
2781
+ }, Do = {
2735
2782
  tasks: s.array(K).describe("The found completed tasks."),
2736
2783
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
2737
2784
  totalCount: s.number().describe("The total number of tasks in this page."),
2738
2785
  hasMore: s.boolean().describe("Whether there are more results available."),
2739
2786
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
2740
- }, To = {
2787
+ }, xo = {
2741
2788
  name: f.FIND_COMPLETED_TASKS,
2742
2789
  description: "Get completed tasks. 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.",
2743
- parameters: yo,
2744
- outputSchema: ko,
2790
+ parameters: $o,
2791
+ outputSchema: Do,
2745
2792
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2746
2793
  async execute(e, t) {
2747
- const { getBy: r, labels: o, labelsOperator: n, since: i, until: a, responsibleUser: c, projectId: d, ...l } = e;
2748
- if (e.cursor && (!i || !a))
2794
+ const { getBy: r, labels: o, labelsOperator: n, since: a, until: i, responsibleUser: c, projectId: d, ...l } = e;
2795
+ if (e.cursor && (!a || !i))
2749
2796
  throw new Error(
2750
2797
  "Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
2751
2798
  );
@@ -2755,11 +2802,11 @@ const yo = {
2755
2802
  const g = await t.getUser(), I = g.tzInfo?.gmtString || "+00:00", D = await G({
2756
2803
  projectId: d,
2757
2804
  user: g
2758
- }), $ = go({
2759
- since: i,
2760
- until: a,
2805
+ }), $ = Co({
2806
+ since: a,
2807
+ until: i,
2761
2808
  userGmtOffset: I
2762
- }), N = `${$.since}T00:00:00${I}`, T = `${$.until}T23:59:59${I}`, b = new Date(N).toISOString(), S = new Date(T).toISOString(), R = {
2809
+ }), N = `${$.since}T00:00:00${I}`, T = `${$.until}T23:59:59${I}`, b = new Date(N).toISOString(), S = new Date(T).toISOString(), U = {
2763
2810
  ...e,
2764
2811
  since: $.since,
2765
2812
  until: $.until
@@ -2775,11 +2822,11 @@ const yo = {
2775
2822
  since: b,
2776
2823
  until: S,
2777
2824
  ...h ? { filterQuery: h, filterLang: "en" } : {}
2778
- }), v = w.map(U);
2825
+ }), v = w.map(R);
2779
2826
  return {
2780
- textContent: wo({
2827
+ textContent: Ao({
2781
2828
  tasks: v,
2782
- args: R,
2829
+ args: U,
2783
2830
  nextCursor: j,
2784
2831
  assigneeEmail: p
2785
2832
  }),
@@ -2788,38 +2835,38 @@ const yo = {
2788
2835
  nextCursor: j ?? void 0,
2789
2836
  totalCount: v.length,
2790
2837
  hasMore: !!j,
2791
- appliedFilters: R
2838
+ appliedFilters: U
2792
2839
  }
2793
2840
  };
2794
2841
  }
2795
2842
  };
2796
- function wo({
2843
+ function Ao({
2797
2844
  tasks: e,
2798
2845
  args: t,
2799
2846
  nextCursor: r,
2800
2847
  assigneeEmail: o
2801
2848
  }) {
2802
- const n = t.getBy === "completion" ? "completed" : "due", i = `Completed tasks (by ${n} date)`, a = [];
2803
- if (a.push(`${n} date: ${t.since} to ${t.until}`), t.projectId && a.push(`project: ${t.projectId}`), t.sectionId && a.push(`section: ${t.sectionId}`), t.parentId && a.push(`parent: ${t.parentId}`), t.workspaceId && a.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
2849
+ const n = t.getBy === "completion" ? "completed" : "due", a = `Completed tasks (by ${n} date)`, i = [];
2850
+ if (i.push(`${n} date: ${t.since} to ${t.until}`), t.projectId && i.push(`project: ${t.projectId}`), t.sectionId && i.push(`section: ${t.sectionId}`), t.parentId && i.push(`parent: ${t.parentId}`), t.workspaceId && i.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
2804
2851
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
2805
- a.push(`labels: ${d}`);
2852
+ i.push(`labels: ${d}`);
2806
2853
  }
2807
2854
  if (t.responsibleUser) {
2808
2855
  const d = o || t.responsibleUser;
2809
- a.push(`assigned to: ${d}`);
2856
+ i.push(`assigned to: ${d}`);
2810
2857
  }
2811
2858
  const c = [];
2812
2859
  return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')), F({
2813
- subject: i,
2860
+ subject: a,
2814
2861
  count: e.length,
2815
2862
  limit: t.limit,
2816
2863
  nextCursor: r ?? void 0,
2817
- filterHints: a,
2864
+ filterHints: i,
2818
2865
  previewLines: ke(e, Math.min(e.length, t.limit)),
2819
2866
  zeroReasonHints: c
2820
2867
  });
2821
2868
  }
2822
- const Io = {
2869
+ const Eo = {
2823
2870
  searchText: s.string().optional().describe(
2824
2871
  '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.'
2825
2872
  ),
@@ -2827,7 +2874,7 @@ const Io = {
2827
2874
  cursor: s.string().optional().describe(
2828
2875
  "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."
2829
2876
  )
2830
- }, vo = {
2877
+ }, Oo = {
2831
2878
  labels: s.array(be).describe("The found personal labels."),
2832
2879
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
2833
2880
  totalCount: s.number().describe("The total number of labels in this page."),
@@ -2836,43 +2883,43 @@ const Io = {
2836
2883
  "Names of all shared labels visible to you. These have no IDs or metadata — use their names directly when filtering tasks."
2837
2884
  ),
2838
2885
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
2839
- }, jo = {
2886
+ }, Po = {
2840
2887
  name: f.FIND_LABELS,
2841
2888
  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.",
2842
- parameters: Io,
2843
- outputSchema: vo,
2889
+ parameters: Eo,
2890
+ outputSchema: Oo,
2844
2891
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2845
2892
  async execute(e, t) {
2846
2893
  const [r, o] = await Promise.all([
2847
- e.searchText ? Es(t, e.searchText).then((c) => ({
2894
+ e.searchText ? Fs(t, e.searchText).then((c) => ({
2848
2895
  results: c,
2849
2896
  nextCursor: null
2850
2897
  })) : t.getLabels({ limit: e.limit, cursor: e.cursor ?? null }),
2851
- Os(t)
2852
- ]), { results: n, nextCursor: i } = r, a = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
2898
+ Hs(t)
2899
+ ]), { results: n, nextCursor: a } = r, i = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
2853
2900
  return {
2854
- textContent: So({ labels: n, args: e, nextCursor: i, sharedLabels: o }),
2901
+ textContent: Ro({ labels: n, args: e, nextCursor: a, sharedLabels: o }),
2855
2902
  structuredContent: {
2856
2903
  labels: n.map((c) => be.parse(c)),
2857
- nextCursor: i ?? void 0,
2904
+ nextCursor: a ?? void 0,
2858
2905
  totalCount: n.length,
2859
- hasMore: !!i,
2906
+ hasMore: !!a,
2860
2907
  sharedLabels: o,
2861
- appliedFilters: a
2908
+ appliedFilters: i
2862
2909
  }
2863
2910
  };
2864
2911
  }
2865
2912
  };
2866
- function So({
2913
+ function Ro({
2867
2914
  labels: e,
2868
2915
  args: t,
2869
2916
  nextCursor: r,
2870
2917
  sharedLabels: o
2871
2918
  }) {
2872
- const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", i = [];
2873
- t.searchText && i.push(`searchText: "${t.searchText}"`);
2874
- const a = 10, d = e.slice(0, a).map(Ar).join(`
2875
- `), l = e.length - a, u = l > 0 ? `${d}
2919
+ const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
2920
+ t.searchText && a.push(`searchText: "${t.searchText}"`);
2921
+ const i = 10, d = e.slice(0, i).map(Mr).join(`
2922
+ `), l = e.length - i, u = l > 0 ? `${d}
2876
2923
  …and ${l} more` : d, p = [];
2877
2924
  e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all labels")) : p.push("No personal labels created yet"));
2878
2925
  const m = o.length > 0 ? `
@@ -2883,18 +2930,18 @@ No shared labels.`;
2883
2930
  count: e.length,
2884
2931
  limit: t.searchText ? void 0 : t.limit,
2885
2932
  nextCursor: r ?? void 0,
2886
- filterHints: i,
2933
+ filterHints: a,
2887
2934
  previewLines: u,
2888
2935
  zeroReasonHints: p
2889
2936
  }) + m;
2890
2937
  }
2891
- const { FIND_PROJECTS: Co, ADD_TASKS: xt, UPDATE_TASKS: At } = f, $o = {
2938
+ const { FIND_PROJECTS: Uo, ADD_TASKS: xt, UPDATE_TASKS: At } = f, _o = {
2892
2939
  projectId: s.string().min(1).describe("The ID of the project to search for collaborators in."),
2893
2940
  searchTerm: s.string().optional().describe(
2894
2941
  "Search for a collaborator by name or email (partial and case insensitive match). If omitted, all collaborators in the project are returned."
2895
2942
  )
2896
- }, Do = {
2897
- collaborators: s.array(Hs).describe("The found collaborators."),
2943
+ }, No = {
2944
+ collaborators: s.array(Js).describe("The found collaborators."),
2898
2945
  projectInfo: s.object({
2899
2946
  id: s.string().describe("The project ID."),
2900
2947
  name: s.string().describe("The project name."),
@@ -2903,19 +2950,19 @@ const { FIND_PROJECTS: Co, ADD_TASKS: xt, UPDATE_TASKS: At } = f, $o = {
2903
2950
  totalCount: s.number().describe("The total number of collaborators found."),
2904
2951
  totalAvailable: s.number().optional().describe("The total number of available collaborators in the project."),
2905
2952
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
2906
- }, xo = {
2953
+ }, Lo = {
2907
2954
  name: f.FIND_PROJECT_COLLABORATORS,
2908
2955
  description: "Search for collaborators by name or other criteria in a project.",
2909
- parameters: $o,
2910
- outputSchema: Do,
2956
+ parameters: _o,
2957
+ outputSchema: No,
2911
2958
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2912
2959
  async execute(e, t) {
2913
2960
  const { projectId: r, searchTerm: o } = e;
2914
- let n = r, i;
2961
+ let n = r, a;
2915
2962
  try {
2916
- if (i = await t.getProject(r), !i)
2963
+ if (a = await t.getProject(r), !a)
2917
2964
  throw new Error(`Project with ID "${r}" not found or not accessible`);
2918
- if (n = i.name, !i.isShared)
2965
+ if (n = a.name, !a.isShared)
2919
2966
  return {
2920
2967
  textContent: `Project "${n}" is not shared and has no collaborators.
2921
2968
 
@@ -2938,8 +2985,8 @@ const { FIND_PROJECTS: Co, ADD_TASKS: xt, UPDATE_TASKS: At } = f, $o = {
2938
2985
  `Failed to access project "${r}": ${l instanceof Error ? l.message : "Unknown error"}`
2939
2986
  );
2940
2987
  }
2941
- const a = await B.getProjectCollaborators(t, r);
2942
- if (a.length === 0)
2988
+ const i = await B.getProjectCollaborators(t, r);
2989
+ if (i.length === 0)
2943
2990
  return {
2944
2991
  textContent: `Project "${n}" has no collaborators or collaborator data is not accessible.
2945
2992
 
@@ -2958,19 +3005,19 @@ const { FIND_PROJECTS: Co, ADD_TASKS: xt, UPDATE_TASKS: At } = f, $o = {
2958
3005
  appliedFilters: e
2959
3006
  }
2960
3007
  };
2961
- let c = a;
3008
+ let c = i;
2962
3009
  if (o) {
2963
3010
  const l = o.toLowerCase().trim();
2964
- c = a.filter(
3011
+ c = i.filter(
2965
3012
  (u) => u.name.toLowerCase().includes(l) || u.email.toLowerCase().includes(l)
2966
3013
  );
2967
3014
  }
2968
3015
  return {
2969
- textContent: Ao({
3016
+ textContent: Mo({
2970
3017
  collaborators: c,
2971
3018
  projectName: n,
2972
3019
  searchTerm: o,
2973
- totalAvailable: a.length
3020
+ totalAvailable: i.length
2974
3021
  }),
2975
3022
  structuredContent: {
2976
3023
  collaborators: c,
@@ -2980,39 +3027,39 @@ const { FIND_PROJECTS: Co, ADD_TASKS: xt, UPDATE_TASKS: At } = f, $o = {
2980
3027
  isShared: !0
2981
3028
  },
2982
3029
  totalCount: c.length,
2983
- totalAvailable: a.length,
3030
+ totalAvailable: i.length,
2984
3031
  appliedFilters: e
2985
3032
  }
2986
3033
  };
2987
3034
  }
2988
3035
  };
2989
- function Ao({
3036
+ function Mo({
2990
3037
  collaborators: e,
2991
3038
  projectName: t,
2992
3039
  searchTerm: r,
2993
3040
  totalAvailable: o
2994
3041
  }) {
2995
- const n = r ? `Project collaborators matching "${r}"` : "Project collaborators", i = [];
2996
- r && i.push(`matching "${r}"`), i.push(`in project "${t}"`);
2997
- let a = [];
2998
- e.length > 0 && (a = e.slice(0, 10).map((l) => {
3042
+ const n = r ? `Project collaborators matching "${r}"` : "Project collaborators", a = [];
3043
+ r && a.push(`matching "${r}"`), a.push(`in project "${t}"`);
3044
+ let i = [];
3045
+ e.length > 0 && (i = e.slice(0, 10).map((l) => {
2999
3046
  const u = l.name || "Unknown Name", p = l.email || "No email";
3000
3047
  return `• ${u} (${p}) - ID: ${l.id}`;
3001
- }), e.length > 10 && a.push(`... and ${e.length - 10} more`));
3048
+ }), e.length > 10 && i.push(`... and ${e.length - 10} more`));
3002
3049
  const c = [];
3003
3050
  e.length === 0 && (r ? (c.push(`No collaborators match "${r}"`), c.push("Try a broader search term or check spelling"), o > 0 && c.push(`${o} collaborators available without filter`)) : (c.push("Project has no collaborators"), c.push("Share the project to add collaborators")));
3004
3051
  const d = [];
3005
- return e.length > 0 ? (d.push(`Use ${xt} with responsibleUser to assign new tasks`), d.push(`Use ${At} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${Co} to find other projects`), r && o > 0 && d.push("Try searching without filters to see all collaborators")), F({
3052
+ return e.length > 0 ? (d.push(`Use ${xt} with responsibleUser to assign new tasks`), d.push(`Use ${At} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${Uo} to find other projects`), r && o > 0 && d.push("Try searching without filters to see all collaborators")), F({
3006
3053
  subject: n,
3007
3054
  count: e.length,
3008
- filterHints: i,
3009
- previewLines: a.join(`
3055
+ filterHints: a,
3056
+ previewLines: i.join(`
3010
3057
  `),
3011
3058
  zeroReasonHints: c,
3012
3059
  nextSteps: d
3013
3060
  });
3014
3061
  }
3015
- const { ADD_PROJECTS: Eo } = f, Oo = {
3062
+ const { ADD_PROJECTS: Fo } = f, Ho = {
3016
3063
  searchText: s.string().optional().describe(
3017
3064
  '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.'
3018
3065
  ),
@@ -3020,32 +3067,32 @@ const { ADD_PROJECTS: Eo } = f, Oo = {
3020
3067
  cursor: s.string().optional().describe(
3021
3068
  "The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
3022
3069
  )
3023
- }, Po = {
3024
- projects: s.array(ie).describe("The found projects."),
3070
+ }, Wo = {
3071
+ projects: s.array(ae).describe("The found projects."),
3025
3072
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
3026
3073
  totalCount: s.number().describe("The total number of projects in this page."),
3027
3074
  hasMore: s.boolean().describe("Whether there are more results available."),
3028
3075
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
3029
- }, Uo = {
3076
+ }, Bo = {
3030
3077
  name: f.FIND_PROJECTS,
3031
3078
  description: "List all projects or search for projects by name. When searching, all matching projects are returned (pagination is ignored). When not searching, projects are returned with pagination.",
3032
- parameters: Oo,
3033
- outputSchema: Po,
3079
+ parameters: Ho,
3080
+ outputSchema: Wo,
3034
3081
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3035
3082
  async execute(e, t) {
3036
3083
  let r, o = null;
3037
3084
  if (e.searchText)
3038
3085
  r = await Tt(t, e.searchText), o = null;
3039
3086
  else {
3040
- const i = await t.getProjects({
3087
+ const a = await t.getProjects({
3041
3088
  limit: e.limit,
3042
3089
  cursor: e.cursor ?? null
3043
3090
  });
3044
- r = i.results, o = i.nextCursor;
3091
+ r = a.results, o = a.nextCursor;
3045
3092
  }
3046
3093
  const n = r.map(q);
3047
3094
  return {
3048
- textContent: Ro({ projects: n, args: e, nextCursor: o }),
3095
+ textContent: zo({ projects: n, args: e, nextCursor: o }),
3049
3096
  structuredContent: {
3050
3097
  projects: n,
3051
3098
  nextCursor: o ?? void 0,
@@ -3056,17 +3103,17 @@ const { ADD_PROJECTS: Eo } = f, Oo = {
3056
3103
  };
3057
3104
  }
3058
3105
  };
3059
- function Ro({
3106
+ function zo({
3060
3107
  projects: e,
3061
3108
  args: t,
3062
3109
  nextCursor: r
3063
3110
  }) {
3064
3111
  const o = t.searchText ? `All projects matching "${t.searchText}"` : "Projects", n = [];
3065
3112
  t.searchText && n.push(`searchText: "${t.searchText}"`);
3066
- const i = 10, c = e.slice(0, i).map(Er).join(`
3067
- `), d = e.length - i, l = d > 0 ? `${c}
3113
+ const a = 10, c = e.slice(0, a).map(Fr).join(`
3114
+ `), d = e.length - a, l = d > 0 ? `${c}
3068
3115
  …and ${d} more` : c, u = [];
3069
- return e.length === 0 && (t.searchText ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove searchText to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${Eo} to create a project`))), F({
3116
+ return e.length === 0 && (t.searchText ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove searchText to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${Fo} to create a project`))), F({
3070
3117
  subject: o,
3071
3118
  count: e.length,
3072
3119
  limit: t.searchText ? void 0 : t.limit,
@@ -3076,35 +3123,35 @@ function Ro({
3076
3123
  zeroReasonHints: u
3077
3124
  });
3078
3125
  }
3079
- const _o = {
3126
+ const Yo = {
3080
3127
  taskId: s.string().optional().describe(
3081
3128
  "Find all reminders for a specific task. Returns both time-based and location reminders."
3082
3129
  ),
3083
3130
  reminderId: s.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
3084
3131
  locationReminderId: s.string().optional().describe("Get a specific location reminder by its ID.")
3085
- }, No = {
3132
+ }, Go = {
3086
3133
  reminders: s.array(He).describe("The found reminders (time-based and location)."),
3087
3134
  searchType: s.string().describe('The search type used: "task", "reminder", or "location_reminder".'),
3088
3135
  searchId: s.string().describe("The ID used for the search."),
3089
3136
  totalCount: s.number().describe("Total reminders in this response.")
3090
- }, Lo = {
3137
+ }, qo = {
3091
3138
  name: f.FIND_REMINDERS,
3092
3139
  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.",
3093
- parameters: _o,
3094
- outputSchema: No,
3140
+ parameters: Yo,
3141
+ outputSchema: Go,
3095
3142
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3096
3143
  async execute(e, t) {
3097
- const { taskId: r, reminderId: o, locationReminderId: n } = e, i = [r, o, n].filter(Boolean);
3098
- if (i.length === 0)
3144
+ const { taskId: r, reminderId: o, locationReminderId: n } = e, a = [r, o, n].filter(Boolean);
3145
+ if (a.length === 0)
3099
3146
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
3100
- if (i.length > 1)
3147
+ if (a.length > 1)
3101
3148
  throw new Error(
3102
3149
  "Only one of taskId, reminderId, or locationReminderId can be provided at a time."
3103
3150
  );
3104
3151
  if (o) {
3105
- const a = await t.getReminder(o), c = ce(a);
3152
+ const i = await t.getReminder(o), c = ce(i);
3106
3153
  return {
3107
- textContent: `Found ${a.type} reminder (id=${o})`,
3154
+ textContent: `Found ${i.type} reminder (id=${o})`,
3108
3155
  structuredContent: {
3109
3156
  reminders: [c],
3110
3157
  searchType: "reminder",
@@ -3114,7 +3161,7 @@ const _o = {
3114
3161
  };
3115
3162
  }
3116
3163
  if (n) {
3117
- const a = await t.getLocationReminder(n), c = ce(a);
3164
+ const i = await t.getLocationReminder(n), c = ce(i);
3118
3165
  return {
3119
3166
  textContent: `Found location reminder (id=${n})`,
3120
3167
  structuredContent: {
@@ -3126,7 +3173,7 @@ const _o = {
3126
3173
  };
3127
3174
  }
3128
3175
  if (r) {
3129
- const [a, c] = await Promise.all([
3176
+ const [i, c] = await Promise.all([
3130
3177
  oe({
3131
3178
  apiMethod: (p) => t.getReminders(p),
3132
3179
  args: { taskId: r }
@@ -3135,9 +3182,9 @@ const _o = {
3135
3182
  apiMethod: (p) => t.getLocationReminders(p),
3136
3183
  args: { taskId: r }
3137
3184
  })
3138
- ]), l = [...a, ...c].map(ce);
3185
+ ]), l = [...i, ...c].map(ce);
3139
3186
  return {
3140
- textContent: Mo(l, r),
3187
+ textContent: Ko(l, r),
3141
3188
  structuredContent: {
3142
3189
  reminders: l,
3143
3190
  searchType: "task",
@@ -3149,36 +3196,36 @@ const _o = {
3149
3196
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
3150
3197
  }
3151
3198
  };
3152
- function Mo(e, t) {
3199
+ function Ko(e, t) {
3153
3200
  if (e.length === 0)
3154
3201
  return `No reminders found for task ${t}`;
3155
3202
  const { timeBasedCount: r, locationCount: o } = wt(e), n = [];
3156
3203
  if (r > 0) {
3157
- const i = r > 1 ? "time-based reminders" : "time-based reminder";
3158
- n.push(`${r} ${i}`);
3204
+ const a = r > 1 ? "time-based reminders" : "time-based reminder";
3205
+ n.push(`${r} ${a}`);
3159
3206
  }
3160
3207
  if (o > 0) {
3161
- const i = o > 1 ? "location reminders" : "location reminder";
3162
- n.push(`${o} ${i}`);
3208
+ const a = o > 1 ? "location reminders" : "location reminder";
3209
+ n.push(`${o} ${a}`);
3163
3210
  }
3164
3211
  return `Found ${n.join(" and ")} for task ${t}`;
3165
3212
  }
3166
- const { ADD_SECTIONS: Fo } = f, Ho = {
3213
+ const { ADD_SECTIONS: Vo } = f, Jo = {
3167
3214
  projectId: s.string().min(1).describe(
3168
3215
  'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
3169
3216
  ),
3170
3217
  searchText: s.string().optional().describe(
3171
3218
  '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.'
3172
3219
  )
3173
- }, Wo = {
3220
+ }, Xo = {
3174
3221
  sections: s.array(he).describe("The found sections."),
3175
3222
  totalCount: s.number().describe("The total number of sections found."),
3176
3223
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
3177
- }, Bo = {
3224
+ }, Zo = {
3178
3225
  name: f.FIND_SECTIONS,
3179
3226
  description: "Search for sections by name or other criteria in a project. When searching, uses server-side search to avoid fetching all sections.",
3180
- parameters: Ho,
3181
- outputSchema: Wo,
3227
+ parameters: Jo,
3228
+ outputSchema: Xo,
3182
3229
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3183
3230
  async execute(e, t) {
3184
3231
  const r = await G({
@@ -3186,12 +3233,12 @@ const { ADD_SECTIONS: Fo } = f, Ho = {
3186
3233
  client: t
3187
3234
  });
3188
3235
  let o;
3189
- e.searchText ? o = await Ps(t, e.searchText, r) : o = (await t.getSections({
3236
+ e.searchText ? o = await Ws(t, e.searchText, r) : o = (await t.getSections({
3190
3237
  projectId: r
3191
3238
  })).results;
3192
- const n = o.map(({ id: a, name: c }) => ({ id: a, name: c }));
3239
+ const n = o.map(({ id: i, name: c }) => ({ id: i, name: c }));
3193
3240
  return {
3194
- textContent: zo({
3241
+ textContent: Qo({
3195
3242
  sections: n,
3196
3243
  projectId: e.projectId,
3197
3244
  searchText: e.searchText
@@ -3204,29 +3251,29 @@ const { ADD_SECTIONS: Fo } = f, Ho = {
3204
3251
  };
3205
3252
  }
3206
3253
  };
3207
- function zo({
3254
+ function Qo({
3208
3255
  sections: e,
3209
3256
  projectId: t,
3210
3257
  searchText: r
3211
3258
  }) {
3212
3259
  const o = [];
3213
- r ? (o.push("Try broader search terms"), o.push("Check spelling"), o.push("Remove searchText to see all sections")) : (o.push("Project has no sections yet"), o.push(`Use ${Fo} to create sections`));
3214
- const n = r ? `Sections in project ${t} matching "${r}"` : `Sections in project ${t}`, i = e.length > 0 ? e.map((a) => ` ${a.name} • id=${a.id}`).join(`
3260
+ r ? (o.push("Try broader search terms"), o.push("Check spelling"), o.push("Remove searchText to see all sections")) : (o.push("Project has no sections yet"), o.push(`Use ${Vo} to create sections`));
3261
+ const n = r ? `Sections in project ${t} matching "${r}"` : `Sections in project ${t}`, a = e.length > 0 ? e.map((i) => ` ${i.name} • id=${i.id}`).join(`
3215
3262
  `) : void 0;
3216
3263
  return F({
3217
3264
  subject: n,
3218
3265
  count: e.length,
3219
- previewLines: i,
3266
+ previewLines: a,
3220
3267
  zeroReasonHints: o
3221
3268
  });
3222
3269
  }
3223
- const Yo = 300 * 1e3;
3224
- class Go {
3270
+ const en = 300 * 1e3;
3271
+ class tn {
3225
3272
  constructor() {
3226
3273
  this.cache = null;
3227
3274
  }
3228
3275
  async getFilters(t) {
3229
- if (this.cache && Date.now() - this.cache.timestamp < Yo)
3276
+ if (this.cache && Date.now() - this.cache.timestamp < en)
3230
3277
  return this.cache.filters;
3231
3278
  const o = ((await t.sync({
3232
3279
  resourceTypes: ["filters"],
@@ -3248,17 +3295,17 @@ class Go {
3248
3295
  const o = r.trim();
3249
3296
  if (!o)
3250
3297
  throw new Error("Filter reference cannot be empty");
3251
- const n = await this.getFilters(t), i = n.find((u) => u.id === o);
3252
- if (i)
3253
- return { filterId: i.id, filterName: i.name, filterQuery: i.query };
3254
- const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
3298
+ const n = await this.getFilters(t), a = n.find((u) => u.id === o);
3299
+ if (a)
3300
+ return { filterId: a.id, filterName: a.name, filterQuery: a.query };
3301
+ const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
3255
3302
  if (c)
3256
3303
  return {
3257
3304
  filterId: c.id,
3258
3305
  filterName: c.name,
3259
3306
  filterQuery: c.query
3260
3307
  };
3261
- const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
3308
+ const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
3262
3309
  if (l)
3263
3310
  return {
3264
3311
  filterId: l.id,
@@ -3283,7 +3330,7 @@ ${u}` + (d.length > 5 ? `
3283
3330
  this.cache = null;
3284
3331
  }
3285
3332
  }
3286
- const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3333
+ const sn = new tn(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, rn = {
3287
3334
  searchText: s.string().optional().describe("The text to search for in tasks."),
3288
3335
  projectId: s.string().optional().describe(
3289
3336
  'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
@@ -3305,25 +3352,25 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3305
3352
  "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."
3306
3353
  ),
3307
3354
  ...qe
3308
- }, Vo = {
3355
+ }, on = {
3309
3356
  tasks: s.array(K).describe("The found tasks."),
3310
3357
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
3311
3358
  totalCount: s.number().describe("The total number of tasks in this page."),
3312
3359
  hasMore: s.boolean().describe("Whether there are more results available."),
3313
3360
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
3314
- }, Jo = {
3361
+ }, nn = {
3315
3362
  name: f.FIND_TASKS,
3316
3363
  description: "Find tasks by text search, project/section/parent container, responsible user, labels, a raw Todoist filter string, or a saved filter by ID or name (filterIdOrName). At least one filter must be provided.",
3317
- parameters: Ko,
3318
- outputSchema: Vo,
3364
+ parameters: rn,
3365
+ outputSchema: on,
3319
3366
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3320
3367
  async execute(e, t) {
3321
3368
  const {
3322
3369
  searchText: r,
3323
3370
  projectId: o,
3324
3371
  sectionId: n,
3325
- parentId: i,
3326
- responsibleUser: a,
3372
+ parentId: a,
3373
+ responsibleUser: i,
3327
3374
  responsibleUserFiltering: c,
3328
3375
  limit: d,
3329
3376
  cursor: l,
@@ -3332,7 +3379,7 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3332
3379
  filter: m,
3333
3380
  filterIdOrName: h
3334
3381
  } = e, g = await t.getUser(), I = u && u.length > 0;
3335
- if (!r && !o && !n && !i && !a && !I && !m && !h)
3382
+ if (!r && !o && !n && !a && !i && !I && !m && !h)
3336
3383
  throw new Error(
3337
3384
  "At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
3338
3385
  );
@@ -3340,24 +3387,24 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3340
3387
  throw new Error(
3341
3388
  "The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one."
3342
3389
  );
3343
- if ((m || h) && (o || n || i))
3390
+ if ((m || h) && (o || n || a))
3344
3391
  throw new Error(
3345
3392
  'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
3346
3393
  );
3347
3394
  let D = m;
3348
- h && (D = (await qo.resolveFilter(t, h)).filterQuery);
3349
- const $ = await Le(t, a), N = $?.userId, T = $?.email;
3350
- if (o || n || i) {
3395
+ h && (D = (await sn.resolveFilter(t, h)).filterQuery);
3396
+ const $ = await Le(t, i), N = $?.userId, T = $?.email;
3397
+ if (o || n || a) {
3351
3398
  const x = {
3352
3399
  limit: d,
3353
3400
  cursor: l ?? null
3354
3401
  };
3355
- o && (x.projectId = await G({ projectId: o, user: g })), n && (x.sectionId = n), i && (x.parentId = i);
3356
- const { results: L, nextCursor: H } = await t.getTasks(x), Te = L.map(U);
3402
+ o && (x.projectId = await G({ projectId: o, user: g })), n && (x.sectionId = n), a && (x.parentId = a);
3403
+ const { results: L, nextCursor: H } = await t.getTasks(x), Te = L.map(R);
3357
3404
  let M = r ? Te.filter(
3358
3405
  (V) => V.content.toLowerCase().includes(r.toLowerCase()) || V.description?.toLowerCase().includes(r.toLowerCase())
3359
3406
  ) : Te;
3360
- return M = As({
3407
+ return M = Ms({
3361
3408
  tasks: M,
3362
3409
  resolvedAssigneeId: N,
3363
3410
  currentUserId: g.id,
@@ -3389,7 +3436,7 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3389
3436
  lang: "en",
3390
3437
  limit: d,
3391
3438
  cursor: l ?? null
3392
- }), H = x.map(U);
3439
+ }), H = x.map(R);
3393
3440
  return {
3394
3441
  textContent: Se({
3395
3442
  tasks: H,
@@ -3410,7 +3457,7 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3410
3457
  let b = D ? `(${D})` : "";
3411
3458
  r && (b = se(b, `search: ${r}`));
3412
3459
  const S = Ke(u, p);
3413
- if (b = se(b, S), !(h && !a && !c)) {
3460
+ if (b = se(b, S), !(h && !i && !c)) {
3414
3461
  const x = kt({
3415
3462
  resolvedAssigneeId: N,
3416
3463
  assigneeEmail: T,
@@ -3442,7 +3489,7 @@ const qo = new Go(), { FIND_COMPLETED_TASKS: ot, ADD_TASKS: nt } = f, Ko = {
3442
3489
  };
3443
3490
  }
3444
3491
  };
3445
- function Xo(e) {
3492
+ function an(e) {
3446
3493
  if (e.projectId) {
3447
3494
  const t = [
3448
3495
  e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
@@ -3466,27 +3513,27 @@ function Se({
3466
3513
  isContainerSearch: o,
3467
3514
  assigneeEmail: n
3468
3515
  }) {
3469
- let i = "Tasks";
3470
- const a = [], c = [];
3516
+ let a = "Tasks";
3517
+ const i = [], c = [];
3471
3518
  if (o) {
3472
- if (t.projectId ? (i = "Tasks in project", a.push(`in project ${t.projectId}`)) : t.sectionId ? (i = "Tasks in section", a.push(`in section ${t.sectionId}`)) : t.parentId ? (i = "Subtasks", a.push(`subtasks of ${t.parentId}`)) : i = "Tasks", t.searchText && (i += ` matching "${t.searchText}"`, a.push(`containing "${t.searchText}"`)), t.responsibleUser) {
3519
+ if (t.projectId ? (a = "Tasks in project", i.push(`in project ${t.projectId}`)) : t.sectionId ? (a = "Tasks in section", i.push(`in section ${t.sectionId}`)) : t.parentId ? (a = "Subtasks", i.push(`subtasks of ${t.parentId}`)) : a = "Tasks", t.searchText && (a += ` matching "${t.searchText}"`, i.push(`containing "${t.searchText}"`)), t.responsibleUser) {
3473
3520
  const d = n || t.responsibleUser;
3474
- i += ` assigned to ${d}`, a.push(`assigned to ${d}`);
3521
+ a += ` assigned to ${d}`, i.push(`assigned to ${d}`);
3475
3522
  }
3476
3523
  if (t.labels && t.labels.length > 0) {
3477
3524
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
3478
- a.push(`labels: ${d}`);
3525
+ i.push(`labels: ${d}`);
3479
3526
  }
3480
- e.length === 0 && c.push(...Xo(t));
3527
+ e.length === 0 && c.push(...an(t));
3481
3528
  } else {
3482
3529
  const d = n || t.responsibleUser, l = [];
3483
3530
  if (t.filter && l.push(`filter: ${t.filter}`), t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
3484
3531
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
3485
3532
  l.push(`with labels: ${u}`);
3486
3533
  }
3487
- if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (i = `Tasks matching filter: ${t.filter}`, a.push(`filter: ${t.filter}`)) : t.searchText ? (i = `Search results for ${l.join(" ")}`, a.push(`matching "${t.searchText}"`), t.filter && a.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (i = `Tasks assigned to ${d}`, t.filter && a.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (i = `Tasks with labels: ${t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ")}`, t.filter && a.push(`filter: ${t.filter}`)) : i = `Tasks ${l.join(" ")}`, t.responsibleUser && a.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
3534
+ if (t.filter && !t.searchText && !t.responsibleUser && !t.labels?.length ? (a = `Tasks matching filter: ${t.filter}`, i.push(`filter: ${t.filter}`)) : t.searchText ? (a = `Search results for ${l.join(" ")}`, i.push(`matching "${t.searchText}"`), t.filter && i.push(`filter: ${t.filter}`)) : t.responsibleUser && (!t.labels || t.labels.length === 0) ? (a = `Tasks assigned to ${d}`, t.filter && i.push(`filter: ${t.filter}`)) : t.labels && t.labels.length > 0 && !t.responsibleUser ? (a = `Tasks with labels: ${t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ")}`, t.filter && i.push(`filter: ${t.filter}`)) : a = `Tasks ${l.join(" ")}`, t.responsibleUser && i.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
3488
3535
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
3489
- a.push(`labels: ${u}`);
3536
+ i.push(`labels: ${u}`);
3490
3537
  }
3491
3538
  if (e.length === 0) {
3492
3539
  if (t.responsibleUser) {
@@ -3497,11 +3544,11 @@ function Se({
3497
3544
  }
3498
3545
  }
3499
3546
  return F({
3500
- subject: i,
3547
+ subject: a,
3501
3548
  count: e.length,
3502
3549
  limit: t.limit,
3503
3550
  nextCursor: r ?? void 0,
3504
- filterHints: a,
3551
+ filterHints: i,
3505
3552
  previewLines: ke(e, Math.min(e.length, t.limit)),
3506
3553
  zeroReasonHints: c
3507
3554
  });
@@ -3509,7 +3556,7 @@ function Se({
3509
3556
  function Et(e) {
3510
3557
  return /* @__PURE__ */ new Date(`${e}T00:00:00`);
3511
3558
  }
3512
- const Zo = {
3559
+ const cn = {
3513
3560
  startDate: s.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe("The start date to get the tasks for. Format: YYYY-MM-DD or 'today'."),
3514
3561
  overdueOption: s.enum(["overdue-only", "include-overdue", "exclude-overdue"]).optional().describe(
3515
3562
  "How to handle overdue tasks. 'overdue-only' to get only overdue tasks, 'include-overdue' to include overdue tasks along with tasks for the specified date(s), and 'exclude-overdue' to exclude overdue tasks. Default is 'include-overdue'."
@@ -3528,17 +3575,17 @@ const Zo = {
3528
3575
  "Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."
3529
3576
  ),
3530
3577
  ...qe
3531
- }, Qo = {
3578
+ }, dn = {
3532
3579
  tasks: s.array(K).describe("The found tasks."),
3533
3580
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
3534
3581
  totalCount: s.number().describe("The total number of tasks in this page."),
3535
3582
  hasMore: s.boolean().describe("Whether there are more results available."),
3536
3583
  appliedFilters: s.record(s.string(), s.unknown()).describe("The filters that were applied to the search.")
3537
- }, en = {
3584
+ }, ln = {
3538
3585
  name: f.FIND_TASKS_BY_DATE,
3539
3586
  description: "Get tasks by date range. startDate='today' includes overdue items. Default responsibleUserFiltering='unassignedOrMe' excludes others' tasks. Person-specific queries (summaries, plans, reports) require responsibleUser.",
3540
- parameters: Zo,
3541
- outputSchema: Qo,
3587
+ parameters: cn,
3588
+ outputSchema: dn,
3542
3589
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3543
3590
  async execute(e, t) {
3544
3591
  if (!e.startDate && e.overdueOption !== "overdue-only")
@@ -3546,35 +3593,35 @@ const Zo = {
3546
3593
  "Either startDate must be provided or overdueOption must be set to overdue-only"
3547
3594
  );
3548
3595
  const r = await Le(t, e.responsibleUser), o = r?.userId, n = r?.email;
3549
- let i = "";
3596
+ let a = "";
3550
3597
  if (e.overdueOption === "overdue-only")
3551
- i = "overdue";
3598
+ a = "overdue";
3552
3599
  else if (e.startDate === "today")
3553
3600
  if (e.daysCount > 1) {
3554
3601
  const p = /* @__PURE__ */ new Date(), m = te(p), h = De(p, e.daysCount), g = Je(h, { representation: "date" }), I = `(due after: ${m} | due: ${m}) & due before: ${g}`;
3555
- i = e.overdueOption === "exclude-overdue" ? I : `(${I} | overdue)`;
3602
+ a = e.overdueOption === "exclude-overdue" ? I : `(${I} | overdue)`;
3556
3603
  } else
3557
- i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3604
+ a = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3558
3605
  else if (e.startDate) {
3559
3606
  const p = e.startDate, m = De(Et(p), e.daysCount), h = Je(m, { representation: "date" });
3560
- i = `(due after: ${p} | due: ${p}) & due before: ${h}`;
3607
+ a = `(due after: ${p} | due: ${p}) & due before: ${h}`;
3561
3608
  }
3562
- const a = Ke(e.labels, e.labelsOperator);
3563
- a.length > 0 && (i = se(i, `(${a})`));
3609
+ const i = Ke(e.labels, e.labelsOperator);
3610
+ i.length > 0 && (a = se(a, `(${i})`));
3564
3611
  const c = kt({
3565
3612
  resolvedAssigneeId: o,
3566
3613
  assigneeEmail: n,
3567
3614
  responsibleUserFiltering: e.responsibleUserFiltering
3568
3615
  });
3569
- i = se(i, c);
3616
+ a = se(a, c);
3570
3617
  const { tasks: d, nextCursor: l } = await Fe({
3571
3618
  client: t,
3572
- query: i,
3619
+ query: a,
3573
3620
  cursor: e.cursor,
3574
3621
  limit: e.limit
3575
3622
  });
3576
3623
  return {
3577
- textContent: tn({ tasks: d, args: e, nextCursor: l, assigneeEmail: n }),
3624
+ textContent: un({ tasks: d, args: e, nextCursor: l, assigneeEmail: n }),
3578
3625
  structuredContent: {
3579
3626
  tasks: d,
3580
3627
  nextCursor: l ?? void 0,
@@ -3585,7 +3632,7 @@ const Zo = {
3585
3632
  };
3586
3633
  }
3587
3634
  };
3588
- function tn({
3635
+ function un({
3589
3636
  tasks: e,
3590
3637
  args: t,
3591
3638
  nextCursor: r,
@@ -3611,31 +3658,31 @@ function tn({
3611
3658
  const c = o || t.responsibleUser;
3612
3659
  n.push(`assigned to: ${c}`);
3613
3660
  }
3614
- let i = "";
3615
- if (t.overdueOption === "overdue-only" ? i = "Overdue tasks" : t.startDate === "today" ? i = t.overdueOption === "exclude-overdue" ? "Today's tasks" : "Today's tasks + overdue" : t.startDate ? i = `Tasks for ${t.startDate}` : i = "Tasks", t.responsibleUser) {
3661
+ let a = "";
3662
+ if (t.overdueOption === "overdue-only" ? a = "Overdue tasks" : t.startDate === "today" ? a = t.overdueOption === "exclude-overdue" ? "Today's tasks" : "Today's tasks + overdue" : t.startDate ? a = `Tasks for ${t.startDate}` : a = "Tasks", t.responsibleUser) {
3616
3663
  const c = o || t.responsibleUser;
3617
- i += ` assigned to ${c}`;
3664
+ a += ` assigned to ${c}`;
3618
3665
  }
3619
- const a = [];
3666
+ const i = [];
3620
3667
  if (e.length === 0)
3621
3668
  if (t.overdueOption === "overdue-only")
3622
- a.push("Great job! No overdue tasks");
3669
+ i.push("Great job! No overdue tasks");
3623
3670
  else if (t.startDate === "today") {
3624
3671
  const c = t.overdueOption === "exclude-overdue" ? "" : " or overdue";
3625
- a.push(`Great job! No tasks for today${c}`);
3672
+ i.push(`Great job! No tasks for today${c}`);
3626
3673
  } else
3627
- a.push("Expand date range with larger 'daysCount'"), a.push("Check today's tasks with startDate='today'");
3674
+ i.push("Expand date range with larger 'daysCount'"), i.push("Check today's tasks with startDate='today'");
3628
3675
  return F({
3629
- subject: i,
3676
+ subject: a,
3630
3677
  count: e.length,
3631
3678
  limit: t.limit,
3632
3679
  nextCursor: r ?? void 0,
3633
3680
  filterHints: n,
3634
3681
  previewLines: ke(e, Math.min(e.length, t.limit)),
3635
- zeroReasonHints: a
3682
+ zeroReasonHints: i
3636
3683
  });
3637
3684
  }
3638
- const sn = {
3685
+ const pn = {
3639
3686
  projectId: s.string().min(1).optional().describe(
3640
3687
  "Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
3641
3688
  )
@@ -3654,7 +3701,7 @@ const sn = {
3654
3701
  ),
3655
3702
  children: s.array(Ot).describe("Nested child projects.")
3656
3703
  })
3657
- ), rn = {
3704
+ ), mn = {
3658
3705
  type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
3659
3706
  totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
3660
3707
  totalTasks: s.number().optional().describe("Total number of tasks."),
@@ -3698,7 +3745,7 @@ const sn = {
3698
3745
  tasksWithoutSection: s.number()
3699
3746
  }).optional().describe("Statistics object (project overview only).")
3700
3747
  };
3701
- function on(e) {
3748
+ function hn(e) {
3702
3749
  const t = {};
3703
3750
  for (const n of e)
3704
3751
  t[n.id] = {
@@ -3708,22 +3755,22 @@ function on(e) {
3708
3755
  };
3709
3756
  const r = [];
3710
3757
  for (const n of e) {
3711
- const i = t[n.id];
3712
- if (i)
3758
+ const a = t[n.id];
3759
+ if (a)
3713
3760
  if (re(n) && n.parentId) {
3714
- const a = t[n.parentId];
3715
- a ? a.children.push(i) : r.push(i);
3761
+ const i = t[n.parentId];
3762
+ i ? i.children.push(a) : r.push(a);
3716
3763
  } else
3717
- r.push(i);
3764
+ r.push(a);
3718
3765
  }
3719
3766
  function o(n) {
3720
- n.sort((i, a) => i.childOrder - a.childOrder);
3721
- for (const i of n)
3722
- o(i.children);
3767
+ n.sort((a, i) => a.childOrder - i.childOrder);
3768
+ for (const a of n)
3769
+ o(a.children);
3723
3770
  }
3724
3771
  return o(r), r;
3725
3772
  }
3726
- async function nn(e, t) {
3773
+ async function fn(e, t) {
3727
3774
  const r = {};
3728
3775
  return await Promise.all(
3729
3776
  t.map(async (o) => {
@@ -3736,13 +3783,13 @@ function Pt(e, t, r = "") {
3736
3783
  const o = [];
3737
3784
  o.push(`${r}- Project: ${e.name} (id=${e.id})`);
3738
3785
  const n = t[e.id] || [];
3739
- for (const i of n)
3740
- o.push(`${r} - Section: ${i.name} (id=${i.id})`);
3741
- for (const i of e.children)
3742
- o.push(...Pt(i, t, `${r} `));
3786
+ for (const a of n)
3787
+ o.push(`${r} - Section: ${a.name} (id=${a.id})`);
3788
+ for (const a of e.children)
3789
+ o.push(...Pt(a, t, `${r} `));
3743
3790
  return o;
3744
3791
  }
3745
- function it(e) {
3792
+ function at(e) {
3746
3793
  const t = {};
3747
3794
  for (const o of e)
3748
3795
  t[o.id] = { ...o, children: [] };
@@ -3754,20 +3801,20 @@ function it(e) {
3754
3801
  r.push(n);
3755
3802
  continue;
3756
3803
  }
3757
- const i = t[o.parentId];
3758
- i ? i.children.push(n) : r.push(n);
3804
+ const a = t[o.parentId];
3805
+ a ? a.children.push(n) : r.push(n);
3759
3806
  }
3760
3807
  return r;
3761
3808
  }
3762
- function Ue(e, t = "") {
3809
+ function Re(e, t = "") {
3763
3810
  const r = [];
3764
3811
  for (const o of e) {
3765
- const n = `id=${o.id}`, i = o.dueDate ? `; due=${o.dueDate}` : "", a = `; content=${o.content}`;
3766
- r.push(`${t}- ${n}${i}${a}`), o.children.length > 0 && r.push(...Ue(o.children, `${t} `));
3812
+ const n = `id=${o.id}`, a = o.dueDate ? `; due=${o.dueDate}` : "", i = `; content=${o.content}`;
3813
+ r.push(`${t}- ${n}${a}${i}`), o.children.length > 0 && r.push(...Re(o.children, `${t} `));
3767
3814
  }
3768
3815
  return r;
3769
3816
  }
3770
- function Ut(e, t) {
3817
+ function Rt(e, t) {
3771
3818
  return {
3772
3819
  id: e.id,
3773
3820
  name: e.name,
@@ -3775,35 +3822,35 @@ function Ut(e, t) {
3775
3822
  folderId: Pe(e) ? e.folderId ?? void 0 : void 0,
3776
3823
  childOrder: e.childOrder,
3777
3824
  sections: t[e.id] || [],
3778
- children: e.children.map((r) => Ut(r, t))
3825
+ children: e.children.map((r) => Rt(r, t))
3779
3826
  };
3780
3827
  }
3781
- async function an(e, t) {
3828
+ async function bn(e, t) {
3782
3829
  let r = [], o;
3783
3830
  do {
3784
- const { results: n, nextCursor: i } = await e.getTasks({
3831
+ const { results: n, nextCursor: a } = await e.getTasks({
3785
3832
  projectId: t,
3786
3833
  limit: C.TASKS_BATCH_SIZE,
3787
3834
  cursor: o ?? void 0
3788
3835
  });
3789
- r = r.concat(n.map(U)), o = i ?? void 0;
3836
+ r = r.concat(n.map(R)), o = a ?? void 0;
3790
3837
  } while (o);
3791
3838
  return r;
3792
3839
  }
3793
- async function cn(e, t) {
3840
+ async function gn(e, t) {
3794
3841
  const { results: r } = await e.getSections({ projectId: t });
3795
3842
  return r;
3796
3843
  }
3797
- async function dn(e) {
3798
- const { results: t } = await e.getProjects({}), r = t.find((p) => re(p) && p.inboxProject === !0), o = t.filter((p) => !re(p) || p.inboxProject !== !0), n = on(o), i = t.map((p) => p.id), a = await nn(e, i), c = ["# Personal Projects", ""];
3844
+ async function yn(e) {
3845
+ const { results: t } = await e.getProjects({}), r = t.find((p) => re(p) && p.inboxProject === !0), o = t.filter((p) => !re(p) || p.inboxProject !== !0), n = hn(o), a = t.map((p) => p.id), i = await fn(e, a), c = ["# Personal Projects", ""];
3799
3846
  if (r) {
3800
3847
  c.push(`- Inbox Project: ${r.name} (id=${r.id})`);
3801
- for (const p of a[r.id] || [])
3848
+ for (const p of i[r.id] || [])
3802
3849
  c.push(` - Section: ${p.name} (id=${p.id})`);
3803
3850
  }
3804
3851
  if (n.length)
3805
3852
  for (const p of n)
3806
- c.push(...Pt(p, a));
3853
+ c.push(...Pt(p, i));
3807
3854
  else
3808
3855
  c.push("_No projects found._");
3809
3856
  c.push("");
@@ -3818,44 +3865,44 @@ async function dn(e) {
3818
3865
  inbox: r ? {
3819
3866
  id: r.id,
3820
3867
  name: r.name,
3821
- sections: a[r.id] || []
3868
+ sections: i[r.id] || []
3822
3869
  } : null,
3823
3870
  projects: n.map(
3824
- (p) => Ut(p, a)
3871
+ (p) => Rt(p, i)
3825
3872
  ),
3826
3873
  totalProjects: t.length,
3827
- totalSections: i.reduce(
3828
- (p, m) => p + (a[m]?.length || 0),
3874
+ totalSections: a.reduce(
3875
+ (p, m) => p + (i[m]?.length || 0),
3829
3876
  0
3830
3877
  ),
3831
3878
  hasNestedProjects: d
3832
3879
  };
3833
3880
  return { textContent: l, structuredContent: u };
3834
3881
  }
3835
- async function ln(e, t) {
3882
+ async function kn(e, t) {
3836
3883
  const [r, o, n] = await Promise.all([
3837
3884
  e.getProject(t),
3838
- cn(e, t),
3839
- an(e, t)
3840
- ]), i = {};
3885
+ gn(e, t),
3886
+ bn(e, t)
3887
+ ]), a = {};
3841
3888
  for (const u of o)
3842
- i[u.id] = [];
3843
- const a = [];
3889
+ a[u.id] = [];
3890
+ const i = [];
3844
3891
  for (const u of n)
3845
- (u.sectionId ? i[u.sectionId] ?? a : a).push(u);
3892
+ (u.sectionId ? a[u.sectionId] ?? i : i).push(u);
3846
3893
  const c = [`# ${r.name}`];
3847
- if (a.length > 0) {
3894
+ if (i.length > 0) {
3848
3895
  c.push("");
3849
- const u = it(a);
3850
- c.push(...Ue(u));
3896
+ const u = at(i);
3897
+ c.push(...Re(u));
3851
3898
  }
3852
3899
  for (const u of o) {
3853
3900
  c.push(""), c.push(`## ${u.name}`);
3854
- const p = i[u.id];
3901
+ const p = a[u.id];
3855
3902
  if (!p?.length)
3856
3903
  continue;
3857
- const m = it(p);
3858
- c.push(...Ue(m));
3904
+ const m = at(p);
3905
+ c.push(...Re(m));
3859
3906
  }
3860
3907
  const d = c.join(`
3861
3908
  `), l = {
@@ -3873,38 +3920,38 @@ async function ln(e, t) {
3873
3920
  stats: {
3874
3921
  totalTasks: n.length,
3875
3922
  totalSections: o.length,
3876
- tasksWithoutSection: a.length
3923
+ tasksWithoutSection: i.length
3877
3924
  }
3878
3925
  };
3879
3926
  return { textContent: d, structuredContent: l };
3880
3927
  }
3881
- const un = {
3928
+ const Tn = {
3882
3929
  name: f.GET_OVERVIEW,
3883
3930
  description: "Get a Markdown overview. If no projectId is provided, shows all projects with hierarchy and sections (useful for navigation). If projectId is provided, shows detailed overview of that specific project including all tasks grouped by sections.",
3884
- parameters: sn,
3885
- outputSchema: rn,
3931
+ parameters: pn,
3932
+ outputSchema: mn,
3886
3933
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3887
3934
  async execute(e, t) {
3888
- const r = e.projectId ? await ln(t, e.projectId) : await dn(t);
3935
+ const r = e.projectId ? await kn(t, e.projectId) : await yn(t);
3889
3936
  return {
3890
3937
  textContent: r.textContent,
3891
3938
  structuredContent: r.structuredContent
3892
3939
  };
3893
3940
  }
3894
- }, pn = {}, ee = s.object({
3941
+ }, wn = {}, ee = s.object({
3895
3942
  count: s.number().describe("Number of consecutive periods in this streak."),
3896
3943
  start: s.string().describe("Start date of the streak."),
3897
3944
  end: s.string().describe("End date of the streak.")
3898
- }), at = s.object({
3945
+ }), it = s.object({
3899
3946
  id: s.string().describe("Project ID."),
3900
3947
  completed: s.number().describe("Number of tasks completed in this project.")
3901
- }), mn = {
3948
+ }), In = {
3902
3949
  completedCount: s.number().describe("Total number of completed tasks (all-time)."),
3903
3950
  daysItems: s.array(
3904
3951
  s.object({
3905
3952
  date: s.string().describe("Date string (YYYY-MM-DD)."),
3906
3953
  totalCompleted: s.number().describe("Total tasks completed on this day."),
3907
- items: s.array(at).describe("Per-project completion breakdown for this day.")
3954
+ items: s.array(it).describe("Per-project completion breakdown for this day.")
3908
3955
  })
3909
3956
  ).describe("Daily completion breakdown (most recent days)."),
3910
3957
  weekItems: s.array(
@@ -3912,7 +3959,7 @@ const un = {
3912
3959
  from: s.string().describe("Start date of the week."),
3913
3960
  to: s.string().describe("End date of the week."),
3914
3961
  totalCompleted: s.number().describe("Total tasks completed in this week."),
3915
- items: s.array(at).describe("Per-project completion breakdown for this week.")
3962
+ items: s.array(it).describe("Per-project completion breakdown for this week.")
3916
3963
  })
3917
3964
  ).describe("Weekly completion breakdown (most recent weeks)."),
3918
3965
  goals: s.object({
@@ -3947,11 +3994,11 @@ const un = {
3947
3994
  })
3948
3995
  ).describe("Recent karma change events with reasons."),
3949
3996
  projectColors: s.record(s.string(), s.string()).describe("Map of project ID to color key.")
3950
- }, hn = {
3997
+ }, vn = {
3951
3998
  name: f.GET_PRODUCTIVITY_STATS,
3952
3999
  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.",
3953
- parameters: pn,
3954
- outputSchema: mn,
4000
+ parameters: wn,
4001
+ outputSchema: In,
3955
4002
  annotations: {
3956
4003
  readOnlyHint: !0,
3957
4004
  destructiveHint: !1,
@@ -3960,7 +4007,7 @@ const un = {
3960
4007
  async execute(e, t) {
3961
4008
  const r = await t.getProductivityStats();
3962
4009
  return {
3963
- textContent: fn(r),
4010
+ textContent: jn(r),
3964
4011
  structuredContent: {
3965
4012
  completedCount: r.completedCount,
3966
4013
  daysItems: r.daysItems,
@@ -3987,7 +4034,7 @@ const un = {
3987
4034
  };
3988
4035
  }
3989
4036
  };
3990
- function fn(e) {
4037
+ function jn(e) {
3991
4038
  const t = [
3992
4039
  "# Productivity Statistics",
3993
4040
  "",
@@ -4017,11 +4064,11 @@ function fn(e) {
4017
4064
  return t.join(`
4018
4065
  `);
4019
4066
  }
4020
- const bn = {
4067
+ const Sn = {
4021
4068
  projectId: s.string().min(1).describe("The ID of the project to get activity stats for."),
4022
4069
  weeks: s.number().int().min(1).max(12).optional().describe("Number of weeks of activity data to retrieve (1-12, default 2)."),
4023
4070
  includeWeeklyCounts: s.boolean().optional().describe("Include weekly rollup counts alongside daily counts.")
4024
- }, gn = {
4071
+ }, Cn = {
4025
4072
  projectId: s.string().describe("The project ID."),
4026
4073
  dayItems: s.array(
4027
4074
  s.object({
@@ -4037,7 +4084,7 @@ const bn = {
4037
4084
  })
4038
4085
  ).nullable().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
4039
4086
  };
4040
- function yn(e, t) {
4087
+ function $n(e, t) {
4041
4088
  const r = [`# Activity Stats: Project ${e}`, ""];
4042
4089
  if (t.dayItems.length > 0) {
4043
4090
  r.push("## Daily Activity");
@@ -4053,39 +4100,39 @@ function yn(e, t) {
4053
4100
  return r.join(`
4054
4101
  `);
4055
4102
  }
4056
- const kn = {
4103
+ const Dn = {
4057
4104
  name: f.GET_PROJECT_ACTIVITY_STATS,
4058
4105
  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.",
4059
- parameters: bn,
4060
- outputSchema: gn,
4106
+ parameters: Sn,
4107
+ outputSchema: Cn,
4061
4108
  annotations: {
4062
4109
  readOnlyHint: !0,
4063
4110
  destructiveHint: !1,
4064
4111
  idempotentHint: !0
4065
4112
  },
4066
4113
  async execute(e, t) {
4067
- const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, i = await t.getProjectActivityStats(r, {
4114
+ const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, a = await t.getProjectActivityStats(r, {
4068
4115
  weeks: o,
4069
4116
  includeWeeklyCounts: n
4070
4117
  });
4071
4118
  return {
4072
- textContent: yn(r, i),
4119
+ textContent: $n(r, a),
4073
4120
  structuredContent: {
4074
4121
  projectId: r,
4075
- dayItems: i.dayItems,
4076
- weekItems: i.weekItems ?? null
4122
+ dayItems: a.dayItems,
4123
+ weekItems: a.weekItems ?? null
4077
4124
  }
4078
4125
  };
4079
4126
  }
4080
- }, Tn = {
4127
+ }, xn = {
4081
4128
  projectId: s.string().min(1).describe("The ID of the project to check health for."),
4082
4129
  includeContext: s.boolean().default(!1).describe(
4083
4130
  "Include detailed health context with project metrics and task-level data. May produce large output for projects with many tasks."
4084
4131
  )
4085
- }, wn = s.object({
4132
+ }, An = s.object({
4086
4133
  taskId: s.string().describe("The ID of the task this recommendation is for."),
4087
4134
  recommendation: s.string().describe("The recommendation for this task.")
4088
- }), In = s.object({
4135
+ }), En = s.object({
4089
4136
  id: s.string().describe("The task ID."),
4090
4137
  content: s.string().describe("The task content/title."),
4091
4138
  priority: s.string().describe("The task priority (1-4)."),
@@ -4093,7 +4140,7 @@ const kn = {
4093
4140
  deadline: s.string().nullable().optional().describe("The deadline date string, if set."),
4094
4141
  isCompleted: s.boolean().describe("Whether the task is completed."),
4095
4142
  labels: s.array(s.string()).describe("Labels applied to this task.")
4096
- }), vn = {
4143
+ }), On = {
4097
4144
  projectId: s.string().describe("The project ID."),
4098
4145
  projectName: s.string().describe("The project name."),
4099
4146
  progress: s.object({
@@ -4102,10 +4149,10 @@ const kn = {
4102
4149
  progressPercent: s.number().describe("Completion percentage (0-100).")
4103
4150
  }).describe("Project completion progress."),
4104
4151
  health: s.object({
4105
- status: s.enum(Re).describe("The overall health status of the project."),
4152
+ status: s.enum(Ue).describe("The overall health status of the project."),
4106
4153
  description: s.string().nullable().optional().describe("Detailed description of the health assessment."),
4107
4154
  descriptionSummary: s.string().nullable().optional().describe("Brief summary of the health assessment."),
4108
- taskRecommendations: s.array(wn).nullable().optional().describe("Specific recommendations for individual tasks."),
4155
+ taskRecommendations: s.array(An).nullable().optional().describe("Specific recommendations for individual tasks."),
4109
4156
  isStale: s.boolean().describe("Whether the health data is stale and may need refreshing."),
4110
4157
  updateInProgress: s.boolean().describe("Whether a health analysis update is currently in progress."),
4111
4158
  updatedAt: s.string().nullable().optional().describe("When the health assessment was last updated.")
@@ -4120,19 +4167,19 @@ const kn = {
4120
4167
  tasksCompletedThisWeek: s.number().describe("Tasks completed in the current week."),
4121
4168
  averageCompletionTime: s.number().nullable().describe("Average task completion time in days, if available.")
4122
4169
  }).describe("Aggregated project metrics."),
4123
- tasks: s.array(In).describe("Tasks in the project.")
4170
+ tasks: s.array(En).describe("Tasks in the project.")
4124
4171
  }).optional().describe(
4125
4172
  "Detailed project context with metrics and task data. Only included when includeContext is true."
4126
4173
  )
4127
4174
  };
4128
- async function jn(e, t, r) {
4175
+ async function Pn(e, t, r) {
4129
4176
  if (r) {
4130
- const [i, a, c] = await Promise.all([
4177
+ const [a, i, c] = await Promise.all([
4131
4178
  e.getProjectProgress(t),
4132
4179
  e.getProjectHealth(t),
4133
4180
  e.getProjectHealthContext(t)
4134
4181
  ]);
4135
- return { progress: i, health: a, context: c };
4182
+ return { progress: a, health: i, context: c };
4136
4183
  }
4137
4184
  const [o, n] = await Promise.all([
4138
4185
  e.getProjectProgress(t),
@@ -4140,41 +4187,41 @@ async function jn(e, t, r) {
4140
4187
  ]);
4141
4188
  return { progress: o, health: n };
4142
4189
  }
4143
- function Sn(e, { progress: t, health: r, context: o }) {
4190
+ function Rn(e, { progress: t, health: r, context: o }) {
4144
4191
  const n = [`# Project Health: ${e}`, ""];
4145
4192
  if (n.push(`**Status:** ${r.status}`), r.isStale && n.push("**Note:** Health data is stale and may not reflect recent changes."), r.updateInProgress && n.push("**Note:** A health analysis update is currently in progress."), r.updatedAt && n.push(`**Last Updated:** ${r.updatedAt}`), n.push(""), n.push("## Progress"), n.push(
4146
4193
  `**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`
4147
4194
  ), r.description && (n.push(""), n.push("## Health Description"), n.push(r.description)), r.taskRecommendations && r.taskRecommendations.length > 0) {
4148
4195
  n.push(""), n.push("## Task Recommendations");
4149
- for (const i of r.taskRecommendations)
4150
- n.push(`- **Task ${i.taskId}**: ${i.recommendation}`);
4196
+ for (const a of r.taskRecommendations)
4197
+ n.push(`- **Task ${a.taskId}**: ${a.recommendation}`);
4151
4198
  }
4152
4199
  if (o) {
4153
4200
  n.push(""), n.push("## Project Metrics");
4154
- const i = o.projectMetrics;
4155
- if (n.push(`- **Total Tasks:** ${i.totalTasks}`), n.push(`- **Completed:** ${i.completedTasks}`), n.push(`- **Overdue:** ${i.overdueTasks}`), n.push(`- **Created This Week:** ${i.tasksCreatedThisWeek}`), n.push(`- **Completed This Week:** ${i.tasksCompletedThisWeek}`), i.averageCompletionTime !== null && n.push(`- **Avg Completion Time:** ${i.averageCompletionTime} days`), o.tasks.length > 0) {
4201
+ const a = o.projectMetrics;
4202
+ if (n.push(`- **Total Tasks:** ${a.totalTasks}`), n.push(`- **Completed:** ${a.completedTasks}`), n.push(`- **Overdue:** ${a.overdueTasks}`), n.push(`- **Created This Week:** ${a.tasksCreatedThisWeek}`), n.push(`- **Completed This Week:** ${a.tasksCompletedThisWeek}`), a.averageCompletionTime !== null && n.push(`- **Avg Completion Time:** ${a.averageCompletionTime} days`), o.tasks.length > 0) {
4156
4203
  n.push(""), n.push(`## Tasks (${o.tasks.length})`);
4157
- for (const a of o.tasks) {
4158
- const c = [`id=${a.id}`, a.content];
4159
- a.due && c.push(`due=${a.due}`), a.deadline && c.push(`deadline=${a.deadline}`), a.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4204
+ for (const i of o.tasks) {
4205
+ const c = [`id=${i.id}`, i.content];
4206
+ i.due && c.push(`due=${i.due}`), i.deadline && c.push(`deadline=${i.deadline}`), i.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4160
4207
  }
4161
4208
  }
4162
4209
  }
4163
4210
  return n.join(`
4164
4211
  `);
4165
4212
  }
4166
- const Cn = {
4213
+ const Un = {
4167
4214
  name: f.GET_PROJECT_HEALTH,
4168
4215
  description: "Get a comprehensive health assessment for a project including completion progress, health status (EXCELLENT, ON_TRACK, AT_RISK, CRITICAL), and optional detailed context with project metrics and task-level recommendations. Use includeContext=true for full detail including task data.",
4169
- parameters: Tn,
4170
- outputSchema: vn,
4216
+ parameters: xn,
4217
+ outputSchema: On,
4171
4218
  annotations: {
4172
4219
  readOnlyHint: !0,
4173
4220
  destructiveHint: !1,
4174
4221
  idempotentHint: !0
4175
4222
  },
4176
4223
  async execute(e, t) {
4177
- const { projectId: r, includeContext: o } = e, n = await jn(t, r, o), i = n.context?.projectName ?? `Project ${r}`, a = Sn(i, n), c = n.context ? {
4224
+ const { projectId: r, includeContext: o } = e, n = await Pn(t, r, o), a = n.context?.projectName ?? `Project ${r}`, i = Rn(a, n), c = n.context ? {
4178
4225
  projectDescription: n.context.projectDescription,
4179
4226
  projectMetrics: n.context.projectMetrics,
4180
4227
  tasks: n.context.tasks.map((d) => ({
@@ -4188,10 +4235,10 @@ const Cn = {
4188
4235
  }))
4189
4236
  } : void 0;
4190
4237
  return {
4191
- textContent: a,
4238
+ textContent: i,
4192
4239
  structuredContent: {
4193
4240
  projectId: r,
4194
- projectName: i,
4241
+ projectName: a,
4195
4242
  progress: {
4196
4243
  completedCount: n.progress.completedCount,
4197
4244
  activeCount: n.progress.activeCount,
@@ -4210,15 +4257,15 @@ const Cn = {
4210
4257
  }
4211
4258
  };
4212
4259
  }
4213
- }, $n = {
4260
+ }, _n = {
4214
4261
  workspaceIdOrName: s.string().min(1).describe(
4215
4262
  "The workspace ID or name. Supports exact ID, exact name match (case-insensitive), or unique partial name match."
4216
4263
  ),
4217
4264
  projectIds: s.array(s.string().min(1)).min(1).optional().describe("Optional list of project IDs to scope insights to specific projects.")
4218
- }, Dn = s.object({
4265
+ }, Nn = s.object({
4219
4266
  projectId: s.string().describe("The project ID."),
4220
4267
  health: s.object({
4221
- status: s.enum(Re).describe("The health status of the project."),
4268
+ status: s.enum(Ue).describe("The health status of the project."),
4222
4269
  isStale: s.boolean().describe("Whether the health data is stale."),
4223
4270
  updateInProgress: s.boolean().describe("Whether a health analysis update is in progress.")
4224
4271
  }).nullable().describe("Health data for this project, if available."),
@@ -4227,23 +4274,23 @@ const Cn = {
4227
4274
  activeCount: s.number().describe("Number of active tasks."),
4228
4275
  progressPercent: s.number().describe("Completion percentage (0-100).")
4229
4276
  }).nullable().describe("Progress data for this project, if available.")
4230
- }), xn = {
4277
+ }), Ln = {
4231
4278
  workspaceId: s.string().describe("The resolved workspace ID."),
4232
4279
  workspaceName: s.string().describe("The resolved workspace name."),
4233
4280
  folderId: s.string().nullable().describe("The folder ID, if applicable."),
4234
- projectInsights: s.array(Dn).describe("Health and progress insights for each project in the workspace.")
4235
- }, An = {
4281
+ projectInsights: s.array(Nn).describe("Health and progress insights for each project in the workspace.")
4282
+ }, Mn = {
4236
4283
  name: f.GET_WORKSPACE_INSIGHTS,
4237
4284
  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.",
4238
- parameters: $n,
4239
- outputSchema: xn,
4285
+ parameters: _n,
4286
+ outputSchema: Ln,
4240
4287
  annotations: {
4241
4288
  readOnlyHint: !0,
4242
4289
  destructiveHint: !1,
4243
4290
  idempotentHint: !0
4244
4291
  },
4245
4292
  async execute(e, t) {
4246
- const { workspaceIdOrName: r, projectIds: o } = e, n = await It.resolveWorkspace(t, r), i = await t.getWorkspaceInsights(n.workspaceId, { projectIds: o }), a = i.projectInsights.map((d) => ({
4293
+ const { workspaceIdOrName: r, projectIds: o } = e, n = await It.resolveWorkspace(t, r), a = await t.getWorkspaceInsights(n.workspaceId, { projectIds: o }), i = a.projectInsights.map((d) => ({
4247
4294
  projectId: d.projectId,
4248
4295
  health: d.health ? {
4249
4296
  status: d.health.status,
@@ -4258,10 +4305,10 @@ const Cn = {
4258
4305
  })), c = [
4259
4306
  `# Workspace Insights: ${n.workspaceName}`,
4260
4307
  "",
4261
- `**Projects:** ${a.length}`,
4308
+ `**Projects:** ${i.length}`,
4262
4309
  ""
4263
4310
  ];
4264
- for (const d of a) {
4311
+ for (const d of i) {
4265
4312
  const l = d.health?.status ?? "N/A", u = d.progress ? `${d.progress.progressPercent}%` : "N/A";
4266
4313
  c.push(`- Project ${d.projectId}: status=${l}, progress=${u}`);
4267
4314
  }
@@ -4271,12 +4318,12 @@ const Cn = {
4271
4318
  structuredContent: {
4272
4319
  workspaceId: n.workspaceId,
4273
4320
  workspaceName: n.workspaceName,
4274
- folderId: i.folderId,
4275
- projectInsights: a
4321
+ folderId: a.folderId,
4322
+ projectInsights: i
4276
4323
  }
4277
4324
  };
4278
4325
  }
4279
- }, En = {}, On = {
4326
+ }, Fn = {}, Hn = {
4280
4327
  id: s.string().describe("The unique identifier for the workspace."),
4281
4328
  name: s.string().describe("The name of the workspace."),
4282
4329
  plan: s.enum(Ft).describe("The workspace plan type."),
@@ -4285,21 +4332,21 @@ const Cn = {
4285
4332
  isGuestAllowed: s.boolean().describe("Whether guests are allowed in the workspace."),
4286
4333
  createdAt: s.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
4287
4334
  creatorId: s.string().describe("The ID of the user who created the workspace.")
4288
- }, Pn = {
4335
+ }, Wn = {
4289
4336
  type: s.literal("workspaces").describe("The type of the response."),
4290
- workspaces: s.array(s.object(On)).describe("List of workspaces."),
4337
+ workspaces: s.array(s.object(Hn)).describe("List of workspaces."),
4291
4338
  count: s.number().describe("The total number of workspaces.")
4292
4339
  };
4293
- async function Un(e) {
4294
- const r = (await e.getWorkspaces()).map((a) => ({
4295
- id: a.id,
4296
- name: a.name,
4297
- plan: a.plan,
4298
- role: a.role,
4299
- isLinkSharingEnabled: a.isLinkSharingEnabled,
4300
- isGuestAllowed: a.isGuestAllowed,
4301
- createdAt: a.createdAt,
4302
- creatorId: a.creatorId
4340
+ async function Bn(e) {
4341
+ const r = (await e.getWorkspaces()).map((i) => ({
4342
+ id: i.id,
4343
+ name: i.name,
4344
+ plan: i.plan,
4345
+ role: i.role,
4346
+ isLinkSharingEnabled: i.isLinkSharingEnabled,
4347
+ isGuestAllowed: i.isGuestAllowed,
4348
+ createdAt: i.createdAt,
4349
+ creatorId: i.creatorId
4303
4350
  })), o = ["# Workspaces", ""];
4304
4351
  if (r.length === 0)
4305
4352
  o.push("No workspaces found.");
@@ -4308,35 +4355,35 @@ async function Un(e) {
4308
4355
  `Found ${r.length} workspace${r.length === 1 ? "" : "s"}:`,
4309
4356
  ""
4310
4357
  );
4311
- for (const a of r)
4312
- o.push(`## ${a.name}`), o.push(`- **ID:** ${a.id}`), o.push(`- **Plan:** ${a.plan}`), a.role && o.push(`- **Your Role:** ${a.role}`), o.push(
4313
- `- **Link Sharing:** ${a.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
4314
- ), o.push(`- **Guests Allowed:** ${a.isGuestAllowed ? "Yes" : "No"}`), a.createdAt && o.push(`- **Created:** ${a.createdAt}`), o.push(`- **Creator ID:** ${a.creatorId}`), o.push("");
4358
+ for (const i of r)
4359
+ o.push(`## ${i.name}`), o.push(`- **ID:** ${i.id}`), o.push(`- **Plan:** ${i.plan}`), i.role && o.push(`- **Your Role:** ${i.role}`), o.push(
4360
+ `- **Link Sharing:** ${i.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
4361
+ ), o.push(`- **Guests Allowed:** ${i.isGuestAllowed ? "Yes" : "No"}`), i.createdAt && o.push(`- **Created:** ${i.createdAt}`), o.push(`- **Creator ID:** ${i.creatorId}`), o.push("");
4315
4362
  }
4316
4363
  const n = o.join(`
4317
- `), i = {
4364
+ `), a = {
4318
4365
  type: "workspaces",
4319
4366
  workspaces: r,
4320
4367
  count: r.length
4321
4368
  };
4322
- return { textContent: n, structuredContent: i };
4369
+ return { textContent: n, structuredContent: a };
4323
4370
  }
4324
- const Rn = {
4371
+ const zn = {
4325
4372
  name: f.LIST_WORKSPACES,
4326
4373
  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.",
4327
- parameters: En,
4328
- outputSchema: Pn,
4374
+ parameters: Fn,
4375
+ outputSchema: Wn,
4329
4376
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4330
4377
  async execute(e, t) {
4331
- const r = await Un(t);
4378
+ const r = await Bn(t);
4332
4379
  return {
4333
4380
  textContent: r.textContent,
4334
4381
  structuredContent: r.structuredContent
4335
4382
  };
4336
4383
  }
4337
- }, { FIND_TASKS: _n, FIND_PROJECT_COLLABORATORS: ct, UPDATE_TASKS: Nn } = f, Ln = 50, Mn = {
4384
+ }, { FIND_TASKS: Yn, FIND_PROJECT_COLLABORATORS: ct, UPDATE_TASKS: Gn } = f, qn = 50, Kn = {
4338
4385
  operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
4339
- taskIds: s.array(s.string()).min(1).max(Ln).describe("The IDs of the tasks to operate on (max 50)."),
4386
+ taskIds: s.array(s.string()).min(1).max(qn).describe("The IDs of the tasks to operate on (max 50)."),
4340
4387
  responsibleUser: s.string().optional().describe(
4341
4388
  'The user to assign tasks to. Can be "me" (assigns to current user), a user ID, name, or email. Required for assign and reassign operations.'
4342
4389
  ),
@@ -4344,7 +4391,7 @@ const Rn = {
4344
4391
  "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."
4345
4392
  ),
4346
4393
  dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
4347
- }, Fn = {
4394
+ }, Vn = {
4348
4395
  results: s.array(
4349
4396
  s.object({
4350
4397
  taskId: s.string().describe("The ID of the task."),
@@ -4360,14 +4407,14 @@ const Rn = {
4360
4407
  failed: s.number().describe("Number of failed operations."),
4361
4408
  dryRun: s.boolean().describe("Whether this was a dry run.")
4362
4409
  }).optional().describe("Summary of the operation.")
4363
- }, Hn = {
4410
+ }, Jn = {
4364
4411
  name: f.MANAGE_ASSIGNMENTS,
4365
4412
  description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
4366
- parameters: Mn,
4367
- outputSchema: Fn,
4413
+ parameters: Kn,
4414
+ outputSchema: Vn,
4368
4415
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4369
4416
  async execute(e, t) {
4370
- const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: i, dryRun: a } = e;
4417
+ const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: a, dryRun: i } = e;
4371
4418
  if ((r === "assign" || r === "reassign") && !n)
4372
4419
  throw new Error(`${r} operation requires responsibleUser parameter`);
4373
4420
  const c = await Promise.allSettled(
@@ -4396,7 +4443,7 @@ const Rn = {
4396
4443
  throw new Error(`All ${l.length} task(s) failed: ${T}`);
4397
4444
  }
4398
4445
  let u;
4399
- r === "reassign" && i && (u = (await B.resolveUser(t, i))?.userId || i);
4446
+ r === "reassign" && a && (u = (await B.resolveUser(t, a))?.userId || a);
4400
4447
  const p = [];
4401
4448
  for (const T of d)
4402
4449
  r === "reassign" && u && T.responsibleUid !== u || p.push({
@@ -4406,7 +4453,7 @@ const Rn = {
4406
4453
  // Will be validated appropriately
4407
4454
  });
4408
4455
  if (r === "unassign") {
4409
- if (a) {
4456
+ if (i) {
4410
4457
  const w = d.map((v) => ({
4411
4458
  taskId: v.id,
4412
4459
  success: !0,
@@ -4496,7 +4543,7 @@ const Rn = {
4496
4543
  newAssigneeId: j.resolvedUser.userId
4497
4544
  };
4498
4545
  });
4499
- const R = S.map(
4546
+ const U = S.map(
4500
4547
  async ({ assignment: w, validation: j }) => {
4501
4548
  const v = d.find((x) => x.id === w.taskId);
4502
4549
  if (!w.taskId || !j.resolvedUser?.userId)
@@ -4525,9 +4572,9 @@ const Rn = {
4525
4572
  }
4526
4573
  }
4527
4574
  );
4528
- return Promise.all(R);
4575
+ return Promise.all(U);
4529
4576
  }
4530
- const D = await I(h, !a), $ = [...D, ...g, ...l];
4577
+ const D = await I(h, !i), $ = [...D, ...g, ...l];
4531
4578
  if ($.length > 0 && $.every((T) => !T.success)) {
4532
4579
  const T = $.map((b) => `"${b.taskId}": ${b.error}`).join("; ");
4533
4580
  throw new Error(`All ${$.length} ${r} operation(s) failed: ${T}`);
@@ -4536,7 +4583,7 @@ const Rn = {
4536
4583
  textContent: Ce({
4537
4584
  operation: r,
4538
4585
  results: $,
4539
- dryRun: a
4586
+ dryRun: i
4540
4587
  }),
4541
4588
  structuredContent: {
4542
4589
  operation: r,
@@ -4544,7 +4591,7 @@ const Rn = {
4544
4591
  totalRequested: o.length,
4545
4592
  successful: D.filter((T) => T.success).length,
4546
4593
  failed: $.filter((T) => !T.success).length,
4547
- dryRun: a
4594
+ dryRun: i
4548
4595
  }
4549
4596
  };
4550
4597
  }
@@ -4554,7 +4601,7 @@ function Ce({
4554
4601
  results: t,
4555
4602
  dryRun: r
4556
4603
  }) {
4557
- const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), i = r ? "would be" : "were", a = {
4604
+ const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), a = r ? "would be" : "were", i = {
4558
4605
  assign: "assigned",
4559
4606
  unassign: "unassigned",
4560
4607
  reassign: "reassigned"
@@ -4563,7 +4610,7 @@ function Ce({
4563
4610
 
4564
4611
  `;
4565
4612
  if (o.length > 0) {
4566
- c += `**${o.length} task${o.length === 1 ? "" : "s"} ${i} successfully ${a}**
4613
+ c += `**${o.length} task${o.length === 1 ? "" : "s"} ${a} successfully ${i}**
4567
4614
  `;
4568
4615
  const d = o.slice(0, 5);
4569
4616
  for (const l of d) {
@@ -4587,8 +4634,8 @@ function Ce({
4587
4634
  `;
4588
4635
  }
4589
4636
  return !r && o.length > 0 ? (c += `**Next steps:**
4590
- `, c += `• Use ${_n} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
4591
- `, c += `• Use ${Nn} for individual assignment changes
4637
+ `, c += `• Use ${Yn} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
4638
+ `, c += `• Use ${Gn} for individual assignment changes
4592
4639
  `, n.length > 0 && (c += `• Check failed tasks and use ${ct} to verify collaborator access
4593
4640
  `)) : r ? (c += `**To execute:**
4594
4641
  `, c += `• Remove dryRun parameter and run again to execute changes
@@ -4600,17 +4647,17 @@ function Ce({
4600
4647
  `, c += `• Use dryRun=true to validate before executing
4601
4648
  `), c;
4602
4649
  }
4603
- const Wn = {
4650
+ const Xn = {
4604
4651
  action: s.enum(["archive", "unarchive"]).describe("The action to perform on the project."),
4605
4652
  projectId: s.string().min(1).describe("The ID of the project.")
4606
- }, Bn = {
4607
- project: ie.describe("The updated project."),
4653
+ }, Zn = {
4654
+ project: ae.describe("The updated project."),
4608
4655
  success: s.boolean().describe("Whether the action was successful.")
4609
- }, zn = {
4656
+ }, Qn = {
4610
4657
  name: f.PROJECT_MANAGEMENT,
4611
4658
  description: "Archive or unarchive a project by its ID.",
4612
- parameters: Wn,
4613
- outputSchema: Bn,
4659
+ parameters: Xn,
4660
+ outputSchema: Zn,
4614
4661
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
4615
4662
  async execute(e, t) {
4616
4663
  const r = e.action === "archive" ? await t.archiveProject(e.projectId) : await t.unarchiveProject(e.projectId), o = q(r);
@@ -4622,7 +4669,7 @@ const Wn = {
4622
4669
  }
4623
4670
  };
4624
4671
  }
4625
- }, Yn = {
4672
+ }, ea = {
4626
4673
  action: s.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
4627
4674
  projectId: s.string().min(1).describe("The ID of the project to move."),
4628
4675
  workspaceId: s.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
@@ -4630,25 +4677,25 @@ const Wn = {
4630
4677
  visibility: s.enum(["restricted", "team", "public"]).optional().describe(
4631
4678
  "Optional access visibility for the project in the workspace (restricted, team, or public)."
4632
4679
  )
4633
- }, Gn = {
4634
- project: ie.describe("The moved project."),
4680
+ }, ta = {
4681
+ project: ae.describe("The moved project."),
4635
4682
  success: s.boolean().describe("Whether the move was successful.")
4636
- }, qn = {
4683
+ }, sa = {
4637
4684
  name: f.PROJECT_MOVE,
4638
4685
  description: "Move a project between personal and workspace contexts.",
4639
- parameters: Yn,
4640
- outputSchema: Gn,
4686
+ parameters: ea,
4687
+ outputSchema: ta,
4641
4688
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
4642
4689
  async execute(e, t) {
4643
4690
  let r;
4644
4691
  if (e.action === "move-to-workspace") {
4645
4692
  if (!e.workspaceId)
4646
4693
  throw new Error("workspaceId is required when action is move-to-workspace");
4647
- const i = {
4694
+ const a = {
4648
4695
  projectId: e.projectId,
4649
4696
  workspaceId: e.workspaceId
4650
4697
  };
4651
- e.folderId && (i.folderId = e.folderId), e.visibility && (i.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(i);
4698
+ e.folderId && (a.folderId = e.folderId), e.visibility && (a.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(a);
4652
4699
  } else
4653
4700
  r = await t.moveProjectToPersonal({ projectId: e.projectId });
4654
4701
  const o = q(r);
@@ -4660,8 +4707,8 @@ const Wn = {
4660
4707
  }
4661
4708
  };
4662
4709
  }
4663
- }, Rt = ["project", "section"], Kn = {
4664
- type: s.enum(Rt).describe(
4710
+ }, Ut = ["project", "section"], ra = {
4711
+ type: s.enum(Ut).describe(
4665
4712
  'The type of entity to reorder. "project" reorders sibling projects within the same parent (and can move projects to a new parent). "section" reorders sections within the same project.'
4666
4713
  ),
4667
4714
  items: s.array(
@@ -4677,17 +4724,17 @@ const Wn = {
4677
4724
  ).min(1).describe(
4678
4725
  "The items to reorder or move. Each item must have at least order or parentId. Items with parentId will be moved first, then items with order will be reordered. All items being reordered should be siblings for predictable results."
4679
4726
  )
4680
- }, Vn = {
4681
- type: s.enum(Rt).describe("The type of entity that was reordered/moved."),
4727
+ }, oa = {
4728
+ type: s.enum(Ut).describe("The type of entity that was reordered/moved."),
4682
4729
  movedCount: s.number().describe("The number of entities moved to a new parent."),
4683
4730
  reorderedCount: s.number().describe("The number of entities reordered."),
4684
4731
  affectedIds: s.array(s.string()).describe("The IDs of all affected entities."),
4685
4732
  success: s.boolean().describe("Whether the operation was successful.")
4686
- }, Jn = {
4733
+ }, na = {
4687
4734
  name: f.REORDER_OBJECTS,
4688
4735
  description: 'Reorder sibling projects or sections, and optionally move projects to a new parent. For projects: set order to reorder siblings, and/or set parentId to move under a new parent (use "root" for top level). For sections: set order to reorder within a project.',
4689
- parameters: Kn,
4690
- outputSchema: Vn,
4736
+ parameters: ra,
4737
+ outputSchema: oa,
4691
4738
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
4692
4739
  async execute(e, t) {
4693
4740
  const { type: r, items: o } = e, n = /* @__PURE__ */ new Set();
@@ -4703,10 +4750,10 @@ const Wn = {
4703
4750
  `parentId is only supported when type is "project", but type is "${r}".`
4704
4751
  );
4705
4752
  }
4706
- const i = [], a = o.filter((p) => p.parentId !== void 0);
4707
- for (const p of a) {
4753
+ const a = [], i = o.filter((p) => p.parentId !== void 0);
4754
+ for (const p of i) {
4708
4755
  const m = p.parentId;
4709
- i.push(
4756
+ a.push(
4710
4757
  z("project_move", {
4711
4758
  id: p.id,
4712
4759
  parentId: m === "root" ? null : m
@@ -4716,14 +4763,14 @@ const Wn = {
4716
4763
  const c = o.filter(
4717
4764
  (p) => p.order !== void 0
4718
4765
  );
4719
- c.length > 0 && (r === "project" ? i.push(
4766
+ c.length > 0 && (r === "project" ? a.push(
4720
4767
  z("project_reorder", {
4721
4768
  projects: c.map((p) => ({
4722
4769
  id: p.id,
4723
4770
  childOrder: p.order
4724
4771
  }))
4725
4772
  })
4726
- ) : i.push(
4773
+ ) : a.push(
4727
4774
  z("section_reorder", {
4728
4775
  sections: c.map((p) => ({
4729
4776
  id: p.id,
@@ -4732,39 +4779,39 @@ const Wn = {
4732
4779
  })
4733
4780
  ));
4734
4781
  try {
4735
- await t.sync({ commands: i });
4782
+ await t.sync({ commands: a });
4736
4783
  } catch (p) {
4737
4784
  const m = p instanceof Error ? p.message : String(p);
4738
4785
  throw new Error(`Reorder failed: ${m}`);
4739
4786
  }
4740
4787
  const d = r === "project" ? "projects" : "sections", l = o.map((p) => p.id), u = [];
4741
- return a.length > 0 && u.push(`moved ${a.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
4788
+ return i.length > 0 && u.push(`moved ${i.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
4742
4789
  textContent: `${u.join(" and ")} ${d}: ${l.map((p) => `id=${p}`).join(", ")}`,
4743
4790
  structuredContent: {
4744
4791
  type: r,
4745
- movedCount: a.length,
4792
+ movedCount: i.length,
4746
4793
  reorderedCount: c.length,
4747
4794
  affectedIds: l,
4748
4795
  success: !0
4749
4796
  }
4750
4797
  };
4751
4798
  }
4752
- }, Xn = s.object({
4799
+ }, aa = s.object({
4753
4800
  id: s.string().min(1).describe("The ID of the task to reschedule."),
4754
4801
  date: s.string().min(1).describe(
4755
4802
  "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."
4756
4803
  )
4757
- }), Zn = {
4758
- tasks: s.array(Xn).min(1).describe("The tasks to reschedule with their new dates.")
4759
- }, Qn = {
4804
+ }), ia = {
4805
+ tasks: s.array(aa).min(1).describe("The tasks to reschedule with their new dates.")
4806
+ }, ca = {
4760
4807
  tasks: s.array(K).describe("The rescheduled tasks."),
4761
4808
  totalCount: s.number().describe("The total number of tasks rescheduled."),
4762
4809
  rescheduledTaskIds: s.array(s.string()).describe("The IDs of the rescheduled tasks.")
4763
- }, ei = {
4810
+ }, da = {
4764
4811
  name: f.RESCHEDULE_TASKS,
4765
4812
  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, keeping recurrence patterns intact. Use this when moving recurring tasks to a different date without altering their repeat pattern.",
4766
- parameters: Zn,
4767
- outputSchema: Qn,
4813
+ parameters: ia,
4814
+ outputSchema: ca,
4768
4815
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4769
4816
  async execute(e, t) {
4770
4817
  const { tasks: r } = e, n = (await Promise.all(
@@ -4777,7 +4824,7 @@ const Wn = {
4777
4824
  throw new Error(
4778
4825
  `Task "${l.content}" (${l.id}) has no due date. Rescheduling requires an existing due date.`
4779
4826
  );
4780
- const u = ti(d.date, l.due);
4827
+ const u = la(d.date, l.due);
4781
4828
  return z("item_update", {
4782
4829
  id: d.id,
4783
4830
  due: {
@@ -4795,29 +4842,29 @@ const Wn = {
4795
4842
  const l = d instanceof Error ? d.message : String(d);
4796
4843
  throw new Error(`Reschedule failed: ${l}`);
4797
4844
  }
4798
- const i = await Promise.all(r.map((d) => t.getTask(d.id))), a = i.map(U);
4845
+ const a = await Promise.all(r.map((d) => t.getTask(d.id))), i = a.map(R);
4799
4846
  return {
4800
- textContent: Ye("Rescheduled", a, {
4801
- showDetails: a.length <= 5
4847
+ textContent: Ye("Rescheduled", i, {
4848
+ showDetails: i.length <= 5
4802
4849
  }),
4803
4850
  structuredContent: {
4804
- tasks: a,
4805
- totalCount: a.length,
4806
- rescheduledTaskIds: i.map((d) => d.id)
4851
+ tasks: i,
4852
+ totalCount: i.length,
4853
+ rescheduledTaskIds: a.map((d) => d.id)
4807
4854
  }
4808
4855
  };
4809
4856
  }
4810
4857
  };
4811
- function ti(e, t) {
4858
+ function la(e, t) {
4812
4859
  if (/^\d{4}-\d{2}-\d{2}$/.test(e) && t.datetime) {
4813
4860
  const o = t.datetime.substring(10);
4814
4861
  return e + o;
4815
4862
  }
4816
4863
  return e;
4817
4864
  }
4818
- const si = {
4865
+ const ua = {
4819
4866
  query: s.string().min(1).describe("The search query string to find tasks and projects.")
4820
- }, ri = {
4867
+ }, pa = {
4821
4868
  results: s.array(
4822
4869
  s.object({
4823
4870
  id: s.string().describe("The ID of the result."),
@@ -4826,11 +4873,11 @@ const si = {
4826
4873
  })
4827
4874
  ).describe("The search results."),
4828
4875
  totalCount: s.number().describe("Total number of results found.")
4829
- }, oi = {
4876
+ }, ma = {
4830
4877
  name: f.SEARCH,
4831
4878
  description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
4832
- parameters: si,
4833
- outputSchema: ri,
4879
+ parameters: ua,
4880
+ outputSchema: pa,
4834
4881
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4835
4882
  async execute(e, t) {
4836
4883
  const { query: r } = e, [o, n] = await Promise.all([
@@ -4841,52 +4888,52 @@ const si = {
4841
4888
  cursor: void 0
4842
4889
  }),
4843
4890
  Tt(t, r)
4844
- ]), i = [];
4845
- for (const a of o.tasks)
4846
- i.push({
4847
- id: `task:${a.id}`,
4848
- title: a.content,
4849
- url: pt(a.id)
4891
+ ]), a = [];
4892
+ for (const i of o.tasks)
4893
+ a.push({
4894
+ id: `task:${i.id}`,
4895
+ title: i.content,
4896
+ url: pt(i.id)
4850
4897
  });
4851
- for (const a of n)
4852
- i.push({
4853
- id: `project:${a.id}`,
4854
- title: a.name,
4855
- url: mt(a.id)
4898
+ for (const i of n)
4899
+ a.push({
4900
+ id: `project:${i.id}`,
4901
+ title: i.name,
4902
+ url: mt(i.id)
4856
4903
  });
4857
4904
  return {
4858
- textContent: JSON.stringify({ results: i }),
4859
- structuredContent: { results: i, totalCount: i.length }
4905
+ textContent: JSON.stringify({ results: a }),
4906
+ structuredContent: { results: a, totalCount: a.length }
4860
4907
  };
4861
4908
  }
4862
- }, ni = {
4909
+ }, ha = {
4863
4910
  ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to uncomplete.")
4864
- }, ii = {
4911
+ }, fa = {
4865
4912
  uncompleted: s.array(s.string()).describe("The IDs of successfully uncompleted tasks."),
4866
4913
  failures: s.array(We).describe("Failed task uncompletion with error details."),
4867
4914
  totalRequested: s.number().describe("The total number of tasks requested to uncomplete."),
4868
4915
  successCount: s.number().describe("The number of successfully uncompleted tasks."),
4869
4916
  failureCount: s.number().describe("The number of failed task uncompletions.")
4870
- }, ai = {
4917
+ }, ba = {
4871
4918
  name: f.UNCOMPLETE_TASKS,
4872
4919
  description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
4873
- parameters: ni,
4874
- outputSchema: ii,
4920
+ parameters: ha,
4921
+ outputSchema: fa,
4875
4922
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
4876
4923
  async execute(e, t) {
4877
4924
  const r = [], o = [];
4878
- for (const i of e.ids)
4925
+ for (const a of e.ids)
4879
4926
  try {
4880
- await t.reopenTask(i), r.push(i);
4881
- } catch (a) {
4882
- const c = a instanceof Error ? a.message : "Unknown error";
4927
+ await t.reopenTask(a), r.push(a);
4928
+ } catch (i) {
4929
+ const c = i instanceof Error ? i.message : "Unknown error";
4883
4930
  o.push({
4884
- item: i,
4931
+ item: a,
4885
4932
  error: c
4886
4933
  });
4887
4934
  }
4888
4935
  return {
4889
- textContent: ci({
4936
+ textContent: ga({
4890
4937
  uncompleted: r,
4891
4938
  failures: o,
4892
4939
  args: e
@@ -4901,7 +4948,7 @@ const si = {
4901
4948
  };
4902
4949
  }
4903
4950
  };
4904
- function ci({
4951
+ function ga({
4905
4952
  uncompleted: e,
4906
4953
  failures: t,
4907
4954
  args: r
@@ -4915,54 +4962,54 @@ function ci({
4915
4962
  failures: t
4916
4963
  });
4917
4964
  }
4918
- const di = s.object({
4965
+ const ya = s.object({
4919
4966
  id: s.string().min(1).describe("The ID of the comment to update."),
4920
4967
  content: s.string().min(1).describe("The new content for the comment.")
4921
- }), li = {
4922
- comments: s.array(di).min(1).describe("The comments to update.")
4923
- }, ui = {
4968
+ }), ka = {
4969
+ comments: s.array(ya).min(1).describe("The comments to update.")
4970
+ }, Ta = {
4924
4971
  comments: s.array(fe).describe("The updated comments."),
4925
4972
  totalCount: s.number().describe("The total number of comments updated."),
4926
4973
  updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
4927
4974
  appliedOperations: s.object({
4928
4975
  updateCount: s.number().describe("The number of comments updated.")
4929
4976
  }).describe("Summary of operations performed.")
4930
- }, pi = {
4977
+ }, wa = {
4931
4978
  name: f.UPDATE_COMMENTS,
4932
4979
  description: "Update multiple existing comments with new content.",
4933
- parameters: li,
4934
- outputSchema: ui,
4980
+ parameters: ka,
4981
+ outputSchema: Ta,
4935
4982
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4936
4983
  async execute(e, t) {
4937
- const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), i = (await Promise.all(o)).map(pe);
4984
+ const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), a = (await Promise.all(o)).map(pe);
4938
4985
  return {
4939
- textContent: mi({
4940
- comments: i
4986
+ textContent: Ia({
4987
+ comments: a
4941
4988
  }),
4942
4989
  structuredContent: {
4943
- comments: i,
4944
- totalCount: i.length,
4945
- updatedCommentIds: i.map((c) => c.id),
4990
+ comments: a,
4991
+ totalCount: a.length,
4992
+ updatedCommentIds: a.map((c) => c.id),
4946
4993
  appliedOperations: {
4947
- updateCount: i.length
4994
+ updateCount: a.length
4948
4995
  }
4949
4996
  }
4950
4997
  };
4951
4998
  }
4952
4999
  };
4953
- function mi({ comments: e }) {
4954
- const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
5000
+ function Ia({ comments: e }) {
5001
+ const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
4955
5002
  if (t > 0) {
4956
- const i = t > 1 ? "comments" : "comment";
4957
- o.push(`${t} task ${i}`);
5003
+ const a = t > 1 ? "comments" : "comment";
5004
+ o.push(`${t} task ${a}`);
4958
5005
  }
4959
5006
  if (r > 0) {
4960
- const i = r > 1 ? "comments" : "comment";
4961
- o.push(`${r} project ${i}`);
5007
+ const a = r > 1 ? "comments" : "comment";
5008
+ o.push(`${r} project ${a}`);
4962
5009
  }
4963
5010
  return o.length > 0 ? `Updated ${o.join(" and ")}` : "No comments updated";
4964
5011
  }
4965
- const hi = s.object({
5012
+ const va = s.object({
4966
5013
  id: s.string().min(1).describe("The ID of the filter to update."),
4967
5014
  name: s.string().min(1).optional().describe("The new name of the filter."),
4968
5015
  query: s.string().min(1).optional().describe(
@@ -4970,9 +5017,9 @@ const hi = s.object({
4970
5017
  ),
4971
5018
  color: le,
4972
5019
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
4973
- }), fi = {
4974
- filters: s.array(hi).min(1).describe("The filters to update.")
4975
- }, bi = {
5020
+ }), ja = {
5021
+ filters: s.array(va).min(1).describe("The filters to update.")
5022
+ }, Sa = {
4976
5023
  filters: s.array(Be).describe("The updated filters."),
4977
5024
  totalCount: s.number().describe("The total number of filters updated."),
4978
5025
  updatedFilterIds: s.array(s.string()).describe("The IDs of the updated filters."),
@@ -4980,28 +5027,28 @@ const hi = s.object({
4980
5027
  updateCount: s.number().describe("The number of filters actually updated."),
4981
5028
  skippedCount: s.number().describe("The number of filters skipped (no changes).")
4982
5029
  }).describe("Summary of operations performed.")
4983
- }, gi = {
5030
+ }, Ca = {
4984
5031
  name: f.UPDATE_FILTERS,
4985
5032
  description: "Update one or more existing personal filters with new values.",
4986
- parameters: fi,
4987
- outputSchema: bi,
5033
+ parameters: ja,
5034
+ outputSchema: Sa,
4988
5035
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4989
5036
  async execute(e, t) {
4990
- const { filters: r } = e, o = [], i = r.map((m) => {
4991
- const h = ki(m);
5037
+ const { filters: r } = e, o = [], a = r.map((m) => {
5038
+ const h = Da(m);
4992
5039
  return h !== null ? { kind: "skipped", reason: h } : (o.push(m), { kind: "updated", filter: m });
4993
5040
  }).filter((m) => m.kind === "skipped").length;
4994
5041
  if (o.length === 0)
4995
5042
  return {
4996
- textContent: `Updated 0 filters (${i} skipped - no changes)`,
5043
+ textContent: `Updated 0 filters (${a} skipped - no changes)`,
4997
5044
  structuredContent: {
4998
5045
  filters: [],
4999
5046
  totalCount: 0,
5000
5047
  updatedFilterIds: [],
5001
- appliedOperations: { updateCount: 0, skippedCount: i }
5048
+ appliedOperations: { updateCount: 0, skippedCount: a }
5002
5049
  }
5003
5050
  };
5004
- const a = o.map((m) => {
5051
+ const i = o.map((m) => {
5005
5052
  const { id: h, color: g, ...I } = m;
5006
5053
  return z("filter_update", {
5007
5054
  id: h,
@@ -5009,7 +5056,7 @@ const hi = s.object({
5009
5056
  ...g !== void 0 ? { color: g } : {}
5010
5057
  });
5011
5058
  });
5012
- await t.sync({ commands: a });
5059
+ await t.sync({ commands: i });
5013
5060
  const d = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((m) => !m.isDeleted), l = new Set(o.map((m) => m.id)), u = d.filter((m) => l.has(m.id)).map((m) => ({
5014
5061
  id: m.id,
5015
5062
  name: m.name,
@@ -5019,79 +5066,79 @@ const hi = s.object({
5019
5066
  itemOrder: m.itemOrder
5020
5067
  }));
5021
5068
  return {
5022
- textContent: yi({ filters: u, skippedCount: i }),
5069
+ textContent: $a({ filters: u, skippedCount: a }),
5023
5070
  structuredContent: {
5024
5071
  filters: u,
5025
5072
  totalCount: u.length,
5026
5073
  updatedFilterIds: u.map((m) => m.id),
5027
5074
  appliedOperations: {
5028
5075
  updateCount: u.length,
5029
- skippedCount: i
5076
+ skippedCount: a
5030
5077
  }
5031
5078
  }
5032
5079
  };
5033
5080
  }
5034
5081
  };
5035
- function yi({
5082
+ function $a({
5036
5083
  filters: e,
5037
5084
  skippedCount: t
5038
5085
  }) {
5039
5086
  const r = e.length;
5040
5087
  let o = `Updated ${r} filter${r === 1 ? "" : "s"}`;
5041
5088
  if (t > 0 && (o += ` (${t} skipped - no changes)`), r > 0) {
5042
- const n = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
5089
+ const n = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
5043
5090
  `);
5044
5091
  o += `:
5045
5092
  ${n}`;
5046
5093
  }
5047
5094
  return o;
5048
5095
  }
5049
- function ki({ id: e, ...t }) {
5096
+ function Da({ id: e, ...t }) {
5050
5097
  const r = Object.values(t);
5051
5098
  return r.length === 0 || r.every((o) => o === void 0) ? "no-fields" : null;
5052
5099
  }
5053
- const Ti = s.object({
5100
+ const xa = s.object({
5054
5101
  id: s.string().min(1).describe("The ID of the project to update."),
5055
5102
  name: s.string().min(1).optional().describe("The new name of the project."),
5056
5103
  isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
5057
5104
  viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style."),
5058
5105
  color: le
5059
- }), wi = {
5060
- projects: s.array(Ti).min(1).describe("The projects to update.")
5061
- }, Ii = {
5062
- projects: s.array(ie).describe("The updated projects."),
5106
+ }), Aa = {
5107
+ projects: s.array(xa).min(1).describe("The projects to update.")
5108
+ }, Ea = {
5109
+ projects: s.array(ae).describe("The updated projects."),
5063
5110
  totalCount: s.number().describe("The total number of projects updated."),
5064
5111
  updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
5065
5112
  appliedOperations: s.object({
5066
5113
  updateCount: s.number().describe("The number of projects actually updated."),
5067
5114
  skippedCount: s.number().describe("The number of projects skipped (no changes).")
5068
5115
  }).describe("Summary of operations performed.")
5069
- }, vi = {
5116
+ }, Oa = {
5070
5117
  name: f.UPDATE_PROJECTS,
5071
5118
  description: "Update multiple existing projects with new values.",
5072
- parameters: wi,
5073
- outputSchema: Ii,
5119
+ parameters: Aa,
5120
+ outputSchema: Ea,
5074
5121
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5075
5122
  async execute(e, t) {
5076
5123
  const { projects: r } = e, o = await Promise.all(
5077
5124
  r.map(async (d) => {
5078
- const l = Si(d);
5125
+ const l = Ra(d);
5079
5126
  if (l !== null) return { kind: "skipped", reason: l };
5080
5127
  const { id: u, ...p } = d;
5081
5128
  return { kind: "updated", project: await t.updateProject(u, p) };
5082
5129
  })
5083
5130
  ), n = o.filter(
5084
5131
  (d) => d.kind === "updated"
5085
- ).map((d) => q(d.project)), i = o.filter(
5132
+ ).map((d) => q(d.project)), a = o.filter(
5086
5133
  (d) => d.kind === "skipped" && d.reason === "no-fields"
5087
- ).length, a = o.filter(
5134
+ ).length, i = o.filter(
5088
5135
  (d) => d.kind === "skipped" && d.reason === "no-valid-values"
5089
5136
  ).length;
5090
5137
  return {
5091
- textContent: ji({
5138
+ textContent: Pa({
5092
5139
  projects: n,
5093
- skippedNoFields: i,
5094
- skippedNoValidValues: a
5140
+ skippedNoFields: a,
5141
+ skippedNoValidValues: i
5095
5142
  }),
5096
5143
  structuredContent: {
5097
5144
  projects: n,
@@ -5099,41 +5146,41 @@ const Ti = s.object({
5099
5146
  updatedProjectIds: n.map((d) => d.id),
5100
5147
  appliedOperations: {
5101
5148
  updateCount: n.length,
5102
- skippedCount: i + a
5149
+ skippedCount: a + i
5103
5150
  }
5104
5151
  }
5105
5152
  };
5106
5153
  }
5107
5154
  };
5108
- function ji({
5155
+ function Pa({
5109
5156
  projects: e,
5110
5157
  skippedNoFields: t,
5111
5158
  skippedNoValidValues: r
5112
5159
  }) {
5113
5160
  const o = e.length, n = e.map((c) => `• ${c.name} (id=${c.id})`).join(`
5114
5161
  `);
5115
- let i = `Updated ${o} project${o === 1 ? "" : "s"}`;
5116
- const a = [];
5117
- return t > 0 && a.push(`${t} skipped - no changes`), r > 0 && a.push(`${r} skipped - no valid field values`), a.length > 0 && (i += ` (${a.join(", ")})`), o > 0 && (i += `:
5118
- ${n}`), i;
5162
+ let a = `Updated ${o} project${o === 1 ? "" : "s"}`;
5163
+ const i = [];
5164
+ return t > 0 && i.push(`${t} skipped - no changes`), r > 0 && i.push(`${r} skipped - no valid field values`), i.length > 0 && (a += ` (${i.join(", ")})`), o > 0 && (a += `:
5165
+ ${n}`), a;
5119
5166
  }
5120
- function Si({ id: e, ...t }) {
5167
+ function Ra({ id: e, ...t }) {
5121
5168
  const r = Object.values(t);
5122
5169
  return r.length === 0 ? "no-fields" : r.every((o) => o === void 0) ? "no-valid-values" : null;
5123
5170
  }
5124
- const Ci = s.object({
5171
+ const Ua = s.object({
5125
5172
  type: s.literal("relative"),
5126
5173
  id: s.string().min(1).describe("The ID of the relative reminder to update."),
5127
5174
  minuteOffset: s.number().int().min(0).optional().describe("New minute offset before task due time."),
5128
5175
  service: ge.optional().describe('New delivery method: "email" or "push".'),
5129
5176
  isUrgent: ye
5130
- }), $i = s.object({
5177
+ }), _a = s.object({
5131
5178
  type: s.literal("absolute"),
5132
5179
  id: s.string().min(1).describe("The ID of the absolute reminder to update."),
5133
5180
  due: vt.optional().describe("New due date/time for the reminder."),
5134
5181
  service: ge.optional().describe('New delivery method: "email" or "push".'),
5135
5182
  isUrgent: ye
5136
- }), Di = s.object({
5183
+ }), Na = s.object({
5137
5184
  type: s.literal("location"),
5138
5185
  id: s.string().min(1).describe("The ID of the location reminder to update."),
5139
5186
  name: s.string().optional().describe("New location name."),
@@ -5143,23 +5190,23 @@ const Ci = s.object({
5143
5190
  'New trigger condition: "on_enter" or "on_leave".'
5144
5191
  ),
5145
5192
  radius: s.number().int().optional().describe("New radius in meters.")
5146
- }), xi = s.discriminatedUnion("type", [
5147
- Ci,
5148
- $i,
5149
- Di
5150
- ]), Ai = {
5151
- reminders: s.array(xi).min(1).max(ue).describe(
5193
+ }), La = s.discriminatedUnion("type", [
5194
+ Ua,
5195
+ _a,
5196
+ Na
5197
+ ]), Ma = {
5198
+ reminders: s.array(La).min(1).max(ue).describe(
5152
5199
  `Array of reminders to update (max ${ue}). Each must include the reminder type and ID. Only include fields that need to change.`
5153
5200
  )
5154
- }, Ei = {
5201
+ }, Fa = {
5155
5202
  reminders: s.array(He).describe("The updated reminders."),
5156
5203
  totalCount: s.number().describe("Total reminders updated."),
5157
5204
  updatedReminderIds: s.array(s.string()).describe("IDs of updated reminders.")
5158
- }, Oi = {
5205
+ }, Ha = {
5159
5206
  name: f.UPDATE_REMINDERS,
5160
5207
  description: 'Update existing reminders. Each reminder must specify its type ("relative", "absolute", or "location") and ID. Only include fields that need to change.',
5161
- parameters: Ai,
5162
- outputSchema: Ei,
5208
+ parameters: Ma,
5209
+ outputSchema: Fa,
5163
5210
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
5164
5211
  async execute(e, t) {
5165
5212
  const { reminders: r } = e, o = r.map(async (d) => {
@@ -5183,37 +5230,37 @@ const Ci = s.object({
5183
5230
  return await t.updateLocationReminder(l, p);
5184
5231
  }
5185
5232
  }
5186
- }), i = (await Promise.all(o)).map(ce), a = i.length === 1 ? "reminder" : "reminders";
5233
+ }), a = (await Promise.all(o)).map(ce), i = a.length === 1 ? "reminder" : "reminders";
5187
5234
  return {
5188
- textContent: `Updated ${i.length} ${a}`,
5235
+ textContent: `Updated ${a.length} ${i}`,
5189
5236
  structuredContent: {
5190
- reminders: i,
5191
- totalCount: i.length,
5192
- updatedReminderIds: i.map((d) => d.id)
5237
+ reminders: a,
5238
+ totalCount: a.length,
5239
+ updatedReminderIds: a.map((d) => d.id)
5193
5240
  }
5194
5241
  };
5195
5242
  }
5196
- }, Pi = s.object({
5243
+ }, Wa = s.object({
5197
5244
  id: s.string().min(1).describe("The ID of the section to update."),
5198
5245
  name: s.string().min(1).describe("The new name of the section.")
5199
- }), Ui = {
5200
- sections: s.array(Pi).min(1).describe("The sections to update.")
5201
- }, Ri = {
5246
+ }), Ba = {
5247
+ sections: s.array(Wa).min(1).describe("The sections to update.")
5248
+ }, za = {
5202
5249
  sections: s.array(he).describe("The updated sections."),
5203
5250
  totalCount: s.number().describe("The total number of sections updated."),
5204
5251
  updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
5205
- }, _i = {
5252
+ }, Ya = {
5206
5253
  name: f.UPDATE_SECTIONS,
5207
5254
  description: "Update multiple existing sections with new values.",
5208
- parameters: Ui,
5209
- outputSchema: Ri,
5255
+ parameters: Ba,
5256
+ outputSchema: za,
5210
5257
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5211
5258
  async execute({ sections: e }, t) {
5212
5259
  const r = await Promise.all(
5213
5260
  e.map((n) => t.updateSection(n.id, { name: n.name }))
5214
5261
  );
5215
5262
  return {
5216
- textContent: Ni({
5263
+ textContent: Ga({
5217
5264
  sections: r
5218
5265
  }),
5219
5266
  structuredContent: {
@@ -5224,13 +5271,13 @@ const Ci = s.object({
5224
5271
  };
5225
5272
  }
5226
5273
  };
5227
- function Ni({ sections: e }) {
5274
+ function Ga({ sections: e }) {
5228
5275
  const t = e.length, r = e.map((n) => `• ${n.name} (id=${n.id}, projectId=${n.projectId})`).join(`
5229
5276
  `);
5230
5277
  return `Updated ${t} section${t === 1 ? "" : "s"}:
5231
5278
  ${r}`;
5232
5279
  }
5233
- const Li = s.object({
5280
+ const qa = s.object({
5234
5281
  id: s.string().min(1).describe("The ID of the task to update."),
5235
5282
  content: s.string().optional().describe(
5236
5283
  '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.'
@@ -5269,9 +5316,9 @@ const Li = s.object({
5269
5316
  isUncompletable: s.boolean().optional().describe(
5270
5317
  "Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
5271
5318
  )
5272
- }), Mi = ["remove", "no date"], Fi = ["remove", "no date", "no deadline"], Hi = "no date", Wi = {
5273
- tasks: s.array(Li).min(1).describe("The tasks to update.")
5274
- }, Bi = {
5319
+ }), Ka = ["remove", "no date"], Va = ["remove", "no date", "no deadline"], Ja = "no date", Xa = {
5320
+ tasks: s.array(qa).min(1).describe("The tasks to update.")
5321
+ }, Za = {
5275
5322
  tasks: s.array(K).describe("The updated tasks."),
5276
5323
  totalCount: s.number().describe("The total number of tasks updated."),
5277
5324
  updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
@@ -5279,15 +5326,15 @@ const Li = s.object({
5279
5326
  updateCount: s.number().describe("The number of tasks actually updated."),
5280
5327
  skippedCount: s.number().describe("The number of tasks skipped (no changes).")
5281
5328
  }).describe("Summary of operations performed.")
5282
- }, zi = {
5329
+ }, Qa = {
5283
5330
  name: f.UPDATE_TASKS,
5284
5331
  description: "Update existing tasks including content, dates, priorities, and assignments.",
5285
- parameters: Wi,
5286
- outputSchema: Bi,
5332
+ parameters: Xa,
5333
+ outputSchema: Za,
5287
5334
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5288
5335
  async execute(e, t) {
5289
5336
  const { tasks: r } = e, o = r.map(async (c) => {
5290
- if (!Gi(c))
5337
+ if (!ti(c))
5291
5338
  return;
5292
5339
  const {
5293
5340
  id: d,
@@ -5312,16 +5359,16 @@ const Li = s.object({
5312
5359
  I && (b.priority = gt(I));
5313
5360
  const S = dt(
5314
5361
  m,
5315
- Mi,
5316
- Hi
5362
+ Ka,
5363
+ Ja
5317
5364
  );
5318
5365
  S !== void 0 && (b = { ...b, dueString: S });
5319
- const R = dt(
5366
+ const U = dt(
5320
5367
  $,
5321
- Fi,
5368
+ Va,
5322
5369
  null
5323
5370
  );
5324
- if (R !== void 0 && (b = { ...b, deadlineDate: R }), h)
5371
+ if (U !== void 0 && (b = { ...b, deadlineDate: U }), h)
5325
5372
  try {
5326
5373
  const { minutes: v } = bt(h);
5327
5374
  b = {
@@ -5351,40 +5398,40 @@ const Li = s.object({
5351
5398
  }
5352
5399
  if (!T && !u && !p)
5353
5400
  return await t.updateTask(d, b);
5354
- const w = Us(d, T, u, p), j = await t.moveTask(d, w);
5401
+ const w = Bs(d, T, u, p), j = await t.moveTask(d, w);
5355
5402
  return Object.keys(b).length > 0 ? await t.updateTask(d, b) : j;
5356
5403
  }), n = (await Promise.all(o)).filter(
5357
5404
  (c) => c !== void 0
5358
- ), i = n.map(U);
5405
+ ), a = n.map(R);
5359
5406
  return {
5360
- textContent: Yi({
5361
- tasks: i,
5407
+ textContent: ei({
5408
+ tasks: a,
5362
5409
  args: e
5363
5410
  }),
5364
5411
  structuredContent: {
5365
- tasks: i,
5366
- totalCount: i.length,
5412
+ tasks: a,
5413
+ totalCount: a.length,
5367
5414
  updatedTaskIds: n.map((c) => c.id),
5368
5415
  appliedOperations: {
5369
- updateCount: i.length,
5370
- skippedCount: r.length - i.length
5416
+ updateCount: a.length,
5417
+ skippedCount: r.length - a.length
5371
5418
  }
5372
5419
  }
5373
5420
  };
5374
5421
  }
5375
5422
  };
5376
- function Yi({
5423
+ function ei({
5377
5424
  tasks: e,
5378
5425
  args: t
5379
5426
  }) {
5380
5427
  const r = t.tasks.length, o = e.length, n = r - o;
5381
- let i = "";
5382
- return n > 0 && (i = ` (${n} skipped - no changes)`), Ye("Updated", e, {
5383
- context: i,
5428
+ let a = "";
5429
+ return n > 0 && (a = ` (${n} skipped - no changes)`), Ye("Updated", e, {
5430
+ context: a,
5384
5431
  showDetails: e.length <= 5
5385
5432
  });
5386
5433
  }
5387
- function Gi({ id: e, ...t }) {
5434
+ function ti({ id: e, ...t }) {
5388
5435
  return Object.keys(t).length > 0;
5389
5436
  }
5390
5437
  function dt(e, t, r) {
@@ -5395,7 +5442,7 @@ function dt(e, t, r) {
5395
5442
  const o = e.trim().toLowerCase();
5396
5443
  return t.includes(o) ? r : e;
5397
5444
  }
5398
- const qi = {}, Ki = {
5445
+ const si = {}, ri = {
5399
5446
  type: s.literal("user_info").describe("The type of the response."),
5400
5447
  userId: s.string().describe("The user ID."),
5401
5448
  fullName: s.string().describe("The full name of the user."),
@@ -5412,25 +5459,25 @@ const qi = {}, Ki = {
5412
5459
  email: s.string().describe("The email address of the user."),
5413
5460
  plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
5414
5461
  };
5415
- function Vi(e) {
5462
+ function oi(e) {
5416
5463
  return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
5417
5464
  }
5418
- function Ji(e, t) {
5465
+ function ni(e, t) {
5419
5466
  const o = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
5420
5467
  return n.setDate(e.getDate() - o), n;
5421
5468
  }
5422
- function Xi(e) {
5469
+ function ai(e) {
5423
5470
  const t = new Date(e);
5424
5471
  return t.setDate(e.getDate() + 6), t;
5425
5472
  }
5426
- function Zi(e) {
5473
+ function ii(e) {
5427
5474
  const t = new Date(e.getFullYear(), 0, 1), r = (e.getTime() - t.getTime()) / 864e5;
5428
5475
  return Math.ceil((r + t.getDay() + 1) / 7);
5429
5476
  }
5430
- function Qi(e) {
5477
+ function ci(e) {
5431
5478
  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
5432
5479
  }
5433
- function ea(e) {
5480
+ function di(e) {
5434
5481
  try {
5435
5482
  return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
5436
5483
  } catch {
@@ -5438,9 +5485,9 @@ function ea(e) {
5438
5485
  }
5439
5486
  }
5440
5487
  function _t(e) {
5441
- return ea(e) ? e : "UTC";
5488
+ return di(e) ? e : "UTC";
5442
5489
  }
5443
- function ta(e, t) {
5490
+ function li(e, t) {
5444
5491
  const r = _t(t);
5445
5492
  return e.toLocaleString("en-US", {
5446
5493
  timeZone: r,
@@ -5453,18 +5500,18 @@ function ta(e, t) {
5453
5500
  hour12: !1
5454
5501
  });
5455
5502
  }
5456
- async function sa(e) {
5457
- const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = _t(r), n = /* @__PURE__ */ new Date(), i = ta(n, o), a = t.startDay ?? 1, c = Qi(a), d = Vi(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = Ji(l, a), p = Xi(u), m = Zi(l), g = [
5503
+ async function ui(e) {
5504
+ const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = _t(r), n = /* @__PURE__ */ new Date(), a = li(n, o), i = t.startDay ?? 1, c = ci(i), d = oi(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = ni(l, i), p = ai(u), m = ii(l), g = [
5458
5505
  "# User Information",
5459
5506
  "",
5460
5507
  `**User ID:** ${t.id}`,
5461
5508
  `**Full Name:** ${t.fullName}`,
5462
5509
  `**Email:** ${t.email}`,
5463
5510
  `**Timezone:** ${o}`,
5464
- `**Current Local Time:** ${i}`,
5511
+ `**Current Local Time:** ${a}`,
5465
5512
  "",
5466
5513
  "## Week Settings",
5467
- `**Week Start Day:** ${c} (${a})`,
5514
+ `**Week Start Day:** ${c} (${i})`,
5468
5515
  `**Current Week:** Week ${m}`,
5469
5516
  `**Week Start Date:** ${te(u)}`,
5470
5517
  `**Week End Date:** ${te(p)}`,
@@ -5482,8 +5529,8 @@ async function sa(e) {
5482
5529
  userId: t.id,
5483
5530
  fullName: t.fullName,
5484
5531
  timezone: o,
5485
- currentLocalTime: i,
5486
- startDay: a,
5532
+ currentLocalTime: a,
5533
+ startDay: i,
5487
5534
  startDayName: c,
5488
5535
  weekStartDate: te(u),
5489
5536
  weekEndDate: te(p),
@@ -5496,26 +5543,26 @@ async function sa(e) {
5496
5543
  };
5497
5544
  return { textContent: g, structuredContent: I };
5498
5545
  }
5499
- const ra = {
5546
+ const pi = {
5500
5547
  name: f.USER_INFO,
5501
5548
  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).",
5502
- parameters: qi,
5503
- outputSchema: Ki,
5549
+ parameters: si,
5550
+ outputSchema: ri,
5504
5551
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5505
5552
  async execute(e, t) {
5506
- const r = await sa(t);
5553
+ const r = await ui(t);
5507
5554
  return {
5508
5555
  textContent: r.textContent,
5509
5556
  structuredContent: r.structuredContent
5510
5557
  };
5511
5558
  }
5512
- }, lt = 10 * 1024 * 1024, oa = /* @__PURE__ */ new Set([
5559
+ }, lt = 10 * 1024 * 1024, mi = /* @__PURE__ */ new Set([
5513
5560
  "image/png",
5514
5561
  "image/jpeg",
5515
5562
  "image/gif",
5516
5563
  "image/webp",
5517
5564
  "image/svg+xml"
5518
- ]), na = /* @__PURE__ */ new Set([
5565
+ ]), hi = /* @__PURE__ */ new Set([
5519
5566
  "text/plain",
5520
5567
  "text/csv",
5521
5568
  "text/html",
@@ -5523,7 +5570,7 @@ const ra = {
5523
5570
  "application/json",
5524
5571
  "application/xml",
5525
5572
  "text/xml"
5526
- ]), ia = {
5573
+ ]), fi = {
5527
5574
  ".png": "image/png",
5528
5575
  ".jpg": "image/jpeg",
5529
5576
  ".jpeg": "image/jpeg",
@@ -5538,23 +5585,23 @@ const ra = {
5538
5585
  ".xml": "application/xml",
5539
5586
  ".pdf": "application/pdf"
5540
5587
  };
5541
- function aa(e) {
5542
- return oa.has(e) ? "image" : na.has(e) || e.startsWith("text/") ? "text" : "binary";
5588
+ function bi(e) {
5589
+ return mi.has(e) ? "image" : hi.has(e) || e.startsWith("text/") ? "text" : "binary";
5543
5590
  }
5544
- function ca(e) {
5591
+ function gi(e) {
5545
5592
  return (e.split(";")[0] ?? e).trim().toLowerCase();
5546
5593
  }
5547
- function da(e) {
5594
+ function yi(e) {
5548
5595
  try {
5549
5596
  const t = new URL(e).pathname, r = t.lastIndexOf(".");
5550
5597
  if (r === -1) return;
5551
5598
  const o = t.slice(r).toLowerCase();
5552
- return ia[o];
5599
+ return fi[o];
5553
5600
  } catch {
5554
5601
  return;
5555
5602
  }
5556
5603
  }
5557
- function la(e) {
5604
+ function ki(e) {
5558
5605
  try {
5559
5606
  const t = new URL(e).pathname, r = t.lastIndexOf("/");
5560
5607
  return r === -1 ? void 0 : t.slice(r + 1) || void 0;
@@ -5562,32 +5609,32 @@ function la(e) {
5562
5609
  return;
5563
5610
  }
5564
5611
  }
5565
- const ua = {
5612
+ const Ti = {
5566
5613
  fileUrl: s.string().url().describe(
5567
5614
  "The URL of the attachment file to view. Get this from the fileUrl field in a comment's fileAttachment."
5568
5615
  )
5569
- }, pa = {
5616
+ }, wi = {
5570
5617
  fileName: s.string().optional().describe("The name of the file."),
5571
5618
  fileType: s.string().optional().describe("The MIME type of the file."),
5572
5619
  fileSize: s.number().optional().describe("The size of the file in bytes."),
5573
5620
  contentDelivery: s.enum(["image", "text", "embedded_resource", "metadata_only"]).describe("How the content was delivered.")
5574
- }, ma = {
5621
+ }, Ii = {
5575
5622
  name: f.VIEW_ATTACHMENT,
5576
5623
  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).",
5577
- parameters: ua,
5578
- outputSchema: pa,
5624
+ parameters: Ti,
5625
+ outputSchema: wi,
5579
5626
  annotations: {
5580
5627
  readOnlyHint: !0,
5581
5628
  destructiveHint: !1,
5582
5629
  idempotentHint: !0
5583
5630
  },
5584
5631
  async execute({ fileUrl: e }, t) {
5585
- const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, i = la(e), a = r.headers["content-type"], c = a ? ca(a) : void 0, d = c && c !== "application/octet-stream" ? c : da(e) ?? c ?? "application/octet-stream";
5632
+ const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, a = ki(e), i = r.headers["content-type"], c = i ? gi(i) : void 0, d = c && c !== "application/octet-stream" ? c : yi(e) ?? c ?? "application/octet-stream";
5586
5633
  if (n && n > lt)
5587
5634
  return {
5588
- textContent: `Attachment "${i ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5635
+ textContent: `Attachment "${a ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5589
5636
  structuredContent: {
5590
- fileName: i,
5637
+ fileName: a,
5591
5638
  fileType: d,
5592
5639
  fileSize: n,
5593
5640
  contentDelivery: "metadata_only"
@@ -5596,15 +5643,15 @@ const ua = {
5596
5643
  const l = Buffer.from(await r.arrayBuffer()), u = l.byteLength;
5597
5644
  if (u > lt)
5598
5645
  return {
5599
- textContent: `Attachment "${i ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5646
+ textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5600
5647
  structuredContent: {
5601
- fileName: i,
5648
+ fileName: a,
5602
5649
  fileType: d,
5603
5650
  fileSize: u,
5604
5651
  contentDelivery: "metadata_only"
5605
5652
  }
5606
5653
  };
5607
- const p = aa(d), m = [];
5654
+ const p = bi(d), m = [];
5608
5655
  let h;
5609
5656
  return p === "image" ? (m.push({
5610
5657
  type: "image",
@@ -5621,9 +5668,9 @@ const ua = {
5621
5668
  blob: l.toString("base64")
5622
5669
  }
5623
5670
  }), h = "embedded_resource"), {
5624
- textContent: `Attachment: ${i ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
5671
+ textContent: `Attachment: ${a ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
5625
5672
  structuredContent: {
5626
- fileName: i,
5673
+ fileName: a,
5627
5674
  fileType: d,
5628
5675
  fileSize: u,
5629
5676
  contentDelivery: h
@@ -5631,7 +5678,7 @@ const ua = {
5631
5678
  contentItems: m
5632
5679
  };
5633
5680
  }
5634
- }, ha = `
5681
+ }, vi = `
5635
5682
  ## Todoist Task and Project Management Tools
5636
5683
 
5637
5684
  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.
@@ -5728,7 +5775,7 @@ You have access to comprehensive Todoist management tools for personal productiv
5728
5775
 
5729
5776
  Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
5730
5777
  `;
5731
- function Ca({
5778
+ function Ui({
5732
5779
  todoistApiKey: e,
5733
5780
  baseUrl: t,
5734
5781
  features: r = []
@@ -5740,10 +5787,10 @@ function Ca({
5740
5787
  tools: { listChanged: !0 },
5741
5788
  prompts: { listChanged: !0 }
5742
5789
  },
5743
- instructions: ha
5790
+ instructions: vi
5744
5791
  }
5745
- ), n = new Ht(e, { baseUrl: t }), i = {
5746
- ...en,
5792
+ ), n = new Ht(e, { baseUrl: t }), a = {
5793
+ ...ln,
5747
5794
  _meta: {
5748
5795
  ui: {
5749
5796
  resourceUri: xe
@@ -5751,56 +5798,56 @@ function Ca({
5751
5798
  }
5752
5799
  };
5753
5800
  ts(o);
5754
- const a = { server: o, client: n, features: r };
5755
- return k({ tool: Rr, ...a }), k({ tool: zr, ...a }), k({ tool: ai, ...a }), k({ tool: zi, ...a }), k({ tool: ei, ...a }), k({ tool: Jo, ...a }), k({ tool: i, ...a }), k({ tool: To, ...a }), k({ tool: mr, ...a }), k({ tool: vi, ...a }), k({ tool: Uo, ...a }), k({ tool: zn, ...a }), k({ tool: qn, ...a }), k({ tool: Cr, ...a }), k({ tool: _i, ...a }), k({ tool: Bo, ...a }), k({ tool: Gs, ...a }), k({ tool: uo, ...a }), k({ tool: pi, ...a }), k({ tool: wr, ...a }), k({ tool: Lo, ...a }), k({ tool: Oi, ...a }), k({ tool: ma, ...a }), k({ tool: nr, ...a }), k({ tool: jo, ...a }), k({ tool: Js, ...a }), k({ tool: tr, ...a }), k({ tool: gi, ...a }), k({ tool: ro, ...a }), k({ tool: hn, ...a }), k({ tool: Cn, ...a }), k({ tool: kn, ...a }), k({ tool: Hr, ...a }), k({ tool: An, ...a }), k({ tool: un, ...a }), k({ tool: Kr, ...a }), k({ tool: eo, ...a }), k({ tool: Jn, ...a }), k({ tool: ra, ...a }), k({ tool: xo, ...a }), k({ tool: Hn, ...a }), k({ tool: Rn, ...a }), k({ tool: oi, ...a }), k({ tool: Xr, ...a }), o.registerPrompt(
5756
- ae.name,
5801
+ const i = { server: o, client: n, features: r };
5802
+ return k({ tool: zr, ...i }), k({ tool: Qr, ...i }), k({ tool: ba, ...i }), k({ tool: Qa, ...i }), k({ tool: da, ...i }), k({ tool: nn, ...i }), k({ tool: a, ...i }), k({ tool: xo, ...i }), k({ tool: Ir, ...i }), k({ tool: Oa, ...i }), k({ tool: Bo, ...i }), k({ tool: Qn, ...i }), k({ tool: sa, ...i }), k({ tool: Ur, ...i }), k({ tool: Ya, ...i }), k({ tool: Zo, ...i }), k({ tool: tr, ...i }), k({ tool: To, ...i }), k({ tool: wa, ...i }), k({ tool: Ar, ...i }), k({ tool: qo, ...i }), k({ tool: Ha, ...i }), k({ tool: Ii, ...i }), k({ tool: hr, ...i }), k({ tool: Po, ...i }), k({ tool: nr, ...i }), k({ tool: lr, ...i }), k({ tool: Ca, ...i }), k({ tool: mo, ...i }), k({ tool: vn, ...i }), k({ tool: Un, ...i }), k({ tool: Dn, ...i }), k({ tool: Jr, ...i }), k({ tool: Mn, ...i }), k({ tool: Tn, ...i }), k({ tool: ro, ...i }), k({ tool: lo, ...i }), k({ tool: na, ...i }), k({ tool: pi, ...i }), k({ tool: Lo, ...i }), k({ tool: Jn, ...i }), k({ tool: zn, ...i }), k({ tool: ma, ...i }), k({ tool: ao, ...i }), o.registerPrompt(
5803
+ ie.name,
5757
5804
  {
5758
- title: ae.title,
5759
- description: ae.description,
5760
- argsSchema: ae.argsSchema
5805
+ title: ie.title,
5806
+ description: ie.description,
5807
+ argsSchema: ie.argsSchema
5761
5808
  },
5762
- ae.callback
5809
+ ie.callback
5763
5810
  ), o;
5764
5811
  }
5765
5812
  export {
5766
- _i as A,
5767
- Cr as B,
5768
- Uo as C,
5769
- vi as D,
5770
- mr as E,
5771
- ei as F,
5772
- To as G,
5773
- en as H,
5774
- Jo as I,
5775
- zi as J,
5776
- ai as K,
5777
- zr as L,
5778
- Rr as M,
5779
- Sa as N,
5780
- xo as a,
5781
- un as b,
5782
- An as c,
5783
- Kr as d,
5784
- Hr as e,
5785
- Xr as f,
5786
- Ca as g,
5787
- kn as h,
5788
- Cn as i,
5789
- hn as j,
5790
- ro as k,
5791
- Rn as l,
5792
- Hn as m,
5793
- gi as n,
5794
- tr as o,
5795
- Js as p,
5796
- jo as q,
5797
- Jn as r,
5798
- oi as s,
5799
- nr as t,
5800
- ra as u,
5801
- ma as v,
5802
- uo as w,
5803
- pi as x,
5804
- Gs as y,
5805
- Bo as z
5813
+ Ya as A,
5814
+ Ur as B,
5815
+ Bo as C,
5816
+ Oa as D,
5817
+ Ir as E,
5818
+ da as F,
5819
+ xo as G,
5820
+ ln as H,
5821
+ nn as I,
5822
+ Qa as J,
5823
+ ba as K,
5824
+ Qr as L,
5825
+ zr as M,
5826
+ Ri as N,
5827
+ Lo as a,
5828
+ Tn as b,
5829
+ Mn as c,
5830
+ ro as d,
5831
+ Jr as e,
5832
+ ao as f,
5833
+ Ui as g,
5834
+ Dn as h,
5835
+ Un as i,
5836
+ vn as j,
5837
+ mo as k,
5838
+ zn as l,
5839
+ Jn as m,
5840
+ Ca as n,
5841
+ lr as o,
5842
+ nr as p,
5843
+ Po as q,
5844
+ na as r,
5845
+ ma as s,
5846
+ hr as t,
5847
+ pi as u,
5848
+ Ii as v,
5849
+ To as w,
5850
+ wa as x,
5851
+ tr as y,
5852
+ Zo as z
5806
5853
  };