@doist/todoist-mcp 12.5.3 → 12.5.5

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.
@@ -131,7 +131,7 @@ function G(e) {
131
131
  if (t)
132
132
  return R(t);
133
133
  if (Array.isArray(e)) {
134
- const n = e.map((a) => J(a) ? w(a.message) || w(a.error) : w(a)).filter((a) => !!a);
134
+ const n = e.map((i) => J(i) ? w(i.message) || w(i.error) : w(i)).filter((i) => !!i);
135
135
  return n.length > 0 ? R(n.slice(0, 2).join("; ")) : void 0;
136
136
  }
137
137
  if (!J(e))
@@ -146,9 +146,9 @@ function G(e) {
146
146
  if (r)
147
147
  return R(r);
148
148
  const o = [];
149
- for (const [n, a] of Object.entries(e)) {
150
- const i = w(a);
151
- if (i && (o.push(`${n}: ${i}`), o.length >= 2))
149
+ for (const [n, i] of Object.entries(e)) {
150
+ const a = w(i);
151
+ if (a && (o.push(`${n}: ${a}`), o.length >= 2))
152
152
  break;
153
153
  }
154
154
  return o.length > 0 ? R(o.join("; ")) : void 0;
@@ -156,8 +156,8 @@ function G(e) {
156
156
  function Js(e) {
157
157
  if (!e)
158
158
  return [];
159
- const t = /* @__PURE__ */ new Set(), r = (i) => {
160
- i && t.add(R(i, 120));
159
+ const t = /* @__PURE__ */ new Set(), r = (a) => {
160
+ a && t.add(R(a, 120));
161
161
  }, o = L(
162
162
  w(e.field),
163
163
  w(e.parameter),
@@ -172,46 +172,46 @@ function Js(e) {
172
172
  e.error_extra
173
173
  );
174
174
  if (n) {
175
- const i = L(
175
+ const a = L(
176
176
  w(n.field),
177
177
  w(n.parameter),
178
178
  w(n.param),
179
179
  w(n.path),
180
180
  w(n.argument)
181
181
  );
182
- r(i);
182
+ r(a);
183
183
  }
184
- const a = e.errors;
185
- if (Array.isArray(a))
186
- for (const i of a) {
187
- if (!J(i)) {
188
- r(w(i));
184
+ const i = e.errors;
185
+ if (Array.isArray(i))
186
+ for (const a of i) {
187
+ if (!J(a)) {
188
+ r(w(a));
189
189
  continue;
190
190
  }
191
191
  const c = L(
192
- w(i.field),
193
- w(i.parameter),
194
- w(i.param),
195
- w(i.path),
196
- w(i.name)
192
+ w(a.field),
193
+ w(a.parameter),
194
+ w(a.param),
195
+ w(a.path),
196
+ w(a.name)
197
197
  ), d = L(
198
- w(i.message),
199
- w(i.error),
200
- w(i.detail),
201
- w(i.description)
198
+ w(a.message),
199
+ w(a.error),
200
+ w(a.detail),
201
+ w(a.description)
202
202
  );
203
203
  r(c && d ? `${c}: ${d}` : c || d);
204
204
  }
205
- else if (J(a))
206
- for (const [i, c] of Object.entries(a)) {
205
+ else if (J(i))
206
+ for (const [a, c] of Object.entries(i)) {
207
207
  const d = w(c);
208
208
  if (d) {
209
- r(`${i}: ${d}`);
209
+ r(`${a}: ${d}`);
210
210
  continue;
211
211
  }
212
212
  if (Array.isArray(c)) {
213
213
  const l = c.map((u) => w(u)).filter((u) => !!u).join(", ");
214
- r(l ? `${i}: ${l}` : i);
214
+ r(l ? `${a}: ${l}` : a);
215
215
  }
216
216
  }
217
217
  return Array.from(t).slice(0, 3);
@@ -267,7 +267,7 @@ function Ve(e) {
267
267
  t?.data,
268
268
  r?.responseData,
269
269
  r?.data
270
- ), a = L(
270
+ ), i = L(
271
271
  E(t?.httpStatusCode),
272
272
  E(t?.statusCode),
273
273
  E(t?.status),
@@ -280,7 +280,7 @@ function Ve(e) {
280
280
  xe(w(t?.message)),
281
281
  xe(w(r?.message)),
282
282
  xe(typeof e == "string" ? e : void 0)
283
- ), i = L(
283
+ ), a = L(
284
284
  re(n?.errorCode),
285
285
  re(n?.error_code),
286
286
  re(n?.code),
@@ -309,9 +309,9 @@ function Ve(e) {
309
309
  G(n?.errors),
310
310
  G(t?.details)
311
311
  ), p = Js(n);
312
- return a !== void 0 || Zs(n) || c !== void 0 || i !== void 0 || (l ? He(l) : !1) ? {
313
- statusCode: a,
314
- code: i,
312
+ return i !== void 0 || Zs(n) || c !== void 0 || a !== void 0 || (l ? He(l) : !1) ? {
313
+ statusCode: i,
314
+ code: a,
315
315
  tag: c ? R(c, 80) : void 0,
316
316
  message: l ? R(l) : void 0,
317
317
  details: u ? R(u) : void 0,
@@ -359,8 +359,8 @@ function rr(e, {
359
359
  }) {
360
360
  if (!r)
361
361
  return;
362
- const n = Ve(e), i = n?.tag?.toUpperCase() === "INVALID_DUE_STRING", c = !o && /^invalid date format\.?$/i.test(n?.message ?? "");
363
- if (!i && !c)
362
+ const n = Ve(e), a = n?.tag?.toUpperCase() === "INVALID_DUE_STRING", c = !o && /^invalid date format\.?$/i.test(n?.message ?? "");
363
+ if (!a && !c)
364
364
  return;
365
365
  const d = r.trim().replace(/^recurring(?:\s+|$)/i, "").trim();
366
366
  return d !== r.trim() && d ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use Todoist recurrence syntax, for example \`${d}\`; don't prefix it with \`recurring\`. Change only \`dueString\` and retry.` : d !== r.trim() ? `Task "${t}" wasn't created because \`dueString\` could not be parsed. Use a complete Todoist recurrence expression; \`recurring\` alone is not valid. Change only \`dueString\` and retry.` : `Task "${t}" wasn't created because \`dueString\` could not be parsed. Change only \`dueString\` and retry.`;
@@ -371,7 +371,7 @@ function or(e) {
371
371
  const t = Ve(e);
372
372
  return t ? sr(t) : Bt(e);
373
373
  }
374
- const nr = "12.5.3", ar = {
374
+ const nr = "12.5.5", ir = {
375
375
  version: nr
376
376
  }, C = {
377
377
  /** Default limit for task listings */
@@ -446,8 +446,8 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
446
446
  o++;
447
447
  return;
448
448
  }
449
- await new Promise((i, c) => {
450
- const d = { admit: i, abandon: c };
449
+ await new Promise((a, c) => {
450
+ const d = { admit: a, abandon: c };
451
451
  r.push(d), !(t <= 0) && (d.timer = setTimeout(() => {
452
452
  const l = r.indexOf(d);
453
453
  l !== -1 && r.splice(l, 1), d.abandon(
@@ -458,10 +458,10 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
458
458
  }, t), d.timer.unref?.());
459
459
  });
460
460
  }
461
- function a() {
462
- const i = r.shift();
463
- if (i) {
464
- clearTimeout(i.timer), i.admit();
461
+ function i() {
462
+ const a = r.shift();
463
+ if (a) {
464
+ clearTimeout(a.timer), a.admit();
465
465
  return;
466
466
  }
467
467
  o--;
@@ -471,7 +471,7 @@ function mt(e, { queueTimeoutMs: t = Be.QUEUE_WAIT_MS } = {}) {
471
471
  try {
472
472
  return await c();
473
473
  } finally {
474
- a();
474
+ i();
475
475
  }
476
476
  };
477
477
  }
@@ -483,7 +483,7 @@ function qt() {
483
483
  }
484
484
  const ht = /* @__PURE__ */ new Map(), Yt = /* @__PURE__ */ new WeakMap();
485
485
  let ft;
486
- function ir() {
486
+ function ar() {
487
487
  return ft ??= qt(), ft;
488
488
  }
489
489
  function cr(e) {
@@ -495,7 +495,7 @@ function dr(e, t) {
495
495
  o || (o = qt(), ht.set(r, o)), Yt.set(e, o);
496
496
  }
497
497
  function Gt(e) {
498
- return Yt.get(e) ?? ir();
498
+ return Yt.get(e) ?? ar();
499
499
  }
500
500
  function lr(e) {
501
501
  return Gt(e).moves;
@@ -503,7 +503,7 @@ function lr(e) {
503
503
  function ur(e) {
504
504
  return Gt(e).writes;
505
505
  }
506
- const pr = "todoist-mcp", Je = ar.version, Vt = new Rs(), bt = Us(import.meta.url);
506
+ const pr = "todoist-mcp", Je = ir.version, Vt = new Rs(), bt = Us(import.meta.url);
507
507
  let Te;
508
508
  const mr = async () => {
509
509
  const e = bt.resolve("@doist/todoist-sdk"), t = _e(Ut(e), "transport", "http-dispatcher.js");
@@ -551,9 +551,9 @@ function Tr(e, t) {
551
551
  }
552
552
  };
553
553
  if (!e && t !== void 0) {
554
- const i = new AbortController(), c = setTimeout(() => i.abort(gt()), t);
554
+ const a = new AbortController(), c = setTimeout(() => a.abort(gt()), t);
555
555
  return {
556
- signal: i.signal,
556
+ signal: a.signal,
557
557
  cleanup: () => clearTimeout(c)
558
558
  };
559
559
  }
@@ -563,21 +563,21 @@ function Tr(e, t) {
563
563
  cleanup: () => {
564
564
  }
565
565
  };
566
- const r = new AbortController(), o = [], n = (i) => {
567
- r.signal.aborted || r.abort(i);
566
+ const r = new AbortController(), o = [], n = (a) => {
567
+ r.signal.aborted || r.abort(a);
568
568
  };
569
569
  if (e?.aborted)
570
570
  n(e.reason);
571
571
  else if (e) {
572
- const i = () => n(e.reason);
573
- e.addEventListener("abort", i, { once: !0 }), o.push(() => e.removeEventListener("abort", i));
572
+ const a = () => n(e.reason);
573
+ e.addEventListener("abort", a, { once: !0 }), o.push(() => e.removeEventListener("abort", a));
574
574
  }
575
- const a = setTimeout(() => n(gt()), t);
576
- return o.push(() => clearTimeout(a)), {
575
+ const i = setTimeout(() => n(gt()), t);
576
+ return o.push(() => clearTimeout(i)), {
577
577
  signal: r.signal,
578
578
  cleanup: () => {
579
- for (const i of o)
580
- i();
579
+ for (const a of o)
580
+ a();
581
581
  }
582
582
  };
583
583
  }
@@ -606,17 +606,17 @@ function Ir(e) {
606
606
  };
607
607
  }
608
608
  function Sr(e = globalThis.fetch, t = {}) {
609
- const r = e === globalThis.fetch, { enabled: o = !0, platform: n = "mcp", sessionId: a = Pe() } = t;
610
- return async (i, c = {}) => {
609
+ const r = e === globalThis.fetch, { enabled: o = !0, platform: n = "mcp", sessionId: i = Pe() } = t;
610
+ return async (a, c = {}) => {
611
611
  const { timeout: d, headers: l, signal: u, ...p } = c, { signal: m, cleanup: h } = Tr(u, d);
612
612
  try {
613
613
  const y = {
614
614
  ...p,
615
615
  signal: m,
616
- ...o ? { headers: yr(l, { platform: n, sessionId: a }) } : l !== void 0 ? { headers: l } : {}
616
+ ...o ? { headers: yr(l, { platform: n, sessionId: i }) } : l !== void 0 ? { headers: l } : {}
617
617
  };
618
618
  r && await vr(y);
619
- const f = await e(i, y);
619
+ const f = await e(a, y);
620
620
  return Ir(f);
621
621
  } finally {
622
622
  h();
@@ -660,27 +660,27 @@ function Pr({
660
660
  maxDelayMs: r,
661
661
  random: o = Math.random
662
662
  }) {
663
- const n = Math.min(t * 2 ** e, r), a = Math.round(o() * n);
664
- return Math.min(n, Math.max(xr, a));
663
+ const n = Math.min(t * 2 ** e, r), i = Math.round(o() * n);
664
+ return Math.min(n, Math.max(xr, i));
665
665
  }
666
666
  function _r(e) {
667
667
  return new Promise((t) => setTimeout(t, e));
668
668
  }
669
669
  async function O(e, t = {}) {
670
- const r = t.maxRetries ?? Cr, o = t.baseDelayMs ?? $r, n = t.maxDelayMs ?? Dr, a = t.random;
671
- let i;
670
+ const r = t.maxRetries ?? Cr, o = t.baseDelayMs ?? $r, n = t.maxDelayMs ?? Dr, i = t.random;
671
+ let a;
672
672
  for (let c = 0; c <= r; c++)
673
673
  try {
674
674
  return await e();
675
675
  } catch (d) {
676
- if (i = d, c < r && Or(d)) {
677
- const l = Pr({ attempt: c, baseDelayMs: o, maxDelayMs: n, random: a });
676
+ if (a = d, c < r && Or(d)) {
677
+ const l = Pr({ attempt: c, baseDelayMs: o, maxDelayMs: n, random: i });
678
678
  await _r(l);
679
679
  continue;
680
680
  }
681
681
  throw d;
682
682
  }
683
- throw i;
683
+ throw a;
684
684
  }
685
685
  function ze(e) {
686
686
  if (e == null)
@@ -775,11 +775,11 @@ function Ur({
775
775
  structuredContent: t,
776
776
  contentItems: r
777
777
  }) {
778
- const o = ze(t), n = {}, a = [];
779
- return r && a.push(...r), !Rr && t && a.push({
778
+ const o = ze(t), n = {}, i = [];
779
+ return r && i.push(...r), !Rr && t && i.push({
780
780
  type: "text",
781
781
  text: JSON.stringify(o)
782
- }), e && a.push({ type: "text", text: e }), a.length > 0 && (n.content = a), t && (n.structuredContent = o), n;
782
+ }), e && i.push({ type: "text", text: e }), i.length > 0 && (n.content = i), t && (n.structuredContent = o), n;
783
783
  }
784
784
  function Lr(e) {
785
785
  return {
@@ -834,11 +834,11 @@ function Kr({
834
834
  client: r,
835
835
  features: o = []
836
836
  }) {
837
- const n = o.some((d) => d.name === "strip_emails") && Br.includes(e.name), a = e.execute, i = async (d, l) => {
837
+ const n = o.some((d) => d.name === "strip_emails") && Br.includes(e.name), i = e.execute, a = async (d, l) => {
838
838
  try {
839
839
  let { textContent: u, structuredContent: p, contentItems: m } = await br(
840
840
  e.name,
841
- () => O(() => a(d, r))
841
+ () => O(() => i(d, r))
842
842
  );
843
843
  return n && (u && (u = zr(u)), p && (p = Ke(p))), Ur({ textContent: u, structuredContent: p, contentItems: m });
844
844
  } catch (u) {
@@ -859,11 +859,11 @@ function Kr({
859
859
  ...c,
860
860
  _meta: e._meta
861
861
  },
862
- i
862
+ a
863
863
  );
864
864
  return;
865
865
  }
866
- t.registerTool(e.name, c, i);
866
+ t.registerTool(e.name, c, a);
867
867
  }
868
868
  const qr = {
869
869
  period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
@@ -904,9 +904,9 @@ function Yr(e, t = /* @__PURE__ */ new Date()) {
904
904
  };
905
905
  }
906
906
  case "this-week": {
907
- const n = t.getUTCDay(), a = new Date(t);
908
- return a.setDate(t.getDate() - (n + 6) % 7), {
909
- since: r(a),
907
+ const n = t.getUTCDay(), i = new Date(t);
908
+ return i.setDate(t.getDate() - (n + 6) % 7), {
909
+ since: r(i),
910
910
  until: o,
911
911
  periodDescription: "this week (Monday to today)"
912
912
  };
@@ -1019,23 +1019,23 @@ function Xt(e) {
1019
1019
  if (!r || !r[1] && !r[2])
1020
1020
  throw new _(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
1021
1021
  let o = 0;
1022
- const [, n, a] = r;
1022
+ const [, n, i] = r;
1023
1023
  if (n) {
1024
- const i = Number.parseFloat(n);
1025
- if (Number.isNaN(i) || i < 0)
1024
+ const a = Number.parseFloat(n);
1025
+ if (Number.isNaN(a) || a < 0)
1026
1026
  throw new _(e, "Hours must be a positive number");
1027
- o += i * 60;
1027
+ o += a * 60;
1028
1028
  }
1029
- if (a) {
1030
- const i = Number.parseFloat(a);
1031
- if (Number.isNaN(i) || i < 0)
1029
+ if (i) {
1030
+ const a = Number.parseFloat(i);
1031
+ if (Number.isNaN(a) || a < 0)
1032
1032
  throw new _(e, "Minutes must be a positive number");
1033
- if (i % 1 !== 0)
1033
+ if (a % 1 !== 0)
1034
1034
  throw new _(
1035
1035
  e,
1036
1036
  "Minutes must be a whole number (use decimal hours instead)"
1037
1037
  );
1038
- o += i;
1038
+ o += a;
1039
1039
  }
1040
1040
  if (o = Math.round(o), o === 0)
1041
1041
  throw new _(e, "Duration must be greater than 0 minutes");
@@ -1118,9 +1118,9 @@ class ro {
1118
1118
  }
1119
1119
  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))
1120
1120
  return { userId: o, displayName: o, email: o };
1121
- const n = await this.getCacheScope(t), a = this.getCacheKey(n, `user_${o}`), i = a ? Ae.get(a) : void 0;
1122
- if (i !== void 0) return i;
1123
- const c = (d) => (a && Ae.set(a, d), d);
1121
+ const n = await this.getCacheScope(t), i = this.getCacheKey(n, `user_${o}`), a = i ? Ae.get(i) : void 0;
1122
+ if (a !== void 0) return a;
1123
+ const c = (d) => (i && Ae.set(i, d), d);
1124
1124
  try {
1125
1125
  let d = await this.getAllCollaborators(t, n);
1126
1126
  try {
@@ -1169,7 +1169,7 @@ class ro {
1169
1169
  */
1170
1170
  async validateProjectCollaborator(t, r, o) {
1171
1171
  try {
1172
- return (await this.getProjectCollaborators(t, r)).some((a) => a.id === o);
1172
+ return (await this.getProjectCollaborators(t, r)).some((i) => i.id === o);
1173
1173
  } catch {
1174
1174
  return !1;
1175
1175
  }
@@ -1178,11 +1178,11 @@ class ro {
1178
1178
  * Get collaborators for a specific project
1179
1179
  */
1180
1180
  async getProjectCollaborators(t, r, o) {
1181
- const n = o === void 0 ? await this.getCacheScope(t) : o, a = this.getCacheKey(n, `project_${r}`), i = a ? oe.get(a) : void 0;
1182
- if (i !== void 0) return i;
1181
+ const n = o === void 0 ? await this.getCacheScope(t) : o, i = this.getCacheKey(n, `project_${r}`), a = i ? oe.get(i) : void 0;
1182
+ if (a !== void 0) return a;
1183
1183
  try {
1184
1184
  const c = await t.getProjectCollaborators(r), l = (Array.isArray(c) ? c : c.results || []).filter((u) => u?.id && u.name && u.email);
1185
- return a && oe.set(a, l), l;
1185
+ return i && oe.set(i, l), l;
1186
1186
  } catch {
1187
1187
  return [];
1188
1188
  }
@@ -1191,8 +1191,8 @@ class ro {
1191
1191
  * Get all collaborators from all shared projects, deduplicated by user ID.
1192
1192
  */
1193
1193
  async getAllCollaborators(t, r) {
1194
- const o = r === void 0 ? await this.getCacheScope(t) : r, n = this.getCacheKey(o, "all_collaborators"), a = n ? oe.get(n) : void 0;
1195
- if (a !== void 0) return a;
1194
+ const o = r === void 0 ? await this.getCacheScope(t) : r, n = this.getCacheKey(o, "all_collaborators"), i = n ? oe.get(n) : void 0;
1195
+ if (i !== void 0) return i;
1196
1196
  try {
1197
1197
  const c = (await M({
1198
1198
  apiMethod: t.getProjects.bind(t),
@@ -1278,15 +1278,15 @@ async function de(e) {
1278
1278
  }
1279
1279
  async function M(e) {
1280
1280
  const { apiMethod: t, args: r, limit: o = 100 } = e, n = [];
1281
- let a = null;
1281
+ let i = null;
1282
1282
  do {
1283
- const i = await t({
1283
+ const a = await t({
1284
1284
  ...r,
1285
- cursor: a,
1285
+ cursor: i,
1286
1286
  limit: o
1287
1287
  });
1288
- n.push(...i.results), a = i.nextCursor ?? null;
1289
- } while (a !== null);
1288
+ n.push(...a.results), i = a.nextCursor ?? null;
1289
+ } while (i !== null);
1290
1290
  return n;
1291
1291
  }
1292
1292
  function et(e) {
@@ -1306,19 +1306,19 @@ async function os(e) {
1306
1306
  limit: C.PROJECTS_MAX
1307
1307
  });
1308
1308
  }
1309
- async function ao(e) {
1309
+ async function io(e) {
1310
1310
  return M({
1311
1311
  apiMethod: e.getArchivedProjects.bind(e),
1312
1312
  args: {},
1313
1313
  limit: C.PROJECTS_MAX
1314
1314
  });
1315
1315
  }
1316
- function io(e) {
1317
- const t = (a) => a.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = /(?<!\\)(?:\\\\)*\*/.test(e), o = [...e];
1316
+ function ao(e) {
1317
+ const t = (i) => i.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = /(?<!\\)(?:\\\\)*\*/.test(e), o = [...e];
1318
1318
  let n = "";
1319
- for (let a = 0; a < o.length; a++) {
1320
- const i = o[a];
1321
- i === "\\" && o[a + 1] === "\\" ? (n += "\\\\", a++) : i === "\\" && o[a + 1] === "*" ? (n += "\\*", a++) : i === "*" ? n += ".*" : n += t(i);
1319
+ for (let i = 0; i < o.length; i++) {
1320
+ const a = o[i];
1321
+ a === "\\" && o[i + 1] === "\\" ? (n += "\\\\", i++) : a === "\\" && o[i + 1] === "*" ? (n += "\\*", i++) : a === "*" ? n += ".*" : n += t(a);
1322
1322
  }
1323
1323
  return new RegExp(r ? `^${n}$` : n, "iu");
1324
1324
  }
@@ -1434,15 +1434,15 @@ async function tt({
1434
1434
  cursor: o
1435
1435
  }) {
1436
1436
  try {
1437
- const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1438
- return { tasks: n.map(P), nextCursor: a };
1437
+ const { results: n, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1438
+ return { tasks: n.map(P), nextCursor: i };
1439
1439
  } catch (n) {
1440
- const a = mo.safeParse(n);
1441
- if (!a.success)
1440
+ const i = mo.safeParse(n);
1441
+ if (!i.success)
1442
1442
  throw n;
1443
- const { responseData: i } = a.data;
1444
- throw i.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1445
- `${i.error} (tag: ${i.errorTag}, code: ${i.errorCode})`
1443
+ const { responseData: a } = i.data;
1444
+ throw a.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1445
+ `${a.error} (tag: ${a.errorTag}, code: ${a.errorCode})`
1446
1446
  );
1447
1447
  }
1448
1448
  }
@@ -1635,7 +1635,7 @@ const bo = s.object({
1635
1635
  `Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
1636
1636
  );
1637
1637
  }
1638
- const n = r.some((l) => N(l.projectId)) ? await t.getUser() : void 0, a = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1638
+ const n = r.some((l) => N(l.projectId)) ? await t.getUser() : void 0, i = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1639
1639
  const m = await de({
1640
1640
  projectId: p,
1641
1641
  user: n,
@@ -1645,7 +1645,7 @@ const bo = s.object({
1645
1645
  content: l,
1646
1646
  ...u ? { taskId: u } : { projectId: m }
1647
1647
  });
1648
- }), c = (await Promise.all(a)).map(ge);
1648
+ }), c = (await Promise.all(i)).map(ge);
1649
1649
  return {
1650
1650
  textContent: So({ comments: c }),
1651
1651
  structuredContent: {
@@ -1657,14 +1657,14 @@ const bo = s.object({
1657
1657
  }
1658
1658
  };
1659
1659
  function So({ comments: e }) {
1660
- const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
1660
+ const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
1661
1661
  if (t > 0) {
1662
- const a = t > 1 ? "comments" : "comment";
1663
- o.push(`${t} task ${a}`);
1662
+ const i = t > 1 ? "comments" : "comment";
1663
+ o.push(`${t} task ${i}`);
1664
1664
  }
1665
1665
  if (r > 0) {
1666
- const a = r > 1 ? "comments" : "comment";
1667
- o.push(`${r} project ${a}`);
1666
+ const i = r > 1 ? "comments" : "comment";
1667
+ o.push(`${r} project ${i}`);
1668
1668
  }
1669
1669
  return o.length > 0 ? `Added ${o.join(" and ")}` : "No comments added";
1670
1670
  }
@@ -1689,19 +1689,19 @@ const jo = {
1689
1689
  outputSchema: Co,
1690
1690
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
1691
1691
  async execute(e, t) {
1692
- let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((i) => !i.isDeleted);
1692
+ let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((a) => !a.isDeleted);
1693
1693
  if (e.search) {
1694
- const i = e.search.toLowerCase();
1695
- o = o.filter((c) => c.name.toLowerCase().includes(i));
1694
+ const a = e.search.toLowerCase();
1695
+ o = o.filter((c) => c.name.toLowerCase().includes(a));
1696
1696
  }
1697
- o.sort((i, c) => i.itemOrder - c.itemOrder);
1698
- const n = o.map((i) => ({
1699
- id: i.id,
1700
- name: i.name,
1701
- query: i.query,
1702
- color: ue.parse(i.color),
1703
- isFavorite: i.isFavorite,
1704
- itemOrder: i.itemOrder
1697
+ o.sort((a, c) => a.itemOrder - c.itemOrder);
1698
+ const n = o.map((a) => ({
1699
+ id: a.id,
1700
+ name: a.name,
1701
+ query: a.query,
1702
+ color: ue.parse(a.color),
1703
+ isFavorite: a.isFavorite,
1704
+ itemOrder: a.itemOrder
1705
1705
  }));
1706
1706
  return {
1707
1707
  textContent: Do({ filters: n, search: e.search }),
@@ -1722,13 +1722,13 @@ function Do({
1722
1722
  return `${r}: 0 found
1723
1723
 
1724
1724
  Suggestions:
1725
- ${n.map((a) => `- ${a}`).join(`
1725
+ ${n.map((i) => `- ${i}`).join(`
1726
1726
  `)}`;
1727
1727
  }
1728
1728
  const o = [`${r}: ${e.length} found`, ""];
1729
1729
  for (const n of e) {
1730
- const a = n.isFavorite ? " ★" : "";
1731
- o.push(`• ${n.name}${a} (id=${n.id})`), o.push(` Query: ${n.query}`);
1730
+ const i = n.isFavorite ? " ★" : "";
1731
+ o.push(`• ${n.name}${i} (id=${n.id})`), o.push(` Query: ${n.query}`);
1732
1732
  }
1733
1733
  return o.join(`
1734
1734
  `);
@@ -1761,8 +1761,8 @@ const xo = s.object({
1761
1761
  ...p.isFavorite !== void 0 ? { isFavorite: p.isFavorite } : {}
1762
1762
  },
1763
1763
  o[m]
1764
- )), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1765
- const h = o[m], y = h !== void 0 ? i[h] : void 0;
1764
+ )), a = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1765
+ const h = o[m], y = h !== void 0 ? a[h] : void 0;
1766
1766
  if (!y) return null;
1767
1767
  const f = p.color !== void 0 ? ue.parse(p.color) : void 0;
1768
1768
  return {
@@ -1817,32 +1817,32 @@ function Lo({ labels: e }) {
1817
1817
  return `Added ${t} label${t === 1 ? "" : "s"}:
1818
1818
  ${r}`;
1819
1819
  }
1820
- function ie(e = /* @__PURE__ */ new Date()) {
1820
+ function ae(e = /* @__PURE__ */ new Date()) {
1821
1821
  const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
1822
1822
  return `${t}-${r}-${o}`;
1823
1823
  }
1824
1824
  function ot(e, t, r = {}) {
1825
- const { context: o, showDetails: n = !1 } = r, a = t.length, i = [], d = `${e} ${a} ${a === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1826
- i.push(d);
1825
+ const { context: o, showDetails: n = !1 } = r, i = t.length, a = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1826
+ a.push(d);
1827
1827
  const l = 5;
1828
- if (n || a <= l) {
1828
+ if (n || i <= l) {
1829
1829
  const u = Se(t, l);
1830
1830
  if (u.length > 0) {
1831
- const p = a > l ? `, +${a - l} more` : "";
1832
- i.push(`Tasks:
1831
+ const p = i > l ? `, +${i - l} more` : "";
1832
+ a.push(`Tasks:
1833
1833
  ${u}${p}.`);
1834
1834
  }
1835
1835
  }
1836
- return i.join(`
1836
+ return a.join(`
1837
1837
  `);
1838
1838
  }
1839
1839
  function nt(e) {
1840
- const { action: t, success: r, total: o, successItems: n, successLabel: a = "Completed", failures: i } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1841
- if (c.push(d), n?.length && n.length <= 5 && c.push(`${a}:
1840
+ const { action: t, success: r, total: o, successItems: n, successLabel: i = "Completed", failures: a } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1841
+ if (c.push(d), n?.length && n.length <= 5 && c.push(`${i}:
1842
1842
  ${n.map((l) => ` ${l}`).join(`
1843
- `)}.`), i?.length) {
1844
- const l = i.length, u = `Failed (${l}):
1845
- ${i.slice(0, fe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1843
+ `)}.`), a?.length) {
1844
+ const l = a.length, u = `Failed (${l}):
1845
+ ${a.slice(0, fe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1846
1846
  `
1847
1847
  `
1848
1848
  )}${l > fe.MAX_FAILURES_SHOWN ? `, +${l - fe.MAX_FAILURES_SHOWN} more` : ""}.`;
@@ -1851,27 +1851,27 @@ ${i.slice(0, fe.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
1851
1851
  return c.join(`
1852
1852
  `);
1853
1853
  }
1854
- function at(e, t) {
1854
+ function it(e, t) {
1855
1855
  if (t.length === 0)
1856
1856
  return e;
1857
- const r = t.slice(0, fe.MAX_FAILURES_SHOWN), o = t.length - r.length, n = r.map((i) => ` ${i.item}: ${i.error}`).join(`
1858
- `), a = o > 0 ? `
1857
+ const r = t.slice(0, fe.MAX_FAILURES_SHOWN), o = t.length - r.length, n = r.map((a) => ` ${a.item}: ${a.error}`).join(`
1858
+ `), i = o > 0 ? `
1859
1859
  +${o} more` : "";
1860
1860
  return `${e}
1861
1861
  Failed (${t.length}) - address or drop these items:
1862
- ${n}${a}`;
1862
+ ${n}${i}`;
1863
1863
  }
1864
1864
  function No(e) {
1865
- 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}` : "";
1866
- return ` ${t}${r}${o}${n}${a}`;
1865
+ 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}` : "";
1866
+ return ` ${t}${r}${o}${n}${i}`;
1867
1867
  }
1868
1868
  function Mo(e) {
1869
1869
  const t = ` (${e.color})`, r = e.isFavorite ? " • ⭐" : "", o = ` • id=${e.id}`;
1870
1870
  return ` ${e.name}${t}${r}${o}`;
1871
1871
  }
1872
1872
  function Fo(e) {
1873
- const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.isArchived ? " • Archived" : "", a = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
1874
- return ` ${e.name}${t}${r}${o}${n}${a}${i}`;
1873
+ const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.isArchived ? " • Archived" : "", i = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", a = ` • id=${e.id}`;
1874
+ return ` ${e.name}${t}${r}${o}${n}${i}${a}`;
1875
1875
  }
1876
1876
  function Se(e, t = 5) {
1877
1877
  const o = e.slice(0, t).map(No).join(`
@@ -1889,16 +1889,16 @@ function q({
1889
1889
  limit: r,
1890
1890
  nextCursor: o,
1891
1891
  filterHints: n,
1892
- previewLines: a,
1893
- zeroReasonHints: i,
1892
+ previewLines: i,
1893
+ zeroReasonHints: a,
1894
1894
  nextSteps: c
1895
1895
  }) {
1896
1896
  const d = [], l = `${e}: ${t}${typeof r == "number" ? ` (limit ${r})` : ""}${o ? ", more available" : ""}.`;
1897
- return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), a?.length && d.push(`Preview:
1898
- ${a}`), !t && i?.length && d.push(`No results. ${i.join("; ")}.`), (c?.length || o) && d.push(as(c || [], o)), d.join(`
1897
+ return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), i?.length && d.push(`Preview:
1898
+ ${i}`), !t && a?.length && d.push(`No results. ${a.join("; ")}.`), (c?.length || o) && d.push(is(c || [], o)), d.join(`
1899
1899
  `);
1900
1900
  }
1901
- function as(e, t) {
1901
+ function is(e, t) {
1902
1902
  const r = [...e];
1903
1903
  return t && r.push(`Pass cursor '${t}' to fetch more results.`), `${r.length === 1 ? "Possible suggested next step:" : "Possible suggested next steps:"}
1904
1904
  ${r.map((n) => `- ${n}`).join(`
@@ -1937,15 +1937,15 @@ class Bo {
1937
1937
  const o = r.trim();
1938
1938
  if (!o)
1939
1939
  throw new Error("Workspace reference cannot be empty");
1940
- const n = await this.getWorkspaces(t), a = n.find((u) => u.id === o);
1941
- if (a)
1942
- return { workspaceId: a.id, workspaceName: a.name };
1940
+ const n = await this.getWorkspaces(t), i = n.find((u) => u.id === o);
1941
+ if (i)
1942
+ return { workspaceId: i.id, workspaceName: i.name };
1943
1943
  if (Wo(o))
1944
1944
  return { workspaceId: o, workspaceName: o };
1945
- const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
1945
+ const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
1946
1946
  if (c)
1947
1947
  return { workspaceId: c.id, workspaceName: c.name };
1948
- const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
1948
+ const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
1949
1949
  if (l)
1950
1950
  return { workspaceId: l.id, workspaceName: l.name };
1951
1951
  if (d.length > 1) {
@@ -1968,7 +1968,7 @@ ${u}` + (d.length > 5 ? `
1968
1968
  this.cache = null;
1969
1969
  }
1970
1970
  }
1971
- const is = new Bo(), zo = s.object({
1971
+ const as = new Bo(), zo = s.object({
1972
1972
  name: s.string().min(1).describe("The name of the project."),
1973
1973
  parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
1974
1974
  isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
@@ -2001,7 +2001,7 @@ const is = new Bo(), zo = s.object({
2001
2001
  return Promise.resolve(void 0);
2002
2002
  let u = r.get(l);
2003
2003
  return u || (u = O(
2004
- () => is.resolveWorkspace(t, l)
2004
+ () => as.resolveWorkspace(t, l)
2005
2005
  ).then(({ workspaceId: p }) => p), r.set(l, u)), u;
2006
2006
  }, n = await Promise.allSettled(
2007
2007
  e.map(async ({ workspace: l, ...u }) => {
@@ -2010,23 +2010,23 @@ const is = new Bo(), zo = s.object({
2010
2010
  () => t.addProject({ ...u, ...p ? { workspaceId: p } : {} })
2011
2011
  );
2012
2012
  })
2013
- ), a = [], i = [];
2013
+ ), i = [], a = [];
2014
2014
  n.forEach((l, u) => {
2015
- l.status === "fulfilled" ? a.push(l.value) : i.push({
2015
+ l.status === "fulfilled" ? i.push(l.value) : a.push({
2016
2016
  item: e[u]?.name ?? `Project ${u + 1}`,
2017
2017
  error: z(l.reason)
2018
2018
  });
2019
2019
  });
2020
- const c = a.map(Z);
2020
+ const c = i.map(Z);
2021
2021
  return {
2022
- textContent: Go({ projects: a, failures: i }),
2022
+ textContent: Go({ projects: i, failures: a }),
2023
2023
  structuredContent: {
2024
2024
  projects: c,
2025
2025
  totalCount: c.length,
2026
- failures: i,
2026
+ failures: a,
2027
2027
  totalRequested: e.length,
2028
2028
  successCount: c.length,
2029
- failureCount: i.length
2029
+ failureCount: a.length
2030
2030
  }
2031
2031
  };
2032
2032
  }
@@ -2035,10 +2035,10 @@ function Go({
2035
2035
  projects: e,
2036
2036
  failures: t
2037
2037
  }) {
2038
- const r = e.length, o = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
2038
+ const r = e.length, o = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
2039
2039
  `), n = r > 0 ? `Added ${r} project${r === 1 ? "" : "s"}:
2040
2040
  ${o}` : "Added 0 projects";
2041
- return at(n, t);
2041
+ return it(n, t);
2042
2042
  }
2043
2043
  const we = 25, je = s.enum(Ms), cs = s.object({
2044
2044
  date: s.string().optional().describe("Due date in YYYY-MM-DD format."),
@@ -2120,13 +2120,13 @@ const we = 25, je = s.enum(Ms), cs = s.object({
2120
2120
  radius: c.radius
2121
2121
  });
2122
2122
  }
2123
- }), a = (await Promise.all(o)).map(be);
2123
+ }), i = (await Promise.all(o)).map(be);
2124
2124
  return {
2125
- textContent: sn(a),
2125
+ textContent: sn(i),
2126
2126
  structuredContent: {
2127
- reminders: a,
2128
- totalCount: a.length,
2129
- addedReminderIds: a.map((c) => c.id)
2127
+ reminders: i,
2128
+ totalCount: i.length,
2129
+ addedReminderIds: i.map((c) => c.id)
2130
2130
  }
2131
2131
  };
2132
2132
  }
@@ -2176,21 +2176,21 @@ const rn = s.object({
2176
2176
  }) ?? c.projectId;
2177
2177
  return O(() => t.addSection({ ...c, projectId: l }));
2178
2178
  })
2179
- ), n = [], a = [];
2179
+ ), n = [], i = [];
2180
2180
  return o.forEach((c, d) => {
2181
- c.status === "fulfilled" ? n.push(c.value) : a.push({
2181
+ c.status === "fulfilled" ? n.push(c.value) : i.push({
2182
2182
  item: e[d]?.name ?? `Section ${d + 1}`,
2183
2183
  error: z(c.reason)
2184
2184
  });
2185
2185
  }), {
2186
- textContent: cn({ sections: n, failures: a }),
2186
+ textContent: cn({ sections: n, failures: i }),
2187
2187
  structuredContent: {
2188
2188
  sections: n.map(K),
2189
2189
  totalCount: n.length,
2190
- failures: a,
2190
+ failures: i,
2191
2191
  totalRequested: e.length,
2192
2192
  successCount: n.length,
2193
- failureCount: a.length
2193
+ failureCount: i.length
2194
2194
  }
2195
2195
  };
2196
2196
  }
@@ -2199,10 +2199,10 @@ function cn({
2199
2199
  sections: e,
2200
2200
  failures: t
2201
2201
  }) {
2202
- const r = e.length, o = e.map((a) => `• ${a.name} (id=${a.id}, projectId=${a.projectId})`).join(`
2202
+ const r = e.length, o = e.map((i) => `• ${i.name} (id=${i.id}, projectId=${i.projectId})`).join(`
2203
2203
  `), n = r > 0 ? `Added ${r} section${r === 1 ? "" : "s"}:
2204
2204
  ${o}` : "Added 0 sections";
2205
- return at(n, t);
2205
+ return it(n, t);
2206
2206
  }
2207
2207
  const ne = {
2208
2208
  USER_NOT_FOUND: "USER_NOT_FOUND",
@@ -2218,15 +2218,15 @@ class dn {
2218
2218
  * Validate a single assignment operation
2219
2219
  */
2220
2220
  async validateAssignment(t, r) {
2221
- const { taskId: o, projectId: n, responsibleUid: a } = r, i = await W.resolveUser(t, a);
2222
- if (!i)
2221
+ const { taskId: o, projectId: n, responsibleUid: i } = r, a = await W.resolveUser(t, i);
2222
+ if (!a)
2223
2223
  return {
2224
2224
  isValid: !1,
2225
2225
  taskId: o,
2226
2226
  projectId: n,
2227
2227
  error: {
2228
2228
  type: ne.USER_NOT_FOUND,
2229
- message: `User "${a}" not found`,
2229
+ message: `User "${i}" not found`,
2230
2230
  suggestions: [
2231
2231
  "Check the spelling of the user name or email",
2232
2232
  "Ensure the user is a collaborator on at least one shared project",
@@ -2241,7 +2241,7 @@ class dn {
2241
2241
  isValid: !1,
2242
2242
  taskId: o,
2243
2243
  projectId: n,
2244
- resolvedUser: i,
2244
+ resolvedUser: a,
2245
2245
  error: {
2246
2246
  type: ne.PROJECT_NOT_SHARED,
2247
2247
  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.`,
@@ -2254,16 +2254,16 @@ class dn {
2254
2254
  if (!await W.validateProjectCollaborator(
2255
2255
  t,
2256
2256
  n,
2257
- i.userId
2257
+ a.userId
2258
2258
  ))
2259
2259
  return {
2260
2260
  isValid: !1,
2261
2261
  taskId: o,
2262
2262
  projectId: n,
2263
- resolvedUser: i,
2263
+ resolvedUser: a,
2264
2264
  error: {
2265
2265
  type: ne.USER_NOT_COLLABORATOR,
2266
- message: `User "${i.displayName}" is not a collaborator on project "${c.name}"`,
2266
+ message: `User "${a.displayName}" is not a collaborator on project "${c.name}"`,
2267
2267
  suggestions: [
2268
2268
  "Invite the user to collaborate on this project first",
2269
2269
  "Check if the user has been removed from the project",
@@ -2279,7 +2279,7 @@ class dn {
2279
2279
  isValid: !1,
2280
2280
  taskId: o,
2281
2281
  projectId: n,
2282
- resolvedUser: i,
2282
+ resolvedUser: a,
2283
2283
  error: {
2284
2284
  type: ne.TASK_NOT_FOUND,
2285
2285
  message: `Task "${o}" not found or not accessible`,
@@ -2295,14 +2295,14 @@ class dn {
2295
2295
  isValid: !0,
2296
2296
  taskId: o,
2297
2297
  projectId: n,
2298
- resolvedUser: i
2298
+ resolvedUser: a
2299
2299
  };
2300
2300
  } catch {
2301
2301
  return {
2302
2302
  isValid: !1,
2303
2303
  taskId: o,
2304
2304
  projectId: n,
2305
- resolvedUser: i,
2305
+ resolvedUser: a,
2306
2306
  error: {
2307
2307
  type: ne.PERMISSION_DENIED,
2308
2308
  message: "Permission denied or API error occurred",
@@ -2369,8 +2369,8 @@ class dn {
2369
2369
  * Get detailed assignment eligibility information for troubleshooting
2370
2370
  */
2371
2371
  async getAssignmentEligibility(t, r, o, n) {
2372
- const a = [];
2373
- let i = !1, c;
2372
+ const i = [];
2373
+ let a = !1, c;
2374
2374
  try {
2375
2375
  c = await t.getProject(r);
2376
2376
  } catch {
@@ -2390,18 +2390,18 @@ class dn {
2390
2390
  collaboratorCount: d.length
2391
2391
  };
2392
2392
  if (!c.isShared)
2393
- return a.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: a };
2393
+ return i.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: i };
2394
2394
  const u = await W.resolveUser(t, o);
2395
2395
  if (!u)
2396
- return a.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: a };
2396
+ return i.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: i };
2397
2397
  const p = d.some((y) => y.id === u.userId), m = {
2398
2398
  resolvedName: u.displayName,
2399
2399
  isCollaborator: p
2400
2400
  };
2401
2401
  if (!p)
2402
- return a.push(
2402
+ return i.push(
2403
2403
  `Invite ${u.displayName} to collaborate on project "${c.name}"`
2404
- ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: a };
2404
+ ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: i };
2405
2405
  let h;
2406
2406
  if (n && n.length > 0) {
2407
2407
  let y = 0, f = 0;
@@ -2411,18 +2411,18 @@ class dn {
2411
2411
  } catch {
2412
2412
  f++;
2413
2413
  }
2414
- h = { accessibleTasks: y, inaccessibleTasks: f }, f > 0 && a.push(`${f} task(s) are not accessible`);
2414
+ h = { accessibleTasks: y, inaccessibleTasks: f }, f > 0 && i.push(`${f} task(s) are not accessible`);
2415
2415
  }
2416
- return i = !0, a.push(`Ready to assign tasks to ${u.displayName}`), {
2417
- canAssign: i,
2416
+ return a = !0, i.push(`Ready to assign tasks to ${u.displayName}`), {
2417
+ canAssign: a,
2418
2418
  projectInfo: l,
2419
2419
  userInfo: m,
2420
2420
  taskInfo: h,
2421
- recommendations: a
2421
+ recommendations: i
2422
2422
  };
2423
2423
  }
2424
2424
  }
2425
- const it = new dn();
2425
+ const at = new dn();
2426
2426
  function U(e) {
2427
2427
  return s.string().transform((t) => t === "" ? void 0 : t).optional().describe(e);
2428
2428
  }
@@ -2477,7 +2477,7 @@ const Tt = Kt.TASKS_PER_OPERATION, ln = s.object({
2477
2477
  const y = mn(m), f = o.get(y);
2478
2478
  f ? f.push({ task: m, index: h }) : o.set(y, [{ task: m, index: h }]);
2479
2479
  });
2480
- const n = /* @__PURE__ */ new Map(), i = (await Promise.all(
2480
+ const n = /* @__PURE__ */ new Map(), a = (await Promise.all(
2481
2481
  [...o.values()].map(async (m) => {
2482
2482
  const h = [];
2483
2483
  for (const { task: y, index: f } of m)
@@ -2494,7 +2494,7 @@ const Tt = Kt.TASKS_PER_OPERATION, ln = s.object({
2494
2494
  })
2495
2495
  )).flat().sort((m, h) => m.index - h.index), c = [], d = [];
2496
2496
  let l = !1;
2497
- for (const { index: m, result: h } of i)
2497
+ for (const { index: m, result: h } of a)
2498
2498
  h.status === "fulfilled" ? c.push(h.value) : (l ||= h.reason instanceof ve, d.push({
2499
2499
  item: r[m]?.content ?? `Task ${m + 1}`,
2500
2500
  // Keep API error signals (status/code/tag) — `error.message`
@@ -2531,8 +2531,8 @@ async function hn(e, t, r) {
2531
2531
  const {
2532
2532
  duration: o,
2533
2533
  projectId: n,
2534
- sectionId: a,
2535
- parentId: i,
2534
+ sectionId: i,
2535
+ parentId: a,
2536
2536
  order: c,
2537
2537
  responsibleUser: d,
2538
2538
  priority: l,
@@ -2550,13 +2550,13 @@ async function hn(e, t, r) {
2550
2550
  let y = {
2551
2551
  ...m,
2552
2552
  projectId: h,
2553
- sectionId: a,
2554
- parentId: i,
2553
+ sectionId: i,
2554
+ parentId: a,
2555
2555
  order: c,
2556
2556
  labels: u,
2557
2557
  deadlineDate: p
2558
2558
  };
2559
- if (l && (y.priority = Zt(l)), d && !h && !a && !i)
2559
+ if (l && (y.priority = Zt(l)), d && !h && !i && !a)
2560
2560
  throw new Error(
2561
2561
  `Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
2562
2562
  );
@@ -2573,23 +2573,23 @@ async function hn(e, t, r) {
2573
2573
  }
2574
2574
  if (d) {
2575
2575
  let f = h;
2576
- if (!f && i)
2576
+ if (!f && a)
2577
2577
  try {
2578
- f = (await t.getTask(i)).projectId;
2578
+ f = (await t.getTask(a)).projectId;
2579
2579
  } catch {
2580
- throw new Error(`Task "${e.content}": Parent task "${i}" not found`);
2580
+ throw new Error(`Task "${e.content}": Parent task "${a}" not found`);
2581
2581
  }
2582
- else if (!f && a && (f = r.get(a), !f)) {
2583
- const j = await t.getSection(a);
2582
+ else if (!f && i && (f = r.get(i), !f)) {
2583
+ const j = await t.getSection(i);
2584
2584
  if (!j)
2585
- throw new Error(`Task "${e.content}": Section "${a}" not found`);
2586
- f = j.projectId, r.set(a, j.projectId);
2585
+ throw new Error(`Task "${e.content}": Section "${i}" not found`);
2586
+ f = j.projectId, r.set(i, j.projectId);
2587
2587
  }
2588
2588
  if (!f)
2589
2589
  throw new Error(
2590
2590
  `Task "${e.content}": Cannot determine target project for assignment validation`
2591
2591
  );
2592
- const v = await it.validateTaskCreationAssignment(
2592
+ const v = await at.validateTaskCreationAssignment(
2593
2593
  t,
2594
2594
  f,
2595
2595
  d
@@ -2619,18 +2619,18 @@ function fn({
2619
2619
  args: r
2620
2620
  }) {
2621
2621
  const o = /* @__PURE__ */ new Set();
2622
- for (const a of r.tasks)
2623
- a.projectId && !N(a.projectId) ? o.add("projects") : a.sectionId ? o.add("sections") : a.parentId ? o.add("subtasks") : o.add("inbox");
2622
+ for (const i of r.tasks)
2623
+ i.projectId && !N(i.projectId) ? o.add("projects") : i.sectionId ? o.add("sections") : i.parentId ? o.add("subtasks") : o.add("inbox");
2624
2624
  let n = "";
2625
2625
  if (o.size === 1) {
2626
- const a = Array.from(o)[0];
2627
- n = a === "inbox" ? "" : `to ${a}`;
2626
+ const i = Array.from(o)[0];
2627
+ n = i === "inbox" ? "" : `to ${i}`;
2628
2628
  } else o.size > 1 && (n = "to multiple contexts");
2629
2629
  return t.length > 0 ? nt({
2630
2630
  action: `Added tasks${n ? ` ${n}` : ""}`,
2631
2631
  success: e.length,
2632
2632
  total: r.tasks.length,
2633
- successItems: e.map((a) => a.content ?? "Untitled"),
2633
+ successItems: e.map((i) => i.content ?? "Untitled"),
2634
2634
  successLabel: "Created",
2635
2635
  failures: t
2636
2636
  }) : ot("Added", e, {
@@ -2693,13 +2693,13 @@ ${n}`,
2693
2693
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
2694
2694
  async execute(e, t) {
2695
2695
  const r = [], o = [];
2696
- for (const a of e.ids)
2696
+ for (const i of e.ids)
2697
2697
  try {
2698
- await t.closeTask(a), r.push(a);
2699
- } catch (i) {
2700
- const c = i instanceof Error ? i.message : "Unknown error";
2698
+ await t.closeTask(i), r.push(i);
2699
+ } catch (a) {
2700
+ const c = a instanceof Error ? a.message : "Unknown error";
2701
2701
  o.push({
2702
- item: a,
2702
+ item: i,
2703
2703
  error: c
2704
2704
  });
2705
2705
  }
@@ -2823,23 +2823,23 @@ const ls = [
2823
2823
  // execute() with raw JSON, so schema defaults are not applied on that path.
2824
2824
  async execute({ projectId: e, format: t = "file", useRelativeDates: r }, o) {
2825
2825
  if (t === "url") {
2826
- const { fileName: i, fileUrl: c } = await o.exportTemplateAsUrl({
2826
+ const { fileName: a, fileUrl: c } = await o.exportTemplateAsUrl({
2827
2827
  projectId: e,
2828
2828
  useRelativeDates: r
2829
2829
  });
2830
2830
  return {
2831
- textContent: `Exported project (id=${e}) as template URL: ${i}
2831
+ textContent: `Exported project (id=${e}) as template URL: ${a}
2832
2832
  ${c}`,
2833
- structuredContent: { format: t, fileName: i, fileUrl: c }
2833
+ structuredContent: { format: t, fileName: a, fileUrl: c }
2834
2834
  };
2835
2835
  }
2836
- const n = await o.exportTemplateAsFile({ projectId: e, useRelativeDates: r }), a = n.split(`
2837
- `).filter((i) => i.trim().length > 0);
2836
+ const n = await o.exportTemplateAsFile({ projectId: e, useRelativeDates: r }), i = n.split(`
2837
+ `).filter((a) => a.trim().length > 0);
2838
2838
  return {
2839
2839
  // The full CSV already ships in structuredContent; a preview here keeps a large
2840
2840
  // project from being spelled out twice in the response.
2841
- textContent: xn({ projectId: e, lines: a }),
2842
- structuredContent: { format: t, content: n, lineCount: a.length }
2841
+ textContent: xn({ projectId: e, lines: i }),
2842
+ structuredContent: { format: t, content: n, lineCount: i.length }
2843
2843
  };
2844
2844
  }
2845
2845
  };
@@ -2885,42 +2885,42 @@ async function Pn(e, t) {
2885
2885
  parentId: t,
2886
2886
  limit: C.CHILDREN_MAX
2887
2887
  }), n = await Promise.allSettled(
2888
- r.map(({ id: i }) => e.getTasks({ parentId: i, limit: 1 }))
2889
- ), a = n.filter((i) => i.status === "rejected").length;
2888
+ r.map(({ id: a }) => e.getTasks({ parentId: a, limit: 1 }))
2889
+ ), i = n.filter((a) => a.status === "rejected").length;
2890
2890
  return {
2891
2891
  childCount: r.length,
2892
- children: r.map((i, c) => {
2892
+ children: r.map((a, c) => {
2893
2893
  const d = n[c];
2894
2894
  return {
2895
- id: i.id,
2896
- content: i.content,
2897
- dueDate: i.due?.date,
2898
- checked: i.checked,
2895
+ id: a.id,
2896
+ content: a.content,
2897
+ dueDate: a.due?.date,
2898
+ checked: a.checked,
2899
2899
  hasChildren: d?.status === "fulfilled" && d.value.results.length > 0
2900
2900
  };
2901
2901
  }),
2902
2902
  hasMoreChildren: o ? !0 : void 0,
2903
- childrenError: a ? `Could not check ${a} of ${r.length} subtasks for subtasks of their own; those are reported as hasChildren=false.` : void 0
2903
+ childrenError: i ? `Could not check ${i} of ${r.length} subtasks for subtasks of their own; those are reported as hasChildren=false.` : void 0
2904
2904
  };
2905
2905
  }
2906
2906
  async function _n(e, t) {
2907
2907
  if (!B(t))
2908
2908
  return { childCount: 0, children: [] };
2909
2909
  const r = await os(e), o = /* @__PURE__ */ new Map();
2910
- for (const i of r) {
2911
- if (!B(i) || !i.parentId) continue;
2912
- const c = o.get(i.parentId) ?? [];
2913
- c.push(i), o.set(i.parentId, c);
2910
+ for (const a of r) {
2911
+ if (!B(a) || !a.parentId) continue;
2912
+ const c = o.get(a.parentId) ?? [];
2913
+ c.push(a), o.set(a.parentId, c);
2914
2914
  }
2915
- const n = [...o.get(t.id) ?? []].sort((i, c) => i.childOrder - c.childOrder), a = n.slice(0, C.CHILDREN_MAX);
2915
+ const n = [...o.get(t.id) ?? []].sort((a, c) => a.childOrder - c.childOrder), i = n.slice(0, C.CHILDREN_MAX);
2916
2916
  return {
2917
- childCount: a.length,
2918
- children: a.map((i) => ({
2919
- id: i.id,
2920
- name: i.name,
2921
- hasChildren: (o.get(i.id)?.length ?? 0) > 0
2917
+ childCount: i.length,
2918
+ children: i.map((a) => ({
2919
+ id: a.id,
2920
+ name: a.name,
2921
+ hasChildren: (o.get(a.id)?.length ?? 0) > 0
2922
2922
  })),
2923
- hasMoreChildren: n.length > a.length ? !0 : void 0
2923
+ hasMoreChildren: n.length > i.length ? !0 : void 0
2924
2924
  };
2925
2925
  }
2926
2926
  async function vt(e) {
@@ -2958,61 +2958,61 @@ const ps = ["task", "project", "comment", "section"], Rn = {
2958
2958
  try {
2959
2959
  switch (r) {
2960
2960
  case "task": {
2961
- const [a, i] = await Promise.all([
2961
+ const [i, a] = await Promise.all([
2962
2962
  t.getTask(o),
2963
2963
  n ? vt(() => Pn(t, o)) : Promise.resolve({})
2964
- ]), c = P(a);
2964
+ ]), c = P(i);
2965
2965
  return {
2966
- textContent: `Found task: ${c.content} • id=${c.id} • priority=${c.priority} • project=${c.projectId}${It("subtasks", i)}`,
2966
+ textContent: `Found task: ${c.content} • id=${c.id} • priority=${c.priority} • project=${c.projectId}${It("subtasks", a)}`,
2967
2967
  structuredContent: {
2968
2968
  type: r,
2969
2969
  id: o,
2970
2970
  object: c,
2971
- ...i
2971
+ ...a
2972
2972
  }
2973
2973
  };
2974
2974
  }
2975
2975
  case "project": {
2976
- const a = await t.getProject(o), i = Z(a), c = n ? await vt(() => _n(t, a)) : {};
2976
+ const i = await t.getProject(o), a = Z(i), c = n ? await vt(() => _n(t, i)) : {};
2977
2977
  return {
2978
- textContent: `Found project: ${i.name} • id=${i.id} • color=${i.color} • viewStyle=${i.viewStyle}${It("subProjects", c)}`,
2978
+ textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color} • viewStyle=${a.viewStyle}${It("subProjects", c)}`,
2979
2979
  structuredContent: {
2980
2980
  type: r,
2981
2981
  id: o,
2982
- object: i,
2982
+ object: a,
2983
2983
  ...c
2984
2984
  }
2985
2985
  };
2986
2986
  }
2987
2987
  case "comment": {
2988
- const a = await t.getComment(o), i = ge(a), c = i.content.length > 50 ? `${i.content.substring(0, 50)}...` : i.content;
2988
+ const i = await t.getComment(o), a = ge(i), c = a.content.length > 50 ? `${a.content.substring(0, 50)}...` : a.content;
2989
2989
  return {
2990
- textContent: `Found comment • id=${i.id} • content="${c}" • posted=${i.postedAt}`,
2990
+ textContent: `Found comment • id=${a.id} • content="${c}" • posted=${a.postedAt}`,
2991
2991
  structuredContent: {
2992
2992
  type: r,
2993
2993
  id: o,
2994
- object: i
2994
+ object: a
2995
2995
  }
2996
2996
  };
2997
2997
  }
2998
2998
  case "section": {
2999
- const a = await t.getSection(o);
3000
- if (!a)
2999
+ const i = await t.getSection(o);
3000
+ if (!i)
3001
3001
  throw new Error(`Section ${o} not found.`);
3002
- const i = K(a);
3002
+ const a = K(i);
3003
3003
  return {
3004
- textContent: `Found section: ${i.name} • id=${i.id}`,
3004
+ textContent: `Found section: ${a.name} • id=${a.id}`,
3005
3005
  structuredContent: {
3006
3006
  type: r,
3007
3007
  id: o,
3008
- object: i
3008
+ object: a
3009
3009
  }
3010
3010
  };
3011
3011
  }
3012
3012
  }
3013
- } catch (a) {
3013
+ } catch (i) {
3014
3014
  throw new Error(
3015
- `Failed to fetch ${r} with id ${o}: ${a instanceof Error ? a.message : String(a)}`
3015
+ `Failed to fetch ${r} with id ${o}: ${i instanceof Error ? i.message : String(i)}`
3016
3016
  );
3017
3017
  }
3018
3018
  }
@@ -3038,14 +3038,14 @@ const ps = ["task", "project", "comment", "section"], Rn = {
3038
3038
  throw new Error(
3039
3039
  'Invalid ID format. Expected "task:{id}" or "project:{id}". Example: "task:8485093748" or "project:6cfCcrrCFg2xP94Q"'
3040
3040
  );
3041
- let a;
3041
+ let i;
3042
3042
  if (o === "task") {
3043
- const i = await t.getTask(n), c = P(i), d = [c.content];
3043
+ const a = await t.getTask(n), c = P(a), d = [c.content];
3044
3044
  c.description && d.push(`
3045
3045
 
3046
3046
  Description: ${c.description}`), c.dueDate && d.push(`
3047
3047
  Due: ${c.dueDate}`), c.labels.length > 0 && d.push(`
3048
- Labels: ${c.labels.join(", ")}`), a = {
3048
+ Labels: ${c.labels.join(", ")}`), i = {
3049
3049
  id: `task:${c.id}`,
3050
3050
  title: c.content,
3051
3051
  text: d.join(""),
@@ -3064,13 +3064,13 @@ Labels: ${c.labels.join(", ")}`), a = {
3064
3064
  }
3065
3065
  };
3066
3066
  } else {
3067
- const i = await t.getProject(n), c = Z(i), d = [c.name];
3067
+ const a = await t.getProject(n), c = Z(a), d = [c.name];
3068
3068
  c.description && d.push(`
3069
3069
 
3070
3070
  Description: ${c.description}`), c.isShared && d.push(`
3071
3071
 
3072
3072
  Shared project`), c.isFavorite && d.push(`
3073
- Favorite: Yes`), a = {
3073
+ Favorite: Yes`), i = {
3074
3074
  id: `project:${c.id}`,
3075
3075
  title: c.name,
3076
3076
  text: d.join(""),
@@ -3086,8 +3086,8 @@ Favorite: Yes`), a = {
3086
3086
  };
3087
3087
  }
3088
3088
  return {
3089
- textContent: JSON.stringify(a),
3090
- structuredContent: a
3089
+ textContent: JSON.stringify(i),
3090
+ structuredContent: i
3091
3091
  };
3092
3092
  }
3093
3093
  }, Hn = s.union([s.iso.date(), s.iso.datetime({ offset: !0 })]);
@@ -3136,8 +3136,8 @@ const Wn = {
3136
3136
  objectType: r,
3137
3137
  objectId: o,
3138
3138
  eventType: n,
3139
- projectId: a,
3140
- taskId: i,
3139
+ projectId: i,
3140
+ taskId: a,
3141
3141
  initiatorId: c,
3142
3142
  dateFrom: d,
3143
3143
  dateTo: l,
@@ -3147,7 +3147,7 @@ const Wn = {
3147
3147
  limit: u,
3148
3148
  cursor: p ?? null
3149
3149
  };
3150
- r && n ? m.objectEventTypes = `${r}:${n}` : r ? m.objectEventTypes = `${r}:` : n && (m.objectEventTypes = `:${n}`), o && o !== "remove" && (m.objectId = o), a && (m.parentProjectId = a), i && (m.parentItemId = i), c && (m.initiatorId = c), d && (m.dateFrom = d), l && (m.dateTo = l);
3150
+ r && n ? m.objectEventTypes = `${r}:${n}` : r ? m.objectEventTypes = `${r}:` : n && (m.objectEventTypes = `:${n}`), o && o !== "remove" && (m.objectId = o), i && (m.parentProjectId = i), a && (m.parentItemId = a), c && (m.initiatorId = c), d && (m.dateFrom = d), l && (m.dateTo = l);
3151
3151
  const { results: h, nextCursor: y } = await t.getActivityLogs(m), f = h.map(po);
3152
3152
  return {
3153
3153
  textContent: Kn({ events: f, args: e, nextCursor: y }),
@@ -3173,17 +3173,17 @@ function Kn({
3173
3173
  n.push(c);
3174
3174
  }
3175
3175
  n.length > 0 && (o = `Activity: ${n.join(" ")}`);
3176
- const a = [];
3177
- 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}`), t.dateFrom && a.push(`from: ${t.dateFrom}`), t.dateTo && a.push(`until (exclusive): ${t.dateTo}`);
3178
3176
  const i = [];
3179
- 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")), q({
3177
+ t.objectId && i.push(`object ID: ${t.objectId}`), t.projectId && i.push(`project: ${t.projectId}`), t.taskId && i.push(`task: ${t.taskId}`), t.initiatorId && i.push(`initiator: ${t.initiatorId}`), t.dateFrom && i.push(`from: ${t.dateFrom}`), t.dateTo && i.push(`until (exclusive): ${t.dateTo}`);
3178
+ const a = [];
3179
+ 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")), q({
3180
3180
  subject: o,
3181
3181
  count: e.length,
3182
3182
  limit: t.limit,
3183
3183
  nextCursor: r ?? void 0,
3184
- filterHints: a,
3184
+ filterHints: i,
3185
3185
  previewLines: qn(e, Math.min(e.length, t.limit)),
3186
- zeroReasonHints: i
3186
+ zeroReasonHints: a
3187
3187
  });
3188
3188
  }
3189
3189
  function qn(e, t = 10) {
@@ -3203,8 +3203,8 @@ function Yn(e) {
3203
3203
  const c = e.extraData.content || e.extraData.name || e.extraData.last_content;
3204
3204
  c && typeof c == "string" && (o = ` • "${c.length > 50 ? `${c.substring(0, 47)}...` : c}"`);
3205
3205
  }
3206
- const n = e.objectId ? ` • id=${e.objectId}` : "", a = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", i = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
3207
- return ` [${t}] ${r}${o}${n}${a}${i}`;
3206
+ const n = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", a = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
3207
+ return ` [${t}] ${r}${o}${n}${i}${a}`;
3208
3208
  }
3209
3209
  function Gn(e) {
3210
3210
  try {
@@ -3254,40 +3254,40 @@ const Vn = {
3254
3254
  projectId: e.projectId,
3255
3255
  client: t
3256
3256
  });
3257
- let n = !1, a = null, i;
3257
+ let n = !1, i = null, a;
3258
3258
  if (e.commentId)
3259
- i = [await t.getComment(e.commentId)];
3259
+ a = [await t.getComment(e.commentId)];
3260
3260
  else if (e.taskId) {
3261
3261
  const l = await t.getComments({
3262
3262
  taskId: e.taskId,
3263
3263
  cursor: e.cursor || null,
3264
3264
  limit: e.limit || C.COMMENTS_DEFAULT
3265
3265
  });
3266
- i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
3266
+ a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
3267
3267
  } else if (o) {
3268
3268
  const l = await t.getComments({
3269
3269
  projectId: o,
3270
3270
  cursor: e.cursor || null,
3271
3271
  limit: e.limit || C.COMMENTS_DEFAULT
3272
3272
  });
3273
- i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
3273
+ a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
3274
3274
  } else
3275
3275
  throw new Error("Invalid state: no search parameter provided");
3276
- const c = i.map(ge);
3276
+ const c = a.map(ge);
3277
3277
  return {
3278
3278
  textContent: Zn({
3279
3279
  comments: c,
3280
3280
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
3281
3281
  searchId: e.commentId || e.taskId || e.projectId || "",
3282
3282
  hasMore: n,
3283
- nextCursor: a
3283
+ nextCursor: i
3284
3284
  }),
3285
3285
  structuredContent: {
3286
3286
  comments: c,
3287
3287
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
3288
3288
  searchId: e.commentId || e.taskId || e.projectId || "",
3289
3289
  hasMore: n,
3290
- nextCursor: a ?? void 0,
3290
+ nextCursor: i ?? void 0,
3291
3291
  totalCount: c.length
3292
3292
  }
3293
3293
  };
@@ -3302,22 +3302,22 @@ function Zn({
3302
3302
  }) {
3303
3303
  if (e.length === 0)
3304
3304
  return `No comments found for ${t}${t !== "single" ? ` ${r}` : ""}`;
3305
- let a;
3305
+ let i;
3306
3306
  if (t === "single") {
3307
- const i = e[0];
3308
- if (!i)
3307
+ const a = e[0];
3308
+ if (!a)
3309
3309
  return "Comment not found";
3310
- a = `Found comment${i.fileAttachment !== void 0 ? ` • Has attachment: ${i.fileAttachment?.fileName || "file"}` : ""} • id=${i.id}`;
3310
+ i = `Found comment${a.fileAttachment !== void 0 ? ` • Has attachment: ${a.fileAttachment?.fileName || "file"}` : ""} • id=${a.id}`;
3311
3311
  } else {
3312
- const i = e.filter((l) => l.fileAttachment !== void 0).length, c = i > 0 ? ` (${i} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
3313
- a = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (a += " • More available");
3312
+ const a = e.filter((l) => l.fileAttachment !== void 0).length, c = a > 0 ? ` (${a} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
3313
+ i = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (i += " • More available");
3314
3314
  }
3315
3315
  if (n) {
3316
- const i = as([], n);
3317
- return `${a}
3318
- ${i}`;
3316
+ const a = is([], n);
3317
+ return `${i}
3318
+ ${a}`;
3319
3319
  }
3320
- return a;
3320
+ return i;
3321
3321
  }
3322
3322
  function ms(e) {
3323
3323
  const t = e.getUTCFullYear(), r = String(e.getUTCMonth() + 1).padStart(2, "0"), o = String(e.getUTCDate()).padStart(2, "0");
@@ -3327,45 +3327,45 @@ function Qn(e) {
3327
3327
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
3328
3328
  if (!t)
3329
3329
  return 0;
3330
- const [, r, o, n] = t, a = Number(o) * 60 + Number(n);
3331
- return r === "-" ? -a : a;
3330
+ const [, r, o, n] = t, i = Number(o) * 60 + Number(n);
3331
+ return r === "-" ? -i : i;
3332
3332
  }
3333
- function ea(e, t) {
3333
+ function ei(e, t) {
3334
3334
  const r = new Date(e.getTime() + t * 60 * 1e3);
3335
3335
  return ms(r);
3336
3336
  }
3337
3337
  function jt(e, t) {
3338
- const [r, o, n] = e.split("-"), a = Number(r), i = Number(o), c = Number(n);
3339
- if (!Number.isFinite(a) || !Number.isFinite(i) || !Number.isFinite(c))
3338
+ const [r, o, n] = e.split("-"), i = Number(r), a = Number(o), c = Number(n);
3339
+ if (!Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(c))
3340
3340
  throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD.`);
3341
- const d = new Date(Date.UTC(a, i - 1, c));
3341
+ const d = new Date(Date.UTC(i, a - 1, c));
3342
3342
  return d.setUTCDate(d.getUTCDate() + t), ms(d);
3343
3343
  }
3344
- const ta = ["and", "or"], ct = {
3344
+ const ti = ["and", "or"], ct = {
3345
3345
  labels: s.string().array().optional().describe("The labels to filter the tasks by"),
3346
- labelsOperator: s.enum(ta).optional().describe(
3346
+ labelsOperator: s.enum(ti).optional().describe(
3347
3347
  'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
3348
3348
  )
3349
3349
  };
3350
3350
  function dt(e = [], t = "or") {
3351
3351
  if (e.length === 0) return "";
3352
3352
  const r = t === "and" ? " & " : " | ";
3353
- return `(${e.map((a) => a.startsWith("@") ? a : `@${a}`).join(` ${r} `)})`;
3353
+ return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${r} `)})`;
3354
3354
  }
3355
- const sa = 7;
3356
- function ra({
3355
+ const si = 7;
3356
+ function ri({
3357
3357
  since: e,
3358
3358
  until: t,
3359
3359
  userGmtOffset: r,
3360
3360
  now: o = /* @__PURE__ */ new Date()
3361
3361
  }) {
3362
- const n = Qn(r), a = ea(o, n), i = sa - 1, c = t ?? (e ? jt(e, i) : a);
3362
+ const n = Qn(r), i = ei(o, n), a = si - 1, c = t ?? (e ? jt(e, a) : i);
3363
3363
  return {
3364
- since: e ?? jt(c, -i),
3364
+ since: e ?? jt(c, -a),
3365
3365
  until: c
3366
3366
  };
3367
3367
  }
3368
- const oa = {
3368
+ const oi = {
3369
3369
  getBy: s.enum(["completion", "due"]).default("completion").describe(
3370
3370
  '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).'
3371
3371
  ),
@@ -3389,21 +3389,21 @@ const oa = {
3389
3389
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3390
3390
  ),
3391
3391
  ...ct
3392
- }, na = {
3392
+ }, ni = {
3393
3393
  tasks: s.array(F).describe("The found completed tasks."),
3394
3394
  nextCursor: s.string().optional(),
3395
3395
  totalCount: s.number().describe("The total number of tasks in this page."),
3396
3396
  hasMore: s.boolean(),
3397
3397
  appliedFilters: s.record(s.string(), s.unknown())
3398
- }, aa = {
3398
+ }, ii = {
3399
3399
  name: g.FIND_COMPLETED_TASKS,
3400
3400
  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.",
3401
- parameters: oa,
3402
- outputSchema: na,
3401
+ parameters: oi,
3402
+ outputSchema: ni,
3403
3403
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3404
3404
  async execute(e, t) {
3405
- const { getBy: r, labels: o, labelsOperator: n, since: a, until: i, responsibleUser: c, projectId: d, ...l } = e;
3406
- if (e.cursor && (!a || !i))
3405
+ const { getBy: r, labels: o, labelsOperator: n, since: i, until: a, responsibleUser: c, projectId: d, ...l } = e;
3406
+ if (e.cursor && (!i || !a))
3407
3407
  throw new Error(
3408
3408
  "Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
3409
3409
  );
@@ -3413,9 +3413,9 @@ const oa = {
3413
3413
  const y = await t.getUser(), f = y.tzInfo?.gmtString || "+00:00", v = await de({
3414
3414
  projectId: d,
3415
3415
  user: y
3416
- }), j = ra({
3417
- since: a,
3418
- until: i,
3416
+ }), j = ri({
3417
+ since: i,
3418
+ until: a,
3419
3419
  userGmtOffset: f
3420
3420
  }), A = `${j.since}T00:00:00${f}`, k = `${j.until}T23:59:59${f}`, I = new Date(A).toISOString(), x = new Date(k).toISOString(), T = {
3421
3421
  ...e,
@@ -3435,7 +3435,7 @@ const oa = {
3435
3435
  ...h ? { filterQuery: h, filterLang: "en" } : {}
3436
3436
  }), $ = b.map(P);
3437
3437
  return {
3438
- textContent: ia({
3438
+ textContent: ai({
3439
3439
  tasks: $,
3440
3440
  args: T,
3441
3441
  nextCursor: S,
@@ -3451,33 +3451,33 @@ const oa = {
3451
3451
  };
3452
3452
  }
3453
3453
  };
3454
- function ia({
3454
+ function ai({
3455
3455
  tasks: e,
3456
3456
  args: t,
3457
3457
  nextCursor: r,
3458
3458
  assigneeEmail: o
3459
3459
  }) {
3460
- const n = t.getBy === "completion" ? "completed" : "due", a = `Completed tasks (by ${n} date)`, i = [];
3461
- 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) {
3460
+ const n = t.getBy === "completion" ? "completed" : "due", i = `Completed tasks (by ${n} date)`, a = [];
3461
+ 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) {
3462
3462
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
3463
- i.push(`labels: ${d}`);
3463
+ a.push(`labels: ${d}`);
3464
3464
  }
3465
3465
  if (t.responsibleUser) {
3466
3466
  const d = o || t.responsibleUser;
3467
- i.push(`assigned to: ${d}`);
3467
+ a.push(`assigned to: ${d}`);
3468
3468
  }
3469
3469
  const c = [];
3470
3470
  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')), q({
3471
- subject: a,
3471
+ subject: i,
3472
3472
  count: e.length,
3473
3473
  limit: t.limit,
3474
3474
  nextCursor: r ?? void 0,
3475
- filterHints: i,
3475
+ filterHints: a,
3476
3476
  previewLines: Se(e, Math.min(e.length, t.limit)),
3477
3477
  zeroReasonHints: c
3478
3478
  });
3479
3479
  }
3480
- const ca = {
3480
+ const ci = {
3481
3481
  searchText: s.string().optional().describe(
3482
3482
  '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.'
3483
3483
  ),
@@ -3485,7 +3485,7 @@ const ca = {
3485
3485
  cursor: s.string().optional().describe(
3486
3486
  "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."
3487
3487
  )
3488
- }, da = {
3488
+ }, di = {
3489
3489
  labels: s.array(pe).describe("The found personal labels."),
3490
3490
  nextCursor: s.string().optional(),
3491
3491
  totalCount: s.number().describe("The total number of labels in this page."),
@@ -3494,11 +3494,11 @@ const ca = {
3494
3494
  "Names of all shared labels visible to you. These have no IDs or metadata — use their names directly when filtering tasks."
3495
3495
  ),
3496
3496
  appliedFilters: s.record(s.string(), s.unknown())
3497
- }, la = {
3497
+ }, li = {
3498
3498
  name: g.FIND_LABELS,
3499
3499
  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.",
3500
- parameters: ca,
3501
- outputSchema: da,
3500
+ parameters: ci,
3501
+ outputSchema: di,
3502
3502
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3503
3503
  async execute(e, t) {
3504
3504
  const [r, o] = await Promise.all([
@@ -3507,30 +3507,30 @@ const ca = {
3507
3507
  nextCursor: null
3508
3508
  })) : t.getLabels({ limit: e.limit, cursor: e.cursor ?? null }),
3509
3509
  lo(t)
3510
- ]), { results: n, nextCursor: a } = r, i = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
3510
+ ]), { results: n, nextCursor: i } = r, a = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
3511
3511
  return {
3512
- textContent: ua({ labels: n, args: e, nextCursor: a, sharedLabels: o }),
3512
+ textContent: ui({ labels: n, args: e, nextCursor: i, sharedLabels: o }),
3513
3513
  structuredContent: {
3514
3514
  labels: n.map((c) => pe.parse(c)),
3515
- nextCursor: a ?? void 0,
3515
+ nextCursor: i ?? void 0,
3516
3516
  totalCount: n.length,
3517
- hasMore: !!a,
3517
+ hasMore: !!i,
3518
3518
  sharedLabels: o,
3519
- appliedFilters: i
3519
+ appliedFilters: a
3520
3520
  }
3521
3521
  };
3522
3522
  }
3523
3523
  };
3524
- function ua({
3524
+ function ui({
3525
3525
  labels: e,
3526
3526
  args: t,
3527
3527
  nextCursor: r,
3528
3528
  sharedLabels: o
3529
3529
  }) {
3530
- const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
3531
- t.searchText && a.push(`searchText: "${t.searchText}"`);
3532
- const i = 10, d = e.slice(0, i).map(Mo).join(`
3533
- `), l = e.length - i, u = l > 0 ? `${d}
3530
+ const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", i = [];
3531
+ t.searchText && i.push(`searchText: "${t.searchText}"`);
3532
+ const a = 10, d = e.slice(0, a).map(Mo).join(`
3533
+ `), l = e.length - a, u = l > 0 ? `${d}
3534
3534
  …and ${l} more` : d, p = [];
3535
3535
  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"));
3536
3536
  const m = o.length > 0 ? `
@@ -3541,19 +3541,19 @@ No shared labels.`;
3541
3541
  count: e.length,
3542
3542
  limit: t.searchText ? void 0 : t.limit,
3543
3543
  nextCursor: r ?? void 0,
3544
- filterHints: a,
3544
+ filterHints: i,
3545
3545
  previewLines: u,
3546
3546
  zeroReasonHints: p
3547
3547
  }) + m;
3548
3548
  }
3549
- const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
3549
+ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pi = {
3550
3550
  projectId: s.string().min(1).optional().describe(
3551
3551
  'Optional. If provided, searches only collaborators of this project. If omitted, searches across the collaborators of all shared projects the authenticated user can access (plus the authenticated user themselves) — use this for general "find a user" / "who is X" lookups.'
3552
3552
  ),
3553
3553
  searchTerm: s.string().optional().describe(
3554
3554
  "Search for a user by name or email (partial and case insensitive match). If omitted, all users are returned."
3555
3555
  )
3556
- }, ma = {
3556
+ }, mi = {
3557
3557
  collaborators: s.array(yo).describe("The found users."),
3558
3558
  projectInfo: s.object({
3559
3559
  id: s.string().describe("The project ID."),
@@ -3563,21 +3563,21 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
3563
3563
  totalCount: s.number().describe("The total number of users found."),
3564
3564
  totalAvailable: s.number().optional().describe("The total number of available users before the search filter was applied."),
3565
3565
  appliedFilters: s.record(s.string(), s.unknown())
3566
- }, ha = {
3566
+ }, hi = {
3567
3567
  name: g.FIND_PROJECT_COLLABORATORS,
3568
3568
  description: `Find Todoist users (collaborators, teammates) by name or email to look up their user ID. Use this whenever the user asks to find, look up, or identify a person — e.g. "find Carrie's user ID", "who is Ernesto", "look up a user". When projectId is omitted, searches across the collaborators of every shared project the authenticated user has access to, plus the authenticated user themselves — an empty result means the person is not a collaborator on any project you share with them, not necessarily that they do not exist in Todoist. When projectId is provided, searches only that project. Partial, case-insensitive match on name and email.`,
3569
- parameters: pa,
3570
- outputSchema: ma,
3569
+ parameters: pi,
3570
+ outputSchema: mi,
3571
3571
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3572
3572
  async execute(e, t) {
3573
3573
  const { projectId: r, searchTerm: o } = e;
3574
3574
  if (!r)
3575
- return fa({ searchTerm: o, client: t, appliedFilters: e });
3576
- let n = r, a;
3575
+ return fi({ searchTerm: o, client: t, appliedFilters: e });
3576
+ let n = r, i;
3577
3577
  try {
3578
- if (a = await t.getProject(r), !a)
3578
+ if (i = await t.getProject(r), !i)
3579
3579
  throw new Error(`Project with ID "${r}" not found or not accessible`);
3580
- if (n = a.name, !a.isShared)
3580
+ if (n = i.name, !i.isShared)
3581
3581
  return {
3582
3582
  textContent: `Project "${n}" is not shared and has no collaborators.
3583
3583
 
@@ -3600,8 +3600,8 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
3600
3600
  `Failed to access project "${r}": ${l instanceof Error ? l.message : "Unknown error"}`
3601
3601
  );
3602
3602
  }
3603
- const i = await W.getProjectCollaborators(t, r);
3604
- if (i.length === 0)
3603
+ const a = await W.getProjectCollaborators(t, r);
3604
+ if (a.length === 0)
3605
3605
  return {
3606
3606
  textContent: `Project "${n}" has no collaborators or collaborator data is not accessible.
3607
3607
 
@@ -3620,13 +3620,13 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
3620
3620
  appliedFilters: e
3621
3621
  }
3622
3622
  };
3623
- const c = gs(i, o);
3623
+ const c = gs(a, o);
3624
3624
  return {
3625
3625
  textContent: ys({
3626
3626
  collaborators: c,
3627
3627
  projectName: n,
3628
3628
  searchTerm: o,
3629
- totalAvailable: i.length
3629
+ totalAvailable: a.length
3630
3630
  }),
3631
3631
  structuredContent: {
3632
3632
  collaborators: c,
@@ -3636,18 +3636,18 @@ const { FIND_PROJECTS: hs, ADD_TASKS: fs, UPDATE_TASKS: bs } = g, pa = {
3636
3636
  isShared: !0
3637
3637
  },
3638
3638
  totalCount: c.length,
3639
- totalAvailable: i.length,
3639
+ totalAvailable: a.length,
3640
3640
  appliedFilters: e
3641
3641
  }
3642
3642
  };
3643
3643
  }
3644
3644
  };
3645
- async function fa({
3645
+ async function fi({
3646
3646
  searchTerm: e,
3647
3647
  client: t,
3648
3648
  appliedFilters: r
3649
3649
  }) {
3650
- const o = await W.getAllCollaborators(t), n = await ba(t, o);
3650
+ const o = await W.getAllCollaborators(t), n = await bi(t, o);
3651
3651
  if (n.length === 0)
3652
3652
  return {
3653
3653
  textContent: `No users found. You may have no shared projects, or collaborator data is not accessible.
@@ -3664,24 +3664,24 @@ async function fa({
3664
3664
  appliedFilters: r
3665
3665
  }
3666
3666
  };
3667
- const a = gs(n, e);
3667
+ const i = gs(n, e);
3668
3668
  return {
3669
3669
  textContent: ys({
3670
- collaborators: a,
3670
+ collaborators: i,
3671
3671
  projectName: void 0,
3672
3672
  searchTerm: e,
3673
3673
  totalAvailable: n.length
3674
3674
  }),
3675
3675
  structuredContent: {
3676
- collaborators: a,
3676
+ collaborators: i,
3677
3677
  projectInfo: void 0,
3678
- totalCount: a.length,
3678
+ totalCount: i.length,
3679
3679
  totalAvailable: n.length,
3680
3680
  appliedFilters: r
3681
3681
  }
3682
3682
  };
3683
3683
  }
3684
- async function ba(e, t) {
3684
+ async function bi(e, t) {
3685
3685
  try {
3686
3686
  const r = await e.getUser();
3687
3687
  return !r || t.some((o) => o.id === r.id) ? t : [
@@ -3706,7 +3706,7 @@ function ys({
3706
3706
  searchTerm: r,
3707
3707
  totalAvailable: o
3708
3708
  }) {
3709
- const n = t ? `project "${t}"` : "workspace", a = t ? "Project collaborators" : "Workspace users", i = r ? `${a} matching "${r}"` : a, c = [];
3709
+ const n = t ? `project "${t}"` : "workspace", i = t ? "Project collaborators" : "Workspace users", a = r ? `${i} matching "${r}"` : i, c = [];
3710
3710
  r && c.push(`matching "${r}"`), c.push(`in ${n}`);
3711
3711
  let d = [];
3712
3712
  e.length > 0 && (d = e.slice(0, 10).map((p) => {
@@ -3717,7 +3717,7 @@ function ys({
3717
3717
  e.length === 0 && r && (l.push(`No users match "${r}"`), l.push("Try a broader search term or check spelling"), o > 0 && l.push(`${o} users available without filter`));
3718
3718
  const u = [];
3719
3719
  return e.length > 0 ? (u.push(`Use ${fs} with responsibleUser to assign new tasks`), u.push(`Use ${bs} with responsibleUser to reassign existing tasks`), u.push("Use user names, emails, or IDs for assignments")) : (u.push(`Use ${hs} to find other projects`), r && o > 0 && u.push("Try searching without filters to see all users")), q({
3720
- subject: i,
3720
+ subject: a,
3721
3721
  count: e.length,
3722
3722
  filterHints: c,
3723
3723
  previewLines: d.join(`
@@ -3726,11 +3726,11 @@ function ys({
3726
3726
  nextSteps: u
3727
3727
  });
3728
3728
  }
3729
- const { ADD_PROJECTS: Ct } = g, ga = {
3729
+ const { ADD_PROJECTS: Ct } = g, gi = {
3730
3730
  active: "projects",
3731
3731
  archived: "archived projects",
3732
3732
  all: "projects (active and archived)"
3733
- }, ya = {
3733
+ }, yi = {
3734
3734
  searchText: s.string().optional().describe(
3735
3735
  '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.'
3736
3736
  ),
@@ -3741,96 +3741,96 @@ const { ADD_PROJECTS: Ct } = g, ga = {
3741
3741
  archivedStatus: s.enum(["active", "archived", "all"]).optional().describe(
3742
3742
  "Which projects to return by archive status: 'active' (default, non-archived only), 'archived' (archived only), or 'all' (both active and archived). Each project includes an isArchived field. Archived projects can be deleted via the delete-object tool (type: 'project')."
3743
3743
  )
3744
- }, Ta = {
3744
+ }, Ti = {
3745
3745
  projects: s.array(Q).describe("The found projects."),
3746
3746
  nextCursor: s.string().optional(),
3747
3747
  totalCount: s.number().describe("The total number of projects in this page."),
3748
3748
  hasMore: s.boolean(),
3749
3749
  appliedFilters: s.record(s.string(), s.unknown())
3750
- }, ka = {
3750
+ }, ki = {
3751
3751
  name: g.FIND_PROJECTS,
3752
3752
  description: "List all projects or search for projects by name. By default only active projects are returned; use archivedStatus ('archived' or 'all') to include archived projects. When searching or when archivedStatus is 'all', all matching projects are returned (pagination is ignored). Otherwise projects are returned with pagination.",
3753
- parameters: ya,
3754
- outputSchema: Ta,
3753
+ parameters: yi,
3754
+ outputSchema: Ti,
3755
3755
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3756
3756
  async execute(e, t) {
3757
3757
  const { searchText: r } = e, o = e.archivedStatus ?? "active";
3758
- let n, a = null;
3758
+ let n, i = null;
3759
3759
  if (r || o === "all") {
3760
3760
  const c = Promise.resolve([]), [d, l] = await Promise.all([
3761
3761
  o === "archived" ? c : r ? rs(t, r) : os(t),
3762
- o === "active" ? c : ao(t)
3763
- ]), u = r ? io(r) : null, p = u ? l.filter((m) => u.test(m.name)) : l;
3762
+ o === "active" ? c : io(t)
3763
+ ]), u = r ? ao(r) : null, p = u ? l.filter((m) => u.test(m.name)) : l;
3764
3764
  n = [...d, ...p];
3765
3765
  } else {
3766
3766
  const c = o === "archived" ? await t.getArchivedProjects({
3767
3767
  limit: e.limit,
3768
3768
  cursor: e.cursor ?? null
3769
3769
  }) : await t.getProjects({ limit: e.limit, cursor: e.cursor ?? null });
3770
- n = c.results, a = c.nextCursor;
3770
+ n = c.results, i = c.nextCursor;
3771
3771
  }
3772
- const i = n.map(Z);
3772
+ const a = n.map(Z);
3773
3773
  return {
3774
- textContent: wa({ projects: i, args: e, nextCursor: a }),
3774
+ textContent: wi({ projects: a, args: e, nextCursor: i }),
3775
3775
  structuredContent: {
3776
- projects: i,
3777
- nextCursor: a ?? void 0,
3778
- totalCount: i.length,
3779
- hasMore: !!a,
3776
+ projects: a,
3777
+ nextCursor: i ?? void 0,
3778
+ totalCount: a.length,
3779
+ hasMore: !!i,
3780
3780
  appliedFilters: e
3781
3781
  }
3782
3782
  };
3783
3783
  }
3784
3784
  };
3785
- function wa({
3785
+ function wi({
3786
3786
  projects: e,
3787
3787
  args: t,
3788
3788
  nextCursor: r
3789
3789
  }) {
3790
- const o = ga[t.archivedStatus ?? "active"], n = t.searchText ? `All ${o} matching "${t.searchText}"` : `${o.charAt(0).toUpperCase()}${o.slice(1)}`, a = [];
3791
- t.searchText && a.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && a.push(`archivedStatus: "${t.archivedStatus}"`);
3792
- const i = 10, d = e.slice(0, i).map(Fo).join(`
3793
- `), l = e.length - i, u = l > 0 ? `${d}
3790
+ const o = gi[t.archivedStatus ?? "active"], n = t.searchText ? `All ${o} matching "${t.searchText}"` : `${o.charAt(0).toUpperCase()}${o.slice(1)}`, i = [];
3791
+ t.searchText && i.push(`searchText: "${t.searchText}"`), t.archivedStatus && t.archivedStatus !== "active" && i.push(`archivedStatus: "${t.archivedStatus}"`);
3792
+ const a = 10, d = e.slice(0, a).map(Fo).join(`
3793
+ `), l = e.length - a, u = l > 0 ? `${d}
3794
3794
  …and ${l} more` : d, p = [];
3795
3795
  return e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all projects")) : t.archivedStatus === "archived" ? (p.push("No archived projects"), p.push("Use archivedStatus: 'all' to also see active projects")) : t.archivedStatus === "all" ? (p.push("No projects created yet"), p.push(`Use ${Ct} to create a project`)) : (p.push("No active projects"), p.push("Use archivedStatus: 'all' to include archived projects"), p.push(`Use ${Ct} to create a project`))), q({
3796
3796
  subject: n,
3797
3797
  count: e.length,
3798
3798
  limit: t.searchText || t.archivedStatus === "all" ? void 0 : t.limit,
3799
3799
  nextCursor: r ?? void 0,
3800
- filterHints: a,
3800
+ filterHints: i,
3801
3801
  previewLines: u,
3802
3802
  zeroReasonHints: p
3803
3803
  });
3804
3804
  }
3805
- const va = {
3805
+ const vi = {
3806
3806
  taskId: s.string().optional().describe(
3807
3807
  "Find all reminders for a specific task. Returns both time-based and location reminders."
3808
3808
  ),
3809
3809
  reminderId: s.string().optional().describe("Get a specific time-based reminder (relative or absolute) by its ID."),
3810
3810
  locationReminderId: s.string().optional().describe("Get a specific location reminder by its ID.")
3811
- }, Ia = {
3811
+ }, Ii = {
3812
3812
  reminders: s.array(st).describe("The found reminders (time-based and location)."),
3813
3813
  searchType: s.string().describe('The search type used: "task", "reminder", or "location_reminder".'),
3814
3814
  searchId: s.string().describe("The ID used for the search."),
3815
3815
  totalCount: s.number().describe("Total reminders in this response.")
3816
- }, Sa = {
3816
+ }, Si = {
3817
3817
  name: g.FIND_REMINDERS,
3818
3818
  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.",
3819
- parameters: va,
3820
- outputSchema: Ia,
3819
+ parameters: vi,
3820
+ outputSchema: Ii,
3821
3821
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3822
3822
  async execute(e, t) {
3823
- const { taskId: r, reminderId: o, locationReminderId: n } = e, a = [r, o, n].filter(Boolean);
3824
- if (a.length === 0)
3823
+ const { taskId: r, reminderId: o, locationReminderId: n } = e, i = [r, o, n].filter(Boolean);
3824
+ if (i.length === 0)
3825
3825
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
3826
- if (a.length > 1)
3826
+ if (i.length > 1)
3827
3827
  throw new Error(
3828
3828
  "Only one of taskId, reminderId, or locationReminderId can be provided at a time."
3829
3829
  );
3830
3830
  if (o) {
3831
- const i = await t.getReminder(o), c = be(i);
3831
+ const a = await t.getReminder(o), c = be(a);
3832
3832
  return {
3833
- textContent: `Found ${i.type} reminder (id=${o})`,
3833
+ textContent: `Found ${a.type} reminder (id=${o})`,
3834
3834
  structuredContent: {
3835
3835
  reminders: [c],
3836
3836
  searchType: "reminder",
@@ -3840,7 +3840,7 @@ const va = {
3840
3840
  };
3841
3841
  }
3842
3842
  if (n) {
3843
- const i = await t.getLocationReminder(n), c = be(i);
3843
+ const a = await t.getLocationReminder(n), c = be(a);
3844
3844
  return {
3845
3845
  textContent: `Found location reminder (id=${n})`,
3846
3846
  structuredContent: {
@@ -3852,7 +3852,7 @@ const va = {
3852
3852
  };
3853
3853
  }
3854
3854
  if (r) {
3855
- const [i, c] = await Promise.all([
3855
+ const [a, c] = await Promise.all([
3856
3856
  M({
3857
3857
  apiMethod: (p) => t.getReminders(p),
3858
3858
  args: { taskId: r }
@@ -3861,9 +3861,9 @@ const va = {
3861
3861
  apiMethod: (p) => t.getLocationReminders(p),
3862
3862
  args: { taskId: r }
3863
3863
  })
3864
- ]), l = [...i, ...c].map(be);
3864
+ ]), l = [...a, ...c].map(be);
3865
3865
  return {
3866
- textContent: ja(l, r),
3866
+ textContent: ji(l, r),
3867
3867
  structuredContent: {
3868
3868
  reminders: l,
3869
3869
  searchType: "task",
@@ -3875,36 +3875,36 @@ const va = {
3875
3875
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
3876
3876
  }
3877
3877
  };
3878
- function ja(e, t) {
3878
+ function ji(e, t) {
3879
3879
  if (e.length === 0)
3880
3880
  return `No reminders found for task ${t}`;
3881
3881
  const { timeBasedCount: r, locationCount: o } = ns(e), n = [];
3882
3882
  if (r > 0) {
3883
- const a = r > 1 ? "time-based reminders" : "time-based reminder";
3884
- n.push(`${r} ${a}`);
3883
+ const i = r > 1 ? "time-based reminders" : "time-based reminder";
3884
+ n.push(`${r} ${i}`);
3885
3885
  }
3886
3886
  if (o > 0) {
3887
- const a = o > 1 ? "location reminders" : "location reminder";
3888
- n.push(`${o} ${a}`);
3887
+ const i = o > 1 ? "location reminders" : "location reminder";
3888
+ n.push(`${o} ${i}`);
3889
3889
  }
3890
3890
  return `Found ${n.join(" and ")} for task ${t}`;
3891
3891
  }
3892
- const { ADD_SECTIONS: Ca } = g, $a = {
3892
+ const { ADD_SECTIONS: Ci } = g, $i = {
3893
3893
  projectId: s.string().min(1).describe(
3894
3894
  'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
3895
3895
  ),
3896
3896
  searchText: s.string().optional().describe(
3897
3897
  '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.'
3898
3898
  )
3899
- }, Da = {
3899
+ }, Di = {
3900
3900
  sections: s.array(X).describe("The found sections."),
3901
3901
  totalCount: s.number().describe("The total number of sections found."),
3902
3902
  appliedFilters: s.record(s.string(), s.unknown())
3903
- }, xa = {
3903
+ }, xi = {
3904
3904
  name: g.FIND_SECTIONS,
3905
3905
  description: "Search for sections by name or other criteria in a project. When searching, uses server-side search to avoid fetching all sections.",
3906
- parameters: $a,
3907
- outputSchema: Da,
3906
+ parameters: $i,
3907
+ outputSchema: Di,
3908
3908
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3909
3909
  async execute(e, t) {
3910
3910
  const r = await de({
@@ -3917,7 +3917,7 @@ const { ADD_SECTIONS: Ca } = g, $a = {
3917
3917
  })).results;
3918
3918
  const n = o.map(K);
3919
3919
  return {
3920
- textContent: Aa({
3920
+ textContent: Ai({
3921
3921
  sections: n,
3922
3922
  projectId: e.projectId,
3923
3923
  searchText: e.searchText
@@ -3930,26 +3930,26 @@ const { ADD_SECTIONS: Ca } = g, $a = {
3930
3930
  };
3931
3931
  }
3932
3932
  };
3933
- function Aa({
3933
+ function Ai({
3934
3934
  sections: e,
3935
3935
  projectId: t,
3936
3936
  searchText: r
3937
3937
  }) {
3938
3938
  const o = [];
3939
- 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 ${Ca} to create sections`));
3940
- 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(`
3939
+ 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 ${Ci} to create sections`));
3940
+ 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(`
3941
3941
  `) : void 0;
3942
3942
  return q({
3943
3943
  subject: n,
3944
3944
  count: e.length,
3945
- previewLines: a,
3945
+ previewLines: i,
3946
3946
  zeroReasonHints: o
3947
3947
  });
3948
3948
  }
3949
3949
  function Ts(e) {
3950
3950
  return /* @__PURE__ */ new Date(`${e}T00:00:00`);
3951
3951
  }
3952
- const Ea = {
3952
+ const Ei = {
3953
3953
  startDate: s.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe(
3954
3954
  "The start date to get the tasks for. Format: YYYY-MM-DD, or 'today', which by default also includes overdue tasks."
3955
3955
  ),
@@ -3970,17 +3970,17 @@ const Ea = {
3970
3970
  "Filter when responsibleUser is omitted. 'assigned'=assigned to others; 'unassignedOrMe'=unassigned+mine; 'all'=everyone. Default: 'unassignedOrMe'."
3971
3971
  ),
3972
3972
  ...ct
3973
- }, Oa = {
3973
+ }, Oi = {
3974
3974
  tasks: s.array(F).describe("The found tasks."),
3975
3975
  nextCursor: s.string().optional(),
3976
3976
  totalCount: s.number().describe("The total number of tasks in this page."),
3977
3977
  hasMore: s.boolean(),
3978
3978
  appliedFilters: s.record(s.string(), s.unknown())
3979
- }, Pa = {
3979
+ }, Pi = {
3980
3980
  name: g.FIND_TASKS_BY_DATE,
3981
3981
  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.",
3982
- parameters: Ea,
3983
- outputSchema: Oa,
3982
+ parameters: Ei,
3983
+ outputSchema: Oi,
3984
3984
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3985
3985
  async execute(e, t) {
3986
3986
  if (!e.startDate && e.overdueOption !== "overdue-only")
@@ -3988,35 +3988,35 @@ const Ea = {
3988
3988
  "Either startDate must be provided or overdueOption must be set to overdue-only"
3989
3989
  );
3990
3990
  const r = await Qe(t, e.responsibleUser), o = r?.userId, n = r?.email;
3991
- let a = "";
3991
+ let i = "";
3992
3992
  if (e.overdueOption === "overdue-only")
3993
- a = "overdue";
3993
+ i = "overdue";
3994
3994
  else if (e.startDate === "today")
3995
3995
  if (e.daysCount > 1) {
3996
- const p = /* @__PURE__ */ new Date(), m = ie(p), h = Ue(p, e.daysCount), y = lt(h, { representation: "date" }), f = `(due after: ${m} | due: ${m}) & due before: ${y}`;
3997
- a = e.overdueOption === "exclude-overdue" ? f : `(${f} | overdue)`;
3996
+ const p = /* @__PURE__ */ new Date(), m = ae(p), h = Ue(p, e.daysCount), y = lt(h, { representation: "date" }), f = `(due after: ${m} | due: ${m}) & due before: ${y}`;
3997
+ i = e.overdueOption === "exclude-overdue" ? f : `(${f} | overdue)`;
3998
3998
  } else
3999
- a = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3999
+ i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
4000
4000
  else if (e.startDate) {
4001
4001
  const p = e.startDate, m = Ue(Ts(p), e.daysCount), h = lt(m, { representation: "date" });
4002
- a = `(due after: ${p} | due: ${p}) & due before: ${h}`;
4002
+ i = `(due after: ${p} | due: ${p}) & due before: ${h}`;
4003
4003
  }
4004
- const i = dt(e.labels, e.labelsOperator);
4005
- i.length > 0 && (a = ce(a, `(${i})`));
4004
+ const a = dt(e.labels, e.labelsOperator);
4005
+ a.length > 0 && (i = ce(i, `(${a})`));
4006
4006
  const c = ss({
4007
4007
  resolvedAssigneeId: o,
4008
4008
  assigneeEmail: n,
4009
4009
  responsibleUserFiltering: e.responsibleUserFiltering
4010
4010
  });
4011
- a = ce(a, c);
4011
+ i = ce(i, c);
4012
4012
  const { tasks: d, nextCursor: l } = await tt({
4013
4013
  client: t,
4014
- query: a,
4014
+ query: i,
4015
4015
  cursor: e.cursor,
4016
4016
  limit: e.limit
4017
4017
  });
4018
4018
  return {
4019
- textContent: _a({ tasks: d, args: e, nextCursor: l, assigneeEmail: n }),
4019
+ textContent: _i({ tasks: d, args: e, nextCursor: l, assigneeEmail: n }),
4020
4020
  structuredContent: {
4021
4021
  tasks: d,
4022
4022
  nextCursor: l ?? void 0,
@@ -4027,7 +4027,7 @@ const Ea = {
4027
4027
  };
4028
4028
  }
4029
4029
  };
4030
- function _a({
4030
+ function _i({
4031
4031
  tasks: e,
4032
4032
  args: t,
4033
4033
  nextCursor: r,
@@ -4042,7 +4042,7 @@ function _a({
4042
4042
  `today${c}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
4043
4043
  );
4044
4044
  } else if (t.startDate) {
4045
- const c = t.daysCount > 1 ? ` to ${ie(Ue(Ts(t.startDate), t.daysCount))}` : "";
4045
+ const c = t.daysCount > 1 ? ` to ${ae(Ue(Ts(t.startDate), t.daysCount))}` : "";
4046
4046
  n.push(`${t.startDate}${c}`);
4047
4047
  }
4048
4048
  if (t.labels && t.labels.length > 0) {
@@ -4053,37 +4053,37 @@ function _a({
4053
4053
  const c = o || t.responsibleUser;
4054
4054
  n.push(`assigned to: ${c}`);
4055
4055
  }
4056
- let a = "";
4057
- 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) {
4056
+ let i = "";
4057
+ 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) {
4058
4058
  const c = o || t.responsibleUser;
4059
- a += ` assigned to ${c}`;
4059
+ i += ` assigned to ${c}`;
4060
4060
  }
4061
- const i = [];
4061
+ const a = [];
4062
4062
  if (e.length === 0)
4063
4063
  if (t.overdueOption === "overdue-only")
4064
- i.push("Great job! No overdue tasks");
4064
+ a.push("Great job! No overdue tasks");
4065
4065
  else if (t.startDate === "today") {
4066
4066
  const c = t.overdueOption === "exclude-overdue" ? "" : " or overdue";
4067
- i.push(`Great job! No tasks for today${c}`);
4067
+ a.push(`Great job! No tasks for today${c}`);
4068
4068
  } else
4069
- i.push("Expand date range with larger 'daysCount'"), i.push("Check today's tasks with startDate='today'");
4069
+ a.push("Expand date range with larger 'daysCount'"), a.push("Check today's tasks with startDate='today'");
4070
4070
  return q({
4071
- subject: a,
4071
+ subject: i,
4072
4072
  count: e.length,
4073
4073
  limit: t.limit,
4074
4074
  nextCursor: r ?? void 0,
4075
4075
  filterHints: n,
4076
4076
  previewLines: Se(e, Math.min(e.length, t.limit)),
4077
- zeroReasonHints: i
4077
+ zeroReasonHints: a
4078
4078
  });
4079
4079
  }
4080
- const Ra = 300 * 1e3;
4081
- class Ua {
4080
+ const Ri = 300 * 1e3;
4081
+ class Ui {
4082
4082
  constructor() {
4083
4083
  this.cache = null;
4084
4084
  }
4085
4085
  async getFilters(t) {
4086
- if (this.cache && Date.now() - this.cache.timestamp < Ra)
4086
+ if (this.cache && Date.now() - this.cache.timestamp < Ri)
4087
4087
  return this.cache.filters;
4088
4088
  const o = ((await t.sync({
4089
4089
  resourceTypes: ["filters"],
@@ -4105,17 +4105,17 @@ class Ua {
4105
4105
  const o = r.trim();
4106
4106
  if (!o)
4107
4107
  throw new Error("Filter reference cannot be empty");
4108
- const n = await this.getFilters(t), a = n.find((u) => u.id === o);
4109
- if (a)
4110
- return { filterId: a.id, filterName: a.name, filterQuery: a.query };
4111
- const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
4108
+ const n = await this.getFilters(t), i = n.find((u) => u.id === o);
4109
+ if (i)
4110
+ return { filterId: i.id, filterName: i.name, filterQuery: i.query };
4111
+ const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
4112
4112
  if (c)
4113
4113
  return {
4114
4114
  filterId: c.id,
4115
4115
  filterName: c.name,
4116
4116
  filterQuery: c.query
4117
4117
  };
4118
- const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
4118
+ const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
4119
4119
  if (l)
4120
4120
  return {
4121
4121
  filterId: l.id,
@@ -4140,7 +4140,7 @@ ${u}` + (d.length > 5 ? `
4140
4140
  this.cache = null;
4141
4141
  }
4142
4142
  }
4143
- const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4143
+ const Li = new Ui(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Ni = {
4144
4144
  searchText: s.string().optional().describe("The text to search for in tasks."),
4145
4145
  projectId: s.string().optional().describe(
4146
4146
  'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
@@ -4162,25 +4162,25 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4162
4162
  "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."
4163
4163
  ),
4164
4164
  ...ct
4165
- }, Ma = {
4165
+ }, Mi = {
4166
4166
  tasks: s.array(F).describe("The found tasks."),
4167
4167
  nextCursor: s.string().optional(),
4168
4168
  totalCount: s.number().describe("The total number of tasks in this page."),
4169
4169
  hasMore: s.boolean(),
4170
4170
  appliedFilters: s.record(s.string(), s.unknown())
4171
- }, Fa = {
4171
+ }, Fi = {
4172
4172
  name: g.FIND_TASKS,
4173
4173
  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.",
4174
- parameters: Na,
4175
- outputSchema: Ma,
4174
+ parameters: Ni,
4175
+ outputSchema: Mi,
4176
4176
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4177
4177
  async execute(e, t) {
4178
4178
  const {
4179
4179
  searchText: r,
4180
4180
  projectId: o,
4181
4181
  sectionId: n,
4182
- parentId: a,
4183
- responsibleUser: i,
4182
+ parentId: i,
4183
+ responsibleUser: a,
4184
4184
  responsibleUserFiltering: c,
4185
4185
  limit: d,
4186
4186
  cursor: l,
@@ -4189,7 +4189,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4189
4189
  filter: m,
4190
4190
  filterIdOrName: h
4191
4191
  } = e, y = await t.getUser(), f = u && u.length > 0;
4192
- if (!r && !o && !n && !a && !i && !f && !m && !h)
4192
+ if (!r && !o && !n && !i && !a && !f && !m && !h)
4193
4193
  throw new Error(
4194
4194
  "At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
4195
4195
  );
@@ -4197,19 +4197,19 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4197
4197
  throw new Error(
4198
4198
  "The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one."
4199
4199
  );
4200
- if ((m || h) && (o || n || a))
4200
+ if ((m || h) && (o || n || i))
4201
4201
  throw new Error(
4202
4202
  'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
4203
4203
  );
4204
4204
  let v = m;
4205
- h && (v = (await La.resolveFilter(t, h)).filterQuery);
4206
- const j = await Qe(t, i), A = j?.userId, k = j?.email;
4207
- if (o || n || a) {
4205
+ h && (v = (await Li.resolveFilter(t, h)).filterQuery);
4206
+ const j = await Qe(t, a), A = j?.userId, k = j?.email;
4207
+ if (o || n || i) {
4208
4208
  const D = {
4209
4209
  limit: d,
4210
4210
  cursor: l ?? null
4211
4211
  };
4212
- o && (D.projectId = await de({ projectId: o, user: y })), n && (D.sectionId = n), a && (D.parentId = a);
4212
+ o && (D.projectId = await de({ projectId: o, user: y })), n && (D.sectionId = n), i && (D.parentId = i);
4213
4213
  const { results: me, nextCursor: Y } = await t.getTasks(D), $e = me.map(P);
4214
4214
  let H = r ? $e.filter(
4215
4215
  (te) => te.content.toLowerCase().includes(r.toLowerCase()) || te.description?.toLowerCase().includes(r.toLowerCase())
@@ -4267,7 +4267,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4267
4267
  let I = v ? `(${v})` : "";
4268
4268
  r && (I = ce(I, `search: ${r}`));
4269
4269
  const x = dt(u, p);
4270
- if (I = ce(I, x), !(h && !i && !c)) {
4270
+ if (I = ce(I, x), !(h && !a && !c)) {
4271
4271
  const D = ss({
4272
4272
  resolvedAssigneeId: A,
4273
4273
  assigneeEmail: k,
@@ -4299,7 +4299,7 @@ const La = new Ua(), { FIND_COMPLETED_TASKS: $t, ADD_TASKS: Dt } = g, Na = {
4299
4299
  };
4300
4300
  }
4301
4301
  };
4302
- function Ha(e) {
4302
+ function Hi(e) {
4303
4303
  if (e.projectId) {
4304
4304
  const t = [
4305
4305
  e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
@@ -4323,27 +4323,27 @@ function Ee({
4323
4323
  isContainerSearch: o,
4324
4324
  assigneeEmail: n
4325
4325
  }) {
4326
- let a = "Tasks";
4327
- const i = [], c = [];
4326
+ let i = "Tasks";
4327
+ const a = [], c = [];
4328
4328
  if (o) {
4329
- 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) {
4329
+ 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) {
4330
4330
  const d = n || t.responsibleUser;
4331
- a += ` assigned to ${d}`, i.push(`assigned to ${d}`);
4331
+ i += ` assigned to ${d}`, a.push(`assigned to ${d}`);
4332
4332
  }
4333
4333
  if (t.labels && t.labels.length > 0) {
4334
4334
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
4335
- i.push(`labels: ${d}`);
4335
+ a.push(`labels: ${d}`);
4336
4336
  }
4337
- e.length === 0 && c.push(...Ha(t));
4337
+ e.length === 0 && c.push(...Hi(t));
4338
4338
  } else {
4339
4339
  const d = n || t.responsibleUser, l = [];
4340
4340
  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) {
4341
4341
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
4342
4342
  l.push(`with labels: ${u}`);
4343
4343
  }
4344
- 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) {
4344
+ 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) {
4345
4345
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
4346
- i.push(`labels: ${u}`);
4346
+ a.push(`labels: ${u}`);
4347
4347
  }
4348
4348
  if (e.length === 0) {
4349
4349
  if (t.responsibleUser) {
@@ -4354,16 +4354,16 @@ function Ee({
4354
4354
  }
4355
4355
  }
4356
4356
  return q({
4357
- subject: a,
4357
+ subject: i,
4358
4358
  count: e.length,
4359
4359
  limit: t.limit,
4360
4360
  nextCursor: r ?? void 0,
4361
- filterHints: i,
4361
+ filterHints: a,
4362
4362
  previewLines: Se(e, Math.min(e.length, t.limit)),
4363
4363
  zeroReasonHints: c
4364
4364
  });
4365
4365
  }
4366
- const Wa = {
4366
+ const Wi = {
4367
4367
  projectId: s.string().min(1).optional().describe(
4368
4368
  "Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
4369
4369
  )
@@ -4382,7 +4382,7 @@ const Wa = {
4382
4382
  ),
4383
4383
  children: s.array(ks).describe("Nested child projects.")
4384
4384
  })
4385
- ), Ba = {
4385
+ ), Bi = {
4386
4386
  type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
4387
4387
  totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
4388
4388
  totalTasks: s.number().optional().describe("Total number of tasks."),
@@ -4400,7 +4400,7 @@ const Wa = {
4400
4400
  id: s.string().describe("The inbox project ID."),
4401
4401
  name: s.string().describe("The inbox project name."),
4402
4402
  sections: s.array(X).describe("Sections in the inbox project.")
4403
- }).nullable().optional().describe("Inbox information (account overview only)."),
4403
+ }).optional().describe("Inbox information (account overview only)."),
4404
4404
  projects: s.array(s.lazy(() => ks)).optional().describe(
4405
4405
  "List of projects with hierarchy, folders, and ordering (account overview only)."
4406
4406
  ),
@@ -4416,7 +4416,7 @@ const Wa = {
4416
4416
  tasksWithoutSection: s.number()
4417
4417
  }).optional().describe("Statistics object (project overview only).")
4418
4418
  };
4419
- function za(e) {
4419
+ function zi(e) {
4420
4420
  const t = {};
4421
4421
  for (const n of e)
4422
4422
  t[n.id] = {
@@ -4426,22 +4426,22 @@ function za(e) {
4426
4426
  };
4427
4427
  const r = [];
4428
4428
  for (const n of e) {
4429
- const a = t[n.id];
4430
- if (a)
4429
+ const i = t[n.id];
4430
+ if (i)
4431
4431
  if (B(n) && n.parentId) {
4432
- const i = t[n.parentId];
4433
- i ? i.children.push(a) : r.push(a);
4432
+ const a = t[n.parentId];
4433
+ a ? a.children.push(i) : r.push(i);
4434
4434
  } else
4435
- r.push(a);
4435
+ r.push(i);
4436
4436
  }
4437
4437
  function o(n) {
4438
- n.sort((a, i) => a.childOrder - i.childOrder);
4439
- for (const a of n)
4440
- o(a.children);
4438
+ n.sort((i, a) => i.childOrder - a.childOrder);
4439
+ for (const i of n)
4440
+ o(i.children);
4441
4441
  }
4442
4442
  return o(r), r;
4443
4443
  }
4444
- async function Ka(e, t) {
4444
+ async function Ki(e, t) {
4445
4445
  const r = {};
4446
4446
  return await Promise.all(
4447
4447
  t.map(async (o) => {
@@ -4454,10 +4454,10 @@ function ws(e, t, r = "") {
4454
4454
  const o = [];
4455
4455
  o.push(`${r}- Project: ${e.name} (id=${e.id})`);
4456
4456
  const n = t[e.id] || [];
4457
- for (const a of n)
4458
- o.push(`${r} - Section: ${a.name} (id=${a.id})`);
4459
- for (const a of e.children)
4460
- o.push(...ws(a, t, `${r} `));
4457
+ for (const i of n)
4458
+ o.push(`${r} - Section: ${i.name} (id=${i.id})`);
4459
+ for (const i of e.children)
4460
+ o.push(...ws(i, t, `${r} `));
4461
4461
  return o;
4462
4462
  }
4463
4463
  function xt(e) {
@@ -4472,16 +4472,16 @@ function xt(e) {
4472
4472
  r.push(n);
4473
4473
  continue;
4474
4474
  }
4475
- const a = t[o.parentId];
4476
- a ? a.children.push(n) : r.push(n);
4475
+ const i = t[o.parentId];
4476
+ i ? i.children.push(n) : r.push(n);
4477
4477
  }
4478
4478
  return r;
4479
4479
  }
4480
4480
  function qe(e, t = "") {
4481
4481
  const r = [];
4482
4482
  for (const o of e) {
4483
- const n = `id=${o.id}`, a = o.dueDate ? `; due=${o.dueDate}` : "", i = `; content=${o.content}`;
4484
- r.push(`${t}- ${n}${a}${i}`), o.children.length > 0 && r.push(...qe(o.children, `${t} `));
4483
+ const n = `id=${o.id}`, i = o.dueDate ? `; due=${o.dueDate}` : "", a = `; content=${o.content}`;
4484
+ r.push(`${t}- ${n}${i}${a}`), o.children.length > 0 && r.push(...qe(o.children, `${t} `));
4485
4485
  }
4486
4486
  return r;
4487
4487
  }
@@ -4498,32 +4498,32 @@ function vs(e, t) {
4498
4498
  )
4499
4499
  };
4500
4500
  }
4501
- async function qa(e, t) {
4501
+ async function qi(e, t) {
4502
4502
  let r = [], o;
4503
4503
  do {
4504
- const { results: n, nextCursor: a } = await e.getTasks({
4504
+ const { results: n, nextCursor: i } = await e.getTasks({
4505
4505
  projectId: t,
4506
4506
  limit: C.TASKS_BATCH_SIZE,
4507
4507
  cursor: o ?? void 0
4508
4508
  });
4509
- r = r.concat(n.map(P)), o = a ?? void 0;
4509
+ r = r.concat(n.map(P)), o = i ?? void 0;
4510
4510
  } while (o);
4511
4511
  return r;
4512
4512
  }
4513
- async function Ya(e, t) {
4513
+ async function Yi(e, t) {
4514
4514
  const { results: r } = await e.getSections({ projectId: t });
4515
4515
  return r;
4516
4516
  }
4517
- async function Ga(e) {
4518
- const { results: t } = await e.getProjects({}), r = t.find((p) => B(p) && p.inboxProject === !0), o = t.filter((p) => !B(p) || p.inboxProject !== !0), n = za(o), a = t.map((p) => p.id), i = await Ka(e, a), c = ["# Personal Projects", ""];
4517
+ async function Gi(e) {
4518
+ const { results: t } = await e.getProjects({}), r = t.find((p) => B(p) && p.inboxProject === !0), o = t.filter((p) => !B(p) || p.inboxProject !== !0), n = zi(o), i = t.map((p) => p.id), a = await Ki(e, i), c = ["# Personal Projects", ""];
4519
4519
  if (r) {
4520
4520
  c.push(`- Inbox Project: ${r.name} (id=${r.id})`);
4521
- for (const p of i[r.id] || [])
4521
+ for (const p of a[r.id] || [])
4522
4522
  c.push(` - Section: ${p.name} (id=${p.id})`);
4523
4523
  }
4524
4524
  if (n.length)
4525
4525
  for (const p of n)
4526
- c.push(...ws(p, i));
4526
+ c.push(...ws(p, a));
4527
4527
  else
4528
4528
  c.push("_No projects found._");
4529
4529
  c.push("");
@@ -4538,40 +4538,40 @@ async function Ga(e) {
4538
4538
  inbox: r ? {
4539
4539
  id: r.id,
4540
4540
  name: r.name,
4541
- sections: (i[r.id] || []).map(K)
4542
- } : null,
4541
+ sections: (a[r.id] || []).map(K)
4542
+ } : void 0,
4543
4543
  projects: n.map(
4544
- (p) => vs(p, i)
4544
+ (p) => vs(p, a)
4545
4545
  ),
4546
4546
  totalProjects: t.length,
4547
- totalSections: a.reduce(
4548
- (p, m) => p + (i[m]?.length || 0),
4547
+ totalSections: i.reduce(
4548
+ (p, m) => p + (a[m]?.length || 0),
4549
4549
  0
4550
4550
  ),
4551
4551
  hasNestedProjects: d
4552
4552
  };
4553
4553
  return { textContent: l, structuredContent: u };
4554
4554
  }
4555
- async function Va(e, t) {
4555
+ async function Vi(e, t) {
4556
4556
  const [r, o, n] = await Promise.all([
4557
4557
  e.getProject(t),
4558
- Ya(e, t),
4559
- qa(e, t)
4560
- ]), a = {};
4558
+ Yi(e, t),
4559
+ qi(e, t)
4560
+ ]), i = {};
4561
4561
  for (const u of o)
4562
- a[u.id] = [];
4563
- const i = [];
4562
+ i[u.id] = [];
4563
+ const a = [];
4564
4564
  for (const u of n)
4565
- (u.sectionId ? a[u.sectionId] ?? i : i).push(u);
4565
+ (u.sectionId ? i[u.sectionId] ?? a : a).push(u);
4566
4566
  const c = [`# ${r.name}`];
4567
- if (i.length > 0) {
4567
+ if (a.length > 0) {
4568
4568
  c.push("");
4569
- const u = xt(i);
4569
+ const u = xt(a);
4570
4570
  c.push(...qe(u));
4571
4571
  }
4572
4572
  for (const u of o) {
4573
4573
  c.push(""), c.push(`## ${u.name}`);
4574
- const p = a[u.id];
4574
+ const p = i[u.id];
4575
4575
  if (!p?.length)
4576
4576
  continue;
4577
4577
  const m = xt(p);
@@ -4593,32 +4593,32 @@ async function Va(e, t) {
4593
4593
  stats: {
4594
4594
  totalTasks: n.length,
4595
4595
  totalSections: o.length,
4596
- tasksWithoutSection: i.length
4596
+ tasksWithoutSection: a.length
4597
4597
  }
4598
4598
  };
4599
4599
  return { textContent: d, structuredContent: l };
4600
4600
  }
4601
- const Ja = {
4601
+ const Ji = {
4602
4602
  name: g.GET_OVERVIEW,
4603
4603
  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.",
4604
- parameters: Wa,
4605
- outputSchema: Ba,
4604
+ parameters: Wi,
4605
+ outputSchema: Bi,
4606
4606
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4607
4607
  async execute(e, t) {
4608
- const r = e.projectId ? await Va(t, e.projectId) : await Ga(t);
4608
+ const r = e.projectId ? await Vi(t, e.projectId) : await Gi(t);
4609
4609
  return {
4610
4610
  textContent: r.textContent,
4611
4611
  structuredContent: r.structuredContent
4612
4612
  };
4613
4613
  }
4614
- }, Xa = {}, ae = s.object({
4614
+ }, Xi = {}, ie = s.object({
4615
4615
  count: s.number().describe("Number of consecutive periods in this streak."),
4616
4616
  start: s.string().describe("Start date of the streak."),
4617
4617
  end: s.string().describe("End date of the streak.")
4618
4618
  }), At = s.object({
4619
4619
  id: s.string().describe("Project ID."),
4620
4620
  completed: s.number().describe("Number of tasks completed in this project.")
4621
- }), Za = {
4621
+ }), Zi = {
4622
4622
  completedCount: s.number().describe("Total number of completed tasks (all-time)."),
4623
4623
  daysItems: s.array(
4624
4624
  s.object({
@@ -4638,12 +4638,12 @@ const Ja = {
4638
4638
  goals: s.object({
4639
4639
  dailyGoal: s.number().describe("Daily task completion goal."),
4640
4640
  weeklyGoal: s.number().describe("Weekly task completion goal."),
4641
- currentDailyStreak: ae.describe("Current daily goal streak."),
4642
- currentWeeklyStreak: ae.describe("Current weekly goal streak."),
4643
- lastDailyStreak: ae.describe("Previous daily goal streak."),
4644
- lastWeeklyStreak: ae.describe("Previous weekly goal streak."),
4645
- maxDailyStreak: ae.describe("Best daily goal streak ever."),
4646
- maxWeeklyStreak: ae.describe("Best weekly goal streak ever."),
4641
+ currentDailyStreak: ie.describe("Current daily goal streak."),
4642
+ currentWeeklyStreak: ie.describe("Current weekly goal streak."),
4643
+ lastDailyStreak: ie.describe("Previous daily goal streak."),
4644
+ lastWeeklyStreak: ie.describe("Previous weekly goal streak."),
4645
+ maxDailyStreak: ie.describe("Best daily goal streak ever."),
4646
+ maxWeeklyStreak: ie.describe("Best weekly goal streak ever."),
4647
4647
  vacationMode: s.boolean().describe("Whether vacation mode is enabled."),
4648
4648
  karmaDisabled: s.boolean().describe("Whether karma tracking is disabled.")
4649
4649
  }).describe("Goal and streak information."),
@@ -4667,11 +4667,11 @@ const Ja = {
4667
4667
  })
4668
4668
  ).describe("Recent karma change events with reasons."),
4669
4669
  projectColors: s.record(s.string(), s.string()).describe("Map of project ID to color key.")
4670
- }, Qa = {
4670
+ }, Qi = {
4671
4671
  name: g.GET_PRODUCTIVITY_STATS,
4672
4672
  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.",
4673
- parameters: Xa,
4674
- outputSchema: Za,
4673
+ parameters: Xi,
4674
+ outputSchema: Zi,
4675
4675
  annotations: {
4676
4676
  readOnlyHint: !0,
4677
4677
  destructiveHint: !1,
@@ -4680,7 +4680,7 @@ const Ja = {
4680
4680
  async execute(e, t) {
4681
4681
  const r = await t.getProductivityStats();
4682
4682
  return {
4683
- textContent: ei(r),
4683
+ textContent: ea(r),
4684
4684
  structuredContent: {
4685
4685
  completedCount: r.completedCount,
4686
4686
  daysItems: r.daysItems,
@@ -4707,7 +4707,7 @@ const Ja = {
4707
4707
  };
4708
4708
  }
4709
4709
  };
4710
- function ei(e) {
4710
+ function ea(e) {
4711
4711
  const t = [
4712
4712
  "# Productivity Statistics",
4713
4713
  "",
@@ -4737,11 +4737,11 @@ function ei(e) {
4737
4737
  return t.join(`
4738
4738
  `);
4739
4739
  }
4740
- const ti = {
4740
+ const ta = {
4741
4741
  projectId: s.string().min(1).describe("The ID of the project to get activity stats for."),
4742
4742
  weeks: s.number().int().min(1).max(12).optional().describe("Number of weeks of activity data to retrieve (1-12, default 2)."),
4743
4743
  includeWeeklyCounts: s.boolean().optional().describe("Include weekly rollup counts alongside daily counts.")
4744
- }, si = {
4744
+ }, sa = {
4745
4745
  projectId: s.string().describe("The project ID."),
4746
4746
  dayItems: s.array(
4747
4747
  s.object({
@@ -4755,9 +4755,9 @@ const ti = {
4755
4755
  toDate: s.string().describe("End date of the week."),
4756
4756
  totalCount: s.number().describe("Number of tasks completed in this week.")
4757
4757
  })
4758
- ).nullable().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
4758
+ ).optional().describe("Weekly completion rollups. Only included when includeWeeklyCounts is true.")
4759
4759
  };
4760
- function ri(e, t) {
4760
+ function ra(e, t) {
4761
4761
  const r = [`# Activity Stats: Project ${e}`, ""];
4762
4762
  if (t.dayItems.length > 0) {
4763
4763
  r.push("## Daily Activity");
@@ -4773,47 +4773,47 @@ function ri(e, t) {
4773
4773
  return r.join(`
4774
4774
  `);
4775
4775
  }
4776
- const oi = {
4776
+ const oa = {
4777
4777
  name: g.GET_PROJECT_ACTIVITY_STATS,
4778
4778
  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.",
4779
- parameters: ti,
4780
- outputSchema: si,
4779
+ parameters: ta,
4780
+ outputSchema: sa,
4781
4781
  annotations: {
4782
4782
  readOnlyHint: !0,
4783
4783
  destructiveHint: !1,
4784
4784
  idempotentHint: !0
4785
4785
  },
4786
4786
  async execute(e, t) {
4787
- const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, a = await t.getProjectActivityStats(r, {
4787
+ const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, i = await t.getProjectActivityStats(r, {
4788
4788
  weeks: o,
4789
4789
  includeWeeklyCounts: n
4790
4790
  });
4791
4791
  return {
4792
- textContent: ri(r, a),
4792
+ textContent: ra(r, i),
4793
4793
  structuredContent: {
4794
4794
  projectId: r,
4795
- dayItems: a.dayItems,
4796
- weekItems: a.weekItems ?? null
4795
+ dayItems: i.dayItems,
4796
+ weekItems: i.weekItems ?? void 0
4797
4797
  }
4798
4798
  };
4799
4799
  }
4800
- }, ni = {
4800
+ }, na = {
4801
4801
  projectId: s.string().min(1).describe("The ID of the project to check health for."),
4802
4802
  includeContext: s.boolean().default(!1).describe(
4803
4803
  "Include detailed health context with project metrics and task-level data. May produce large output for projects with many tasks."
4804
4804
  )
4805
- }, ai = s.object({
4805
+ }, ia = s.object({
4806
4806
  taskId: s.string().describe("The ID of the task this recommendation is for."),
4807
4807
  recommendation: s.string().describe("The recommendation for this task.")
4808
- }), ii = s.object({
4808
+ }), aa = s.object({
4809
4809
  id: s.string().describe("The task ID."),
4810
4810
  content: s.string().describe("The task content/title."),
4811
4811
  priority: s.string().describe("The task priority (1-4)."),
4812
- due: s.string().nullable().optional().describe("The due date string, if set."),
4813
- deadline: s.string().nullable().optional().describe("The deadline date string, if set."),
4812
+ due: s.string().optional().describe("The due date string, if set."),
4813
+ deadline: s.string().optional().describe("The deadline date string, if set."),
4814
4814
  isCompleted: s.boolean().describe("Whether the task is completed."),
4815
4815
  labels: s.array(s.string()).describe("Labels applied to this task.")
4816
- }), ci = {
4816
+ }), ca = {
4817
4817
  projectId: s.string().describe("The project ID."),
4818
4818
  projectName: s.string().describe("The project name."),
4819
4819
  progress: s.object({
@@ -4823,36 +4823,36 @@ const oi = {
4823
4823
  }).describe("Project completion progress."),
4824
4824
  health: s.object({
4825
4825
  status: s.enum(Ge).describe("The overall health status of the project."),
4826
- description: s.string().nullable().optional().describe("Detailed description of the health assessment."),
4827
- descriptionSummary: s.string().nullable().optional().describe("Brief summary of the health assessment."),
4828
- taskRecommendations: s.array(ai).nullable().optional().describe("Specific recommendations for individual tasks."),
4826
+ description: s.string().optional().describe("Detailed description of the health assessment."),
4827
+ descriptionSummary: s.string().optional().describe("Brief summary of the health assessment."),
4828
+ taskRecommendations: s.array(ia).optional().describe("Specific recommendations for individual tasks."),
4829
4829
  isStale: s.boolean().describe("Whether the health data is stale and may need refreshing."),
4830
4830
  updateInProgress: s.boolean().describe("Whether a health analysis update is currently in progress."),
4831
- updatedAt: s.string().nullable().optional().describe("When the health assessment was last updated.")
4831
+ updatedAt: s.string().optional().describe("When the health assessment was last updated.")
4832
4832
  }).describe("Project health assessment."),
4833
4833
  context: s.object({
4834
- projectDescription: s.string().nullable().describe("The project description, if any."),
4834
+ projectDescription: s.string().optional().describe("The project description, if any."),
4835
4835
  projectMetrics: s.object({
4836
4836
  totalTasks: s.number().describe("Total number of tasks in the project."),
4837
4837
  completedTasks: s.number().describe("Number of completed tasks."),
4838
4838
  overdueTasks: s.number().describe("Number of overdue tasks."),
4839
4839
  tasksCreatedThisWeek: s.number().describe("Tasks created in the current week."),
4840
4840
  tasksCompletedThisWeek: s.number().describe("Tasks completed in the current week."),
4841
- averageCompletionTime: s.number().nullable().describe("Average task completion time in days, if available.")
4841
+ averageCompletionTime: s.number().optional().describe("Average task completion time in days, if available.")
4842
4842
  }).describe("Aggregated project metrics."),
4843
- tasks: s.array(ii).describe("Tasks in the project.")
4843
+ tasks: s.array(aa).describe("Tasks in the project.")
4844
4844
  }).optional().describe(
4845
4845
  "Detailed project context with metrics and task data. Only included when includeContext is true."
4846
4846
  )
4847
4847
  };
4848
- async function di(e, t, r) {
4848
+ async function da(e, t, r) {
4849
4849
  if (r) {
4850
- const [a, i, c] = await Promise.all([
4850
+ const [i, a, c] = await Promise.all([
4851
4851
  e.getProjectProgress(t),
4852
4852
  e.getProjectHealth(t),
4853
4853
  e.getProjectHealthContext(t)
4854
4854
  ]);
4855
- return { progress: a, health: i, context: c };
4855
+ return { progress: i, health: a, context: c };
4856
4856
  }
4857
4857
  const [o, n] = await Promise.all([
4858
4858
  e.getProjectProgress(t),
@@ -4860,58 +4860,61 @@ async function di(e, t, r) {
4860
4860
  ]);
4861
4861
  return { progress: o, health: n };
4862
4862
  }
4863
- function li(e, { progress: t, health: r, context: o }) {
4863
+ function la(e, { progress: t, health: r, context: o }) {
4864
4864
  const n = [`# Project Health: ${e}`, ""];
4865
4865
  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.toISOString()}`), n.push(""), n.push("## Progress"), n.push(
4866
4866
  `**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`
4867
4867
  ), r.description && (n.push(""), n.push("## Health Description"), n.push(r.description)), r.taskRecommendations && r.taskRecommendations.length > 0) {
4868
4868
  n.push(""), n.push("## Task Recommendations");
4869
- for (const a of r.taskRecommendations)
4870
- n.push(`- **Task ${a.taskId}**: ${a.recommendation}`);
4869
+ for (const i of r.taskRecommendations)
4870
+ n.push(`- **Task ${i.taskId}**: ${i.recommendation}`);
4871
4871
  }
4872
4872
  if (o) {
4873
4873
  n.push(""), n.push("## Project Metrics");
4874
- const a = o.projectMetrics;
4875
- 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) {
4874
+ const i = o.projectMetrics;
4875
+ 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) {
4876
4876
  n.push(""), n.push(`## Tasks (${o.tasks.length})`);
4877
- for (const i of o.tasks) {
4878
- const c = [`id=${i.id}`, i.content];
4879
- i.due && c.push(`due=${i.due}`), i.deadline && c.push(`deadline=${i.deadline}`), i.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4877
+ for (const a of o.tasks) {
4878
+ const c = [`id=${a.id}`, a.content];
4879
+ a.due && c.push(`due=${a.due}`), a.deadline && c.push(`deadline=${a.deadline}`), a.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4880
4880
  }
4881
4881
  }
4882
4882
  }
4883
4883
  return n.join(`
4884
4884
  `);
4885
4885
  }
4886
- const ui = {
4886
+ const ua = {
4887
4887
  name: g.GET_PROJECT_HEALTH,
4888
4888
  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.",
4889
- parameters: ni,
4890
- outputSchema: ci,
4889
+ parameters: na,
4890
+ outputSchema: ca,
4891
4891
  annotations: {
4892
4892
  readOnlyHint: !0,
4893
4893
  destructiveHint: !1,
4894
4894
  idempotentHint: !0
4895
4895
  },
4896
4896
  async execute(e, t) {
4897
- const { projectId: r, includeContext: o } = e, n = await di(t, r, o), a = n.context?.projectName ?? `Project ${r}`, i = li(a, n), c = n.context ? {
4898
- projectDescription: n.context.projectDescription,
4899
- projectMetrics: n.context.projectMetrics,
4897
+ const { projectId: r, includeContext: o } = e, n = await da(t, r, o), i = n.context?.projectName ?? `Project ${r}`, a = la(i, n), c = n.context ? {
4898
+ projectDescription: n.context.projectDescription ?? void 0,
4899
+ projectMetrics: {
4900
+ ...n.context.projectMetrics,
4901
+ averageCompletionTime: n.context.projectMetrics.averageCompletionTime ?? void 0
4902
+ },
4900
4903
  tasks: n.context.tasks.map((d) => ({
4901
4904
  id: d.id,
4902
4905
  content: d.content,
4903
4906
  priority: d.priority,
4904
- due: d.due ?? null,
4905
- deadline: d.deadline ?? null,
4907
+ due: d.due ?? void 0,
4908
+ deadline: d.deadline ?? void 0,
4906
4909
  isCompleted: d.isCompleted,
4907
4910
  labels: d.labels
4908
4911
  }))
4909
4912
  } : void 0;
4910
4913
  return {
4911
- textContent: i,
4914
+ textContent: a,
4912
4915
  structuredContent: {
4913
4916
  projectId: r,
4914
- projectName: a,
4917
+ projectName: i,
4915
4918
  progress: {
4916
4919
  completedCount: n.progress.completedCount,
4917
4920
  activeCount: n.progress.activeCount,
@@ -4919,69 +4922,68 @@ const ui = {
4919
4922
  },
4920
4923
  health: {
4921
4924
  status: n.health.status,
4922
- description: n.health.description ?? null,
4923
- descriptionSummary: n.health.descriptionSummary ?? null,
4924
- taskRecommendations: n.health.taskRecommendations ?? null,
4925
+ description: n.health.description ?? void 0,
4926
+ descriptionSummary: n.health.descriptionSummary ?? void 0,
4927
+ taskRecommendations: n.health.taskRecommendations ?? void 0,
4925
4928
  isStale: n.health.isStale,
4926
4929
  updateInProgress: n.health.updateInProgress,
4927
- updatedAt: n.health.updatedAt?.toISOString() ?? null
4930
+ updatedAt: n.health.updatedAt?.toISOString()
4928
4931
  },
4929
4932
  context: c
4930
4933
  }
4931
4934
  };
4932
4935
  }
4933
- }, pi = {
4936
+ }, pa = {
4934
4937
  workspaceIdOrName: s.string().min(1).describe(
4935
4938
  "The workspace ID or name. Supports exact ID, exact name match (case-insensitive), or unique partial name match."
4936
4939
  ),
4937
4940
  projectIds: s.array(s.string().min(1)).min(1).optional().describe("Optional list of project IDs to scope insights to specific projects.")
4938
- }, mi = s.object({
4941
+ }, ma = s.object({
4939
4942
  projectId: s.string().describe("The project ID."),
4940
4943
  health: s.object({
4941
4944
  status: s.enum(Ge).describe("The health status of the project."),
4942
4945
  isStale: s.boolean().describe("Whether the health data is stale."),
4943
4946
  updateInProgress: s.boolean().describe("Whether a health analysis update is in progress.")
4944
- }).nullable().describe("Health data for this project, if available."),
4947
+ }).optional().describe("Health data for this project. Omitted when the project has none."),
4945
4948
  progress: s.object({
4946
4949
  completedCount: s.number().describe("Number of completed tasks."),
4947
4950
  activeCount: s.number().describe("Number of active tasks."),
4948
4951
  progressPercent: s.number().describe("Completion percentage (0-100).")
4949
- }).nullable().describe("Progress data for this project, if available.")
4950
- }), hi = {
4952
+ }).optional().describe("Progress data for this project. Omitted when the project has none.")
4953
+ }), ha = {
4951
4954
  workspaceId: s.string().describe("The resolved workspace ID."),
4952
4955
  workspaceName: s.string().describe("The resolved workspace name."),
4953
- folderId: s.string().nullable().describe("The folder ID, if applicable."),
4954
- projectInsights: s.array(mi).describe("Health and progress insights for each project in the workspace.")
4955
- }, fi = {
4956
+ projectInsights: s.array(ma).describe("Health and progress insights for each project in the workspace.")
4957
+ }, fa = {
4956
4958
  name: g.GET_WORKSPACE_INSIGHTS,
4957
4959
  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.",
4958
- parameters: pi,
4959
- outputSchema: hi,
4960
+ parameters: pa,
4961
+ outputSchema: ha,
4960
4962
  annotations: {
4961
4963
  readOnlyHint: !0,
4962
4964
  destructiveHint: !1,
4963
4965
  idempotentHint: !0
4964
4966
  },
4965
4967
  async execute(e, t) {
4966
- const { workspaceIdOrName: r, projectIds: o } = e, n = await is.resolveWorkspace(t, r), a = await t.getWorkspaceInsights(n.workspaceId, { projectIds: o }), i = a.projectInsights.map((d) => ({
4968
+ const { workspaceIdOrName: r, projectIds: o } = e, n = await as.resolveWorkspace(t, r), a = (await t.getWorkspaceInsights(n.workspaceId, { projectIds: o })).projectInsights.map((d) => ({
4967
4969
  projectId: d.projectId,
4968
4970
  health: d.health ? {
4969
4971
  status: d.health.status,
4970
4972
  isStale: d.health.isStale,
4971
4973
  updateInProgress: d.health.updateInProgress
4972
- } : null,
4974
+ } : void 0,
4973
4975
  progress: d.progress ? {
4974
4976
  completedCount: d.progress.completedCount,
4975
4977
  activeCount: d.progress.activeCount,
4976
4978
  progressPercent: d.progress.progressPercent
4977
- } : null
4979
+ } : void 0
4978
4980
  })), c = [
4979
4981
  `# Workspace Insights: ${n.workspaceName}`,
4980
4982
  "",
4981
- `**Projects:** ${i.length}`,
4983
+ `**Projects:** ${a.length}`,
4982
4984
  ""
4983
4985
  ];
4984
- for (const d of i) {
4986
+ for (const d of a) {
4985
4987
  const l = d.health?.status ?? "N/A", u = d.progress ? `${d.progress.progressPercent}%` : "N/A";
4986
4988
  c.push(`- Project ${d.projectId}: status=${l}, progress=${u}`);
4987
4989
  }
@@ -4991,13 +4993,12 @@ const ui = {
4991
4993
  structuredContent: {
4992
4994
  workspaceId: n.workspaceId,
4993
4995
  workspaceName: n.workspaceName,
4994
- folderId: a.folderId,
4995
- projectInsights: i
4996
+ projectInsights: a
4996
4997
  }
4997
4998
  };
4998
4999
  }
4999
5000
  };
5000
- function bi(e) {
5001
+ function ba(e) {
5001
5002
  const t = e.trim();
5002
5003
  if (!/^https?:\/\//i.test(t))
5003
5004
  return t;
@@ -5007,23 +5008,23 @@ function bi(e) {
5007
5008
  } catch {
5008
5009
  throw new Error(`Could not read a template ID from "${t}".`);
5009
5010
  }
5010
- if (!gi(r.hostname))
5011
+ if (!ga(r.hostname))
5011
5012
  throw new Error(
5012
5013
  `"${r.hostname}" is not a Todoist domain. Pass a todoist.com template URL or the template ID itself.`
5013
5014
  );
5014
5015
  const o = r.pathname.split("/").filter(Boolean);
5015
5016
  if (!o.includes("templates"))
5016
5017
  throw new Error(`"${t}" is not a Todoist template URL.`);
5017
- const n = o.at(-1), a = n === "view" ? o.at(-2) : n;
5018
- if (!a)
5018
+ const n = o.at(-1), i = n === "view" ? o.at(-2) : n;
5019
+ if (!i)
5019
5020
  throw new Error(`Could not read a template ID from "${t}".`);
5020
- return a;
5021
+ return i;
5021
5022
  }
5022
- function gi(e) {
5023
+ function ga(e) {
5023
5024
  const t = e.toLowerCase();
5024
5025
  return t === "todoist.com" || t.endsWith(".todoist.com");
5025
5026
  }
5026
- const yi = {
5027
+ const ya = {
5027
5028
  projectId: s.string().min(1).describe("The ID of the existing project to import the template into."),
5028
5029
  templateId: s.string().optional().describe(
5029
5030
  'The template to import — either a gallery slug ("product-launch"), a personal template ID ("UT_28Ex..."), or a full Todoist template URL, which is reduced to the ID automatically. Gallery templates work for anyone; personal templates only for the account that owns them. There is no way to list templates through this server, so only use the ID or URL the user supplied. Provide either this or `csvFileContent`, not both.'
@@ -5032,57 +5033,57 @@ const yi = {
5032
5033
  "Raw CSV template content, as produced by export-project-template. Provide either this or `templateId`, not both."
5033
5034
  ),
5034
5035
  locale: s.string().optional().describe('Locale for the imported content when using `templateId`. Defaults to "en".')
5035
- }, Ti = {
5036
+ }, Ta = {
5036
5037
  sections: s.array(X).describe("Sections created by the import."),
5037
5038
  tasks: s.array(F).describe("Tasks created by the import."),
5038
5039
  comments: s.array(ye).describe("Comments created by the import."),
5039
5040
  totalCount: s.number().describe("The total number of objects created by the import.")
5040
- }, ki = {
5041
+ }, ka = {
5041
5042
  name: g.IMPORT_PROJECT_TEMPLATE,
5042
5043
  description: "Import a template into an existing project, adding its tasks, sections and comments to whatever is already there. Source it by template ID/URL or by passing CSV content from export-project-template. To start a new project from a template, create the project with add-projects first, then import into it. This writes immediately and cannot be undone, so only run it against a project the user named.",
5043
- parameters: yi,
5044
- outputSchema: Ti,
5044
+ parameters: ya,
5045
+ outputSchema: Ta,
5045
5046
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
5046
5047
  async execute({ projectId: e, templateId: t, csvFileContent: r, locale: o }, n) {
5047
5048
  if (!!t == !!r)
5048
5049
  throw new Error(
5049
5050
  "Provide exactly one template source: either `templateId` or `csvFileContent`. Templates cannot be listed through this server — ask the user for an ID or template URL."
5050
5051
  );
5051
- const a = t ? await n.importTemplateFromId({
5052
+ const i = t ? await n.importTemplateFromId({
5052
5053
  projectId: e,
5053
- templateId: bi(t),
5054
+ templateId: ba(t),
5054
5055
  locale: o
5055
5056
  }) : await n.importTemplateIntoProject({
5056
5057
  projectId: e,
5057
5058
  file: r ?? "",
5058
5059
  fileName: "template.csv"
5059
- }), i = a.sections.map(K), c = a.tasks.map(P), d = a.comments.map(ge), l = a.projects.length + i.length + c.length + d.length;
5060
+ }), a = i.sections.map(K), c = i.tasks.map(P), d = i.comments.map(ge), l = i.projects.length + a.length + c.length + d.length;
5060
5061
  return {
5061
- textContent: wi({
5062
+ textContent: wa({
5062
5063
  projectId: e,
5063
5064
  counts: {
5064
- projects: a.projects.length,
5065
- sections: i.length,
5065
+ projects: i.projects.length,
5066
+ sections: a.length,
5066
5067
  tasks: c.length,
5067
5068
  comments: d.length
5068
5069
  },
5069
5070
  totalCount: l
5070
5071
  }),
5071
- structuredContent: { sections: i, tasks: c, comments: d, totalCount: l }
5072
+ structuredContent: { sections: a, tasks: c, comments: d, totalCount: l }
5072
5073
  };
5073
5074
  }
5074
5075
  };
5075
- function wi({
5076
+ function wa({
5076
5077
  projectId: e,
5077
5078
  counts: t,
5078
5079
  totalCount: r
5079
5080
  }) {
5080
5081
  if (r === 0)
5081
5082
  return `Imported template into project (id=${e}), but it created nothing.`;
5082
- const o = Object.entries(t).filter(([, n]) => n > 0).map(([n, a]) => `${a} ${a === 1 ? n.replace(/s$/, "") : n}`);
5083
+ const o = Object.entries(t).filter(([, n]) => n > 0).map(([n, i]) => `${i} ${i === 1 ? n.replace(/s$/, "") : n}`);
5083
5084
  return `Imported template into project (id=${e}): ${o.join(", ")}.`;
5084
5085
  }
5085
- const vi = {}, Ii = {
5086
+ const va = {}, Ia = {
5086
5087
  id: s.string().describe("The unique identifier for the workspace."),
5087
5088
  name: s.string().describe("The name of the workspace."),
5088
5089
  plan: s.enum(Hs).describe("The workspace plan type."),
@@ -5091,21 +5092,21 @@ const vi = {}, Ii = {
5091
5092
  isGuestAllowed: s.boolean().describe("Whether guests are allowed in the workspace."),
5092
5093
  createdAt: s.string().optional().describe("The ISO 8601 timestamp when the workspace was created."),
5093
5094
  creatorId: s.string().describe("The ID of the user who created the workspace.")
5094
- }, Si = {
5095
+ }, Sa = {
5095
5096
  type: s.literal("workspaces").describe("The type of the response."),
5096
- workspaces: s.array(s.object(Ii)).describe("List of workspaces."),
5097
+ workspaces: s.array(s.object(Ia)).describe("List of workspaces."),
5097
5098
  count: s.number().describe("The total number of workspaces.")
5098
5099
  };
5099
- async function ji(e) {
5100
- const r = (await e.getWorkspaces()).map((i) => ({
5101
- id: i.id,
5102
- name: i.name,
5103
- plan: i.plan,
5104
- role: i.role,
5105
- isLinkSharingEnabled: i.isLinkSharingEnabled,
5106
- isGuestAllowed: i.isGuestAllowed,
5107
- createdAt: i.createdAt?.toISOString(),
5108
- creatorId: i.creatorId
5100
+ async function ja(e) {
5101
+ const r = (await e.getWorkspaces()).map((a) => ({
5102
+ id: a.id,
5103
+ name: a.name,
5104
+ plan: a.plan,
5105
+ role: a.role,
5106
+ isLinkSharingEnabled: a.isLinkSharingEnabled,
5107
+ isGuestAllowed: a.isGuestAllowed,
5108
+ createdAt: a.createdAt?.toISOString(),
5109
+ creatorId: a.creatorId
5109
5110
  })), o = ["# Workspaces", ""];
5110
5111
  if (r.length === 0)
5111
5112
  o.push("No workspaces found.");
@@ -5114,35 +5115,35 @@ async function ji(e) {
5114
5115
  `Found ${r.length} workspace${r.length === 1 ? "" : "s"}:`,
5115
5116
  ""
5116
5117
  );
5117
- for (const i of r)
5118
- o.push(`## ${i.name}`), o.push(`- **ID:** ${i.id}`), o.push(`- **Plan:** ${i.plan}`), i.role && o.push(`- **Your Role:** ${i.role}`), o.push(
5119
- `- **Link Sharing:** ${i.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
5120
- ), o.push(`- **Guests Allowed:** ${i.isGuestAllowed ? "Yes" : "No"}`), i.createdAt && o.push(`- **Created:** ${i.createdAt}`), o.push(`- **Creator ID:** ${i.creatorId}`), o.push("");
5118
+ for (const a of r)
5119
+ o.push(`## ${a.name}`), o.push(`- **ID:** ${a.id}`), o.push(`- **Plan:** ${a.plan}`), a.role && o.push(`- **Your Role:** ${a.role}`), o.push(
5120
+ `- **Link Sharing:** ${a.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
5121
+ ), o.push(`- **Guests Allowed:** ${a.isGuestAllowed ? "Yes" : "No"}`), a.createdAt && o.push(`- **Created:** ${a.createdAt}`), o.push(`- **Creator ID:** ${a.creatorId}`), o.push("");
5121
5122
  }
5122
5123
  const n = o.join(`
5123
- `), a = {
5124
+ `), i = {
5124
5125
  type: "workspaces",
5125
5126
  workspaces: r,
5126
5127
  count: r.length
5127
5128
  };
5128
- return { textContent: n, structuredContent: a };
5129
+ return { textContent: n, structuredContent: i };
5129
5130
  }
5130
- const Ci = {
5131
+ const Ca = {
5131
5132
  name: g.LIST_WORKSPACES,
5132
5133
  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.",
5133
- parameters: vi,
5134
- outputSchema: Si,
5134
+ parameters: va,
5135
+ outputSchema: Sa,
5135
5136
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5136
5137
  async execute(e, t) {
5137
- const r = await ji(t);
5138
+ const r = await ja(t);
5138
5139
  return {
5139
5140
  textContent: r.textContent,
5140
5141
  structuredContent: r.structuredContent
5141
5142
  };
5142
5143
  }
5143
- }, { FIND_TASKS: $i, FIND_PROJECT_COLLABORATORS: Et, UPDATE_TASKS: Di } = g, xi = 50, Ai = {
5144
+ }, { FIND_TASKS: $a, FIND_PROJECT_COLLABORATORS: Et, UPDATE_TASKS: Da } = g, xa = 50, Aa = {
5144
5145
  operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
5145
- taskIds: s.array(s.string()).min(1).max(xi).describe("The IDs of the tasks to operate on (max 50)."),
5146
+ taskIds: s.array(s.string()).min(1).max(xa).describe("The IDs of the tasks to operate on (max 50)."),
5146
5147
  responsibleUser: s.string().optional().describe(
5147
5148
  '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.'
5148
5149
  ),
@@ -5150,7 +5151,7 @@ const Ci = {
5150
5151
  "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."
5151
5152
  ),
5152
5153
  dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
5153
- }, Ei = {
5154
+ }, Ea = {
5154
5155
  results: s.array(
5155
5156
  s.object({
5156
5157
  taskId: s.string().describe("The ID of the task."),
@@ -5166,14 +5167,14 @@ const Ci = {
5166
5167
  failed: s.number().describe("Number of failed operations."),
5167
5168
  dryRun: s.boolean().describe("Whether this was a dry run.")
5168
5169
  }).optional().describe("Summary of the operation.")
5169
- }, Oi = {
5170
+ }, Oa = {
5170
5171
  name: g.MANAGE_ASSIGNMENTS,
5171
5172
  description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
5172
- parameters: Ai,
5173
- outputSchema: Ei,
5173
+ parameters: Aa,
5174
+ outputSchema: Ea,
5174
5175
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5175
5176
  async execute(e, t) {
5176
- const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: a, dryRun: i } = e;
5177
+ const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: i, dryRun: a } = e;
5177
5178
  if ((r === "assign" || r === "reassign") && !n)
5178
5179
  throw new Error(`${r} operation requires responsibleUser parameter`);
5179
5180
  const c = await Promise.allSettled(
@@ -5202,7 +5203,7 @@ const Ci = {
5202
5203
  throw new Error(`All ${l.length} task(s) failed: ${k}`);
5203
5204
  }
5204
5205
  let u;
5205
- r === "reassign" && a && (u = (await W.resolveUser(t, a))?.userId || a);
5206
+ r === "reassign" && i && (u = (await W.resolveUser(t, i))?.userId || i);
5206
5207
  const p = [];
5207
5208
  for (const k of d)
5208
5209
  r === "reassign" && u && k.responsibleUid !== u || p.push({
@@ -5212,7 +5213,7 @@ const Ci = {
5212
5213
  // Will be validated appropriately
5213
5214
  });
5214
5215
  if (r === "unassign") {
5215
- if (i) {
5216
+ if (a) {
5216
5217
  const b = d.map(($) => ({
5217
5218
  taskId: $.id,
5218
5219
  success: !0,
@@ -5272,7 +5273,7 @@ const Ci = {
5272
5273
  }
5273
5274
  };
5274
5275
  }
5275
- const m = await it.validateBulkAssignment(
5276
+ const m = await at.validateBulkAssignment(
5276
5277
  t,
5277
5278
  p
5278
5279
  ), h = [], y = [];
@@ -5333,7 +5334,7 @@ const Ci = {
5333
5334
  );
5334
5335
  return Promise.all(T);
5335
5336
  }
5336
- const v = await f(h, !i), j = [...v, ...y, ...l];
5337
+ const v = await f(h, !a), j = [...v, ...y, ...l];
5337
5338
  if (j.length > 0 && j.every((k) => !k.success)) {
5338
5339
  const k = j.map((I) => `"${I.taskId}": ${I.error}`).join("; ");
5339
5340
  throw new Error(`All ${j.length} ${r} operation(s) failed: ${k}`);
@@ -5342,7 +5343,7 @@ const Ci = {
5342
5343
  textContent: Oe({
5343
5344
  operation: r,
5344
5345
  results: j,
5345
- dryRun: i
5346
+ dryRun: a
5346
5347
  }),
5347
5348
  structuredContent: {
5348
5349
  operation: r,
@@ -5350,7 +5351,7 @@ const Ci = {
5350
5351
  totalRequested: o.length,
5351
5352
  successful: v.filter((k) => k.success).length,
5352
5353
  failed: j.filter((k) => !k.success).length,
5353
- dryRun: i
5354
+ dryRun: a
5354
5355
  }
5355
5356
  };
5356
5357
  }
@@ -5360,7 +5361,7 @@ function Oe({
5360
5361
  results: t,
5361
5362
  dryRun: r
5362
5363
  }) {
5363
- const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), a = r ? "would be" : "were", i = {
5364
+ const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), i = r ? "would be" : "were", a = {
5364
5365
  assign: "assigned",
5365
5366
  unassign: "unassigned",
5366
5367
  reassign: "reassigned"
@@ -5369,7 +5370,7 @@ function Oe({
5369
5370
 
5370
5371
  `;
5371
5372
  if (o.length > 0) {
5372
- c += `**${o.length} task${o.length === 1 ? "" : "s"} ${a} successfully ${i}**
5373
+ c += `**${o.length} task${o.length === 1 ? "" : "s"} ${i} successfully ${a}**
5373
5374
  `;
5374
5375
  const d = o.slice(0, 5);
5375
5376
  for (const l of d) {
@@ -5393,8 +5394,8 @@ function Oe({
5393
5394
  `;
5394
5395
  }
5395
5396
  return !r && o.length > 0 ? (c += `**Next steps:**
5396
- `, c += `• Use ${$i} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
5397
- `, c += `• Use ${Di} for individual assignment changes
5397
+ `, c += `• Use ${$a} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
5398
+ `, c += `• Use ${Da} for individual assignment changes
5398
5399
  `, n.length > 0 && (c += `• Check failed tasks and use ${Et} to verify collaborator access
5399
5400
  `)) : r ? (c += `**To execute:**
5400
5401
  `, c += `• Remove dryRun parameter and run again to execute changes
@@ -5406,17 +5407,17 @@ function Oe({
5406
5407
  `, c += `• Use dryRun=true to validate before executing
5407
5408
  `), c;
5408
5409
  }
5409
- const Pi = {
5410
+ const Pa = {
5410
5411
  action: s.enum(["archive", "unarchive"]).describe("The action to perform on the project."),
5411
5412
  projectId: s.string().min(1).describe("The ID of the project.")
5412
- }, _i = {
5413
+ }, _a = {
5413
5414
  project: Q.describe("The updated project."),
5414
5415
  success: s.boolean().describe("Whether the action was successful.")
5415
- }, Ri = {
5416
+ }, Ra = {
5416
5417
  name: g.PROJECT_MANAGEMENT,
5417
5418
  description: "Archive or unarchive a project by its ID.",
5418
- parameters: Pi,
5419
- outputSchema: _i,
5419
+ parameters: Pa,
5420
+ outputSchema: _a,
5420
5421
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
5421
5422
  async execute(e, t) {
5422
5423
  const r = e.action === "archive" ? await t.archiveProject(e.projectId) : await t.unarchiveProject(e.projectId), o = Z(r);
@@ -5428,7 +5429,7 @@ const Pi = {
5428
5429
  }
5429
5430
  };
5430
5431
  }
5431
- }, Ui = {
5432
+ }, Ua = {
5432
5433
  action: s.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
5433
5434
  projectId: s.string().min(1).describe("The ID of the project to move."),
5434
5435
  workspaceId: s.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
@@ -5436,25 +5437,25 @@ const Pi = {
5436
5437
  visibility: s.enum(["restricted", "team", "public"]).optional().describe(
5437
5438
  "Optional access visibility for the project in the workspace (restricted, team, or public)."
5438
5439
  )
5439
- }, Li = {
5440
+ }, La = {
5440
5441
  project: Q.describe("The moved project."),
5441
5442
  success: s.boolean().describe("Whether the move was successful.")
5442
- }, Ni = {
5443
+ }, Na = {
5443
5444
  name: g.PROJECT_MOVE,
5444
5445
  description: "Move a project between personal and workspace contexts.",
5445
- parameters: Ui,
5446
- outputSchema: Li,
5446
+ parameters: Ua,
5447
+ outputSchema: La,
5447
5448
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
5448
5449
  async execute(e, t) {
5449
5450
  let r;
5450
5451
  if (e.action === "move-to-workspace") {
5451
5452
  if (!e.workspaceId)
5452
5453
  throw new Error("workspaceId is required when action is move-to-workspace");
5453
- const a = {
5454
+ const i = {
5454
5455
  projectId: e.projectId,
5455
5456
  workspaceId: e.workspaceId
5456
5457
  };
5457
- e.folderId && (a.folderId = e.folderId), e.visibility && (a.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(a);
5458
+ e.folderId && (i.folderId = e.folderId), e.visibility && (i.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(i);
5458
5459
  } else
5459
5460
  r = await t.moveProjectToPersonal({ projectId: e.projectId });
5460
5461
  const o = Z(r);
@@ -5466,7 +5467,7 @@ const Pi = {
5466
5467
  }
5467
5468
  };
5468
5469
  }
5469
- }, Is = ["project", "section"], Mi = {
5470
+ }, Is = ["project", "section"], Ma = {
5470
5471
  type: s.enum(Is).describe(
5471
5472
  '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.'
5472
5473
  ),
@@ -5483,17 +5484,17 @@ const Pi = {
5483
5484
  ).min(1).describe(
5484
5485
  "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."
5485
5486
  )
5486
- }, Fi = {
5487
+ }, Fa = {
5487
5488
  type: s.enum(Is).describe("The type of entity that was reordered/moved."),
5488
5489
  movedCount: s.number().describe("The number of entities moved to a new parent."),
5489
5490
  reorderedCount: s.number().describe("The number of entities reordered."),
5490
5491
  affectedIds: s.array(s.string()).describe("The IDs of all affected entities."),
5491
5492
  success: s.boolean().describe("Whether the operation was successful.")
5492
- }, Hi = {
5493
+ }, Ha = {
5493
5494
  name: g.REORDER_OBJECTS,
5494
5495
  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.',
5495
- parameters: Mi,
5496
- outputSchema: Fi,
5496
+ parameters: Ma,
5497
+ outputSchema: Fa,
5497
5498
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
5498
5499
  async execute(e, t) {
5499
5500
  const { type: r, items: o } = e, n = /* @__PURE__ */ new Set();
@@ -5509,10 +5510,10 @@ const Pi = {
5509
5510
  `parentId is only supported when type is "project", but type is "${r}".`
5510
5511
  );
5511
5512
  }
5512
- const a = [], i = o.filter((p) => p.parentId !== void 0);
5513
- for (const p of i) {
5513
+ const i = [], a = o.filter((p) => p.parentId !== void 0);
5514
+ for (const p of a) {
5514
5515
  const m = p.parentId;
5515
- a.push(
5516
+ i.push(
5516
5517
  V("project_move", {
5517
5518
  id: p.id,
5518
5519
  parentId: m === "root" ? null : m
@@ -5522,14 +5523,14 @@ const Pi = {
5522
5523
  const c = o.filter(
5523
5524
  (p) => p.order !== void 0
5524
5525
  );
5525
- c.length > 0 && (r === "project" ? a.push(
5526
+ c.length > 0 && (r === "project" ? i.push(
5526
5527
  V("project_reorder", {
5527
5528
  projects: c.map((p) => ({
5528
5529
  id: p.id,
5529
5530
  childOrder: p.order
5530
5531
  }))
5531
5532
  })
5532
- ) : a.push(
5533
+ ) : i.push(
5533
5534
  V("section_reorder", {
5534
5535
  sections: c.map((p) => ({
5535
5536
  id: p.id,
@@ -5538,39 +5539,39 @@ const Pi = {
5538
5539
  })
5539
5540
  ));
5540
5541
  try {
5541
- await t.sync({ commands: a });
5542
+ await t.sync({ commands: i });
5542
5543
  } catch (p) {
5543
5544
  const m = p instanceof Error ? p.message : String(p);
5544
5545
  throw new Error(`Reorder failed: ${m}`);
5545
5546
  }
5546
5547
  const d = r === "project" ? "projects" : "sections", l = o.map((p) => p.id), u = [];
5547
- return i.length > 0 && u.push(`moved ${i.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
5548
+ return a.length > 0 && u.push(`moved ${a.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
5548
5549
  textContent: `${u.join(" and ")} ${d}: ${l.map((p) => `id=${p}`).join(", ")}`,
5549
5550
  structuredContent: {
5550
5551
  type: r,
5551
- movedCount: i.length,
5552
+ movedCount: a.length,
5552
5553
  reorderedCount: c.length,
5553
5554
  affectedIds: l,
5554
5555
  success: !0
5555
5556
  }
5556
5557
  };
5557
5558
  }
5558
- }, Wi = s.object({
5559
+ }, Wa = s.object({
5559
5560
  id: s.string().min(1).describe("The ID of the task to reschedule."),
5560
5561
  date: s.string().min(1).describe(
5561
5562
  "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."
5562
5563
  )
5563
- }), Bi = {
5564
- tasks: s.array(Wi).min(1).describe("The tasks to reschedule with their new dates.")
5565
- }, zi = {
5564
+ }), Ba = {
5565
+ tasks: s.array(Wa).min(1).describe("The tasks to reschedule with their new dates.")
5566
+ }, za = {
5566
5567
  tasks: s.array(F).describe("The rescheduled tasks."),
5567
5568
  totalCount: s.number().describe("The total number of tasks rescheduled."),
5568
5569
  rescheduledTaskIds: s.array(s.string()).describe("The IDs of the rescheduled tasks.")
5569
- }, Ki = {
5570
+ }, Ka = {
5570
5571
  name: g.RESCHEDULE_TASKS,
5571
5572
  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.",
5572
- parameters: Bi,
5573
- outputSchema: zi,
5573
+ parameters: Ba,
5574
+ outputSchema: za,
5574
5575
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5575
5576
  async execute(e, t) {
5576
5577
  const { tasks: r } = e, n = (await Promise.all(
@@ -5583,7 +5584,7 @@ const Pi = {
5583
5584
  throw new Error(
5584
5585
  `Task "${l.content}" (${l.id}) has no due date. Rescheduling requires an existing due date.`
5585
5586
  );
5586
- const u = qi(d.date, l.due);
5587
+ const u = qa(d.date, l.due);
5587
5588
  return V("item_update", {
5588
5589
  id: d.id,
5589
5590
  due: {
@@ -5601,29 +5602,29 @@ const Pi = {
5601
5602
  const l = d instanceof Error ? d.message : String(d);
5602
5603
  throw new Error(`Reschedule failed: ${l}`);
5603
5604
  }
5604
- const a = await Promise.all(r.map((d) => t.getTask(d.id))), i = a.map(P);
5605
+ const i = await Promise.all(r.map((d) => t.getTask(d.id))), a = i.map(P);
5605
5606
  return {
5606
- textContent: ot("Rescheduled", i, {
5607
- showDetails: i.length <= 5
5607
+ textContent: ot("Rescheduled", a, {
5608
+ showDetails: a.length <= 5
5608
5609
  }),
5609
5610
  structuredContent: {
5610
- tasks: i,
5611
- totalCount: i.length,
5612
- rescheduledTaskIds: a.map((d) => d.id)
5611
+ tasks: a,
5612
+ totalCount: a.length,
5613
+ rescheduledTaskIds: i.map((d) => d.id)
5613
5614
  }
5614
5615
  };
5615
5616
  }
5616
5617
  };
5617
- function qi(e, t) {
5618
+ function qa(e, t) {
5618
5619
  if (/^\d{4}-\d{2}-\d{2}$/.test(e) && t.datetime) {
5619
5620
  const o = t.datetime.substring(10);
5620
5621
  return e + o;
5621
5622
  }
5622
5623
  return e;
5623
5624
  }
5624
- const Yi = {
5625
+ const Ya = {
5625
5626
  query: s.string().min(1).describe("The search query string to find tasks and projects.")
5626
- }, Gi = {
5627
+ }, Ga = {
5627
5628
  results: s.array(
5628
5629
  s.object({
5629
5630
  id: s.string().describe("The ID of the result."),
@@ -5632,11 +5633,11 @@ const Yi = {
5632
5633
  })
5633
5634
  ).describe("The search results."),
5634
5635
  totalCount: s.number().describe("Total number of results found.")
5635
- }, Vi = {
5636
+ }, Va = {
5636
5637
  name: g.SEARCH,
5637
5638
  description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
5638
- parameters: Yi,
5639
- outputSchema: Gi,
5639
+ parameters: Ya,
5640
+ outputSchema: Ga,
5640
5641
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5641
5642
  async execute(e, t) {
5642
5643
  const { query: r } = e, [o, n] = await Promise.all([
@@ -5647,52 +5648,52 @@ const Yi = {
5647
5648
  cursor: void 0
5648
5649
  }),
5649
5650
  rs(t, r)
5650
- ]), a = [];
5651
- for (const i of o.tasks)
5652
- a.push({
5653
- id: `task:${i.id}`,
5654
- title: i.content,
5655
- url: Mt(i.id)
5651
+ ]), i = [];
5652
+ for (const a of o.tasks)
5653
+ i.push({
5654
+ id: `task:${a.id}`,
5655
+ title: a.content,
5656
+ url: Mt(a.id)
5656
5657
  });
5657
- for (const i of n)
5658
- a.push({
5659
- id: `project:${i.id}`,
5660
- title: i.name,
5661
- url: Ft(i.id)
5658
+ for (const a of n)
5659
+ i.push({
5660
+ id: `project:${a.id}`,
5661
+ title: a.name,
5662
+ url: Ft(a.id)
5662
5663
  });
5663
5664
  return {
5664
- textContent: JSON.stringify({ results: a }),
5665
- structuredContent: { results: a, totalCount: a.length }
5665
+ textContent: JSON.stringify({ results: i }),
5666
+ structuredContent: { results: i, totalCount: i.length }
5666
5667
  };
5667
5668
  }
5668
- }, Ji = {
5669
+ }, Ja = {
5669
5670
  ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to uncomplete.")
5670
- }, Xi = {
5671
+ }, Xa = {
5671
5672
  uncompleted: s.array(s.string()).describe("The IDs of successfully uncompleted tasks."),
5672
5673
  failures: s.array(ee).describe("Failed task uncompletion with error details."),
5673
5674
  totalRequested: s.number().describe("The total number of tasks requested to uncomplete."),
5674
5675
  successCount: s.number().describe("The number of successfully uncompleted tasks."),
5675
5676
  failureCount: s.number().describe("The number of failed task uncompletions.")
5676
- }, Zi = {
5677
+ }, Za = {
5677
5678
  name: g.UNCOMPLETE_TASKS,
5678
5679
  description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
5679
- parameters: Ji,
5680
- outputSchema: Xi,
5680
+ parameters: Ja,
5681
+ outputSchema: Xa,
5681
5682
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
5682
5683
  async execute(e, t) {
5683
5684
  const r = [], o = [];
5684
- for (const a of e.ids)
5685
+ for (const i of e.ids)
5685
5686
  try {
5686
- await t.reopenTask(a), r.push(a);
5687
- } catch (i) {
5688
- const c = i instanceof Error ? i.message : "Unknown error";
5687
+ await t.reopenTask(i), r.push(i);
5688
+ } catch (a) {
5689
+ const c = a instanceof Error ? a.message : "Unknown error";
5689
5690
  o.push({
5690
- item: a,
5691
+ item: i,
5691
5692
  error: c
5692
5693
  });
5693
5694
  }
5694
5695
  return {
5695
- textContent: Qi({
5696
+ textContent: Qa({
5696
5697
  uncompleted: r,
5697
5698
  failures: o,
5698
5699
  args: e
@@ -5707,7 +5708,7 @@ const Yi = {
5707
5708
  };
5708
5709
  }
5709
5710
  };
5710
- function Qi({
5711
+ function Qa({
5711
5712
  uncompleted: e,
5712
5713
  failures: t,
5713
5714
  args: r
@@ -5740,31 +5741,31 @@ const ec = s.object({
5740
5741
  outputSchema: sc,
5741
5742
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5742
5743
  async execute(e, t) {
5743
- const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), a = (await Promise.all(o)).map(ge);
5744
+ const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), i = (await Promise.all(o)).map(ge);
5744
5745
  return {
5745
5746
  textContent: oc({
5746
- comments: a
5747
+ comments: i
5747
5748
  }),
5748
5749
  structuredContent: {
5749
- comments: a,
5750
- totalCount: a.length,
5751
- updatedCommentIds: a.map((c) => c.id),
5750
+ comments: i,
5751
+ totalCount: i.length,
5752
+ updatedCommentIds: i.map((c) => c.id),
5752
5753
  appliedOperations: {
5753
- updateCount: a.length
5754
+ updateCount: i.length
5754
5755
  }
5755
5756
  }
5756
5757
  };
5757
5758
  }
5758
5759
  };
5759
5760
  function oc({ comments: e }) {
5760
- const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
5761
+ const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
5761
5762
  if (t > 0) {
5762
- const a = t > 1 ? "comments" : "comment";
5763
- o.push(`${t} task ${a}`);
5763
+ const i = t > 1 ? "comments" : "comment";
5764
+ o.push(`${t} task ${i}`);
5764
5765
  }
5765
5766
  if (r > 0) {
5766
- const a = r > 1 ? "comments" : "comment";
5767
- o.push(`${r} project ${a}`);
5767
+ const i = r > 1 ? "comments" : "comment";
5768
+ o.push(`${r} project ${i}`);
5768
5769
  }
5769
5770
  return o.length > 0 ? `Updated ${o.join(" and ")}` : "No comments updated";
5770
5771
  }
@@ -5776,9 +5777,9 @@ const nc = s.object({
5776
5777
  ),
5777
5778
  color: le,
5778
5779
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
5779
- }), ac = {
5780
+ }), ic = {
5780
5781
  filters: s.array(nc).min(1).describe("The filters to update.")
5781
- }, ic = {
5782
+ }, ac = {
5782
5783
  filters: s.array(rt).describe("The updated filters."),
5783
5784
  totalCount: s.number().describe("The total number of filters updated."),
5784
5785
  updatedFilterIds: s.array(s.string()).describe("The IDs of the updated filters."),
@@ -5789,25 +5790,25 @@ const nc = s.object({
5789
5790
  }, cc = {
5790
5791
  name: g.UPDATE_FILTERS,
5791
5792
  description: "Update one or more existing personal filters with new values.",
5792
- parameters: ac,
5793
- outputSchema: ic,
5793
+ parameters: ic,
5794
+ outputSchema: ac,
5794
5795
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5795
5796
  async execute(e, t) {
5796
- const { filters: r } = e, o = [], a = r.map((m) => {
5797
+ const { filters: r } = e, o = [], i = r.map((m) => {
5797
5798
  const h = lc(m);
5798
5799
  return h !== null ? { kind: "skipped", reason: h } : (o.push(m), { kind: "updated", filter: m });
5799
5800
  }).filter((m) => m.kind === "skipped").length;
5800
5801
  if (o.length === 0)
5801
5802
  return {
5802
- textContent: `Updated 0 filters (${a} skipped - no changes)`,
5803
+ textContent: `Updated 0 filters (${i} skipped - no changes)`,
5803
5804
  structuredContent: {
5804
5805
  filters: [],
5805
5806
  totalCount: 0,
5806
5807
  updatedFilterIds: [],
5807
- appliedOperations: { updateCount: 0, skippedCount: a }
5808
+ appliedOperations: { updateCount: 0, skippedCount: i }
5808
5809
  }
5809
5810
  };
5810
- const i = o.map((m) => {
5811
+ const a = o.map((m) => {
5811
5812
  const { id: h, color: y, ...f } = m;
5812
5813
  return V("filter_update", {
5813
5814
  id: h,
@@ -5815,7 +5816,7 @@ const nc = s.object({
5815
5816
  ...y !== void 0 ? { color: y } : {}
5816
5817
  });
5817
5818
  });
5818
- await t.sync({ commands: i });
5819
+ await t.sync({ commands: a });
5819
5820
  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) => ({
5820
5821
  id: m.id,
5821
5822
  name: m.name,
@@ -5825,14 +5826,14 @@ const nc = s.object({
5825
5826
  itemOrder: m.itemOrder
5826
5827
  }));
5827
5828
  return {
5828
- textContent: dc({ filters: u, skippedCount: a }),
5829
+ textContent: dc({ filters: u, skippedCount: i }),
5829
5830
  structuredContent: {
5830
5831
  filters: u,
5831
5832
  totalCount: u.length,
5832
5833
  updatedFilterIds: u.map((m) => m.id),
5833
5834
  appliedOperations: {
5834
5835
  updateCount: u.length,
5835
- skippedCount: a
5836
+ skippedCount: i
5836
5837
  }
5837
5838
  }
5838
5839
  };
@@ -5845,7 +5846,7 @@ function dc({
5845
5846
  const r = e.length;
5846
5847
  let o = `Updated ${r} filter${r === 1 ? "" : "s"}`;
5847
5848
  if (t > 0 && (o += ` (${t} skipped - no changes)`), r > 0) {
5848
- const n = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
5849
+ const n = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
5849
5850
  `);
5850
5851
  o += `:
5851
5852
  ${n}`;
@@ -5907,9 +5908,9 @@ const uc = s.object({
5907
5908
  newName: u.newName
5908
5909
  }) ? { kind: "renamed", name: u.name, newName: u.newName } : { kind: "skipped", reason: "not-found" };
5909
5910
  })
5910
- ), n = o.filter((u) => u.kind === "updated").map((u) => pe.parse(u.label)), a = o.filter(
5911
+ ), n = o.filter((u) => u.kind === "updated").map((u) => pe.parse(u.label)), i = o.filter(
5911
5912
  (u) => u.kind === "renamed"
5912
- ).map(({ name: u, newName: p }) => ({ name: u, newName: p })), i = o.filter((u) => u.kind === "skipped").length, c = o.filter(
5913
+ ).map(({ name: u, newName: p }) => ({ name: u, newName: p })), a = o.filter((u) => u.kind === "skipped").length, c = o.filter(
5913
5914
  (u) => u.kind === "skipped" && u.reason === "no-fields"
5914
5915
  ).length, d = o.filter(
5915
5916
  (u) => u.kind === "skipped" && u.reason === "not-found"
@@ -5917,18 +5918,18 @@ const uc = s.object({
5917
5918
  return {
5918
5919
  textContent: yc({
5919
5920
  updatedLabels: n,
5920
- renamedSharedLabels: a,
5921
+ renamedSharedLabels: i,
5921
5922
  skippedNoFields: c,
5922
5923
  skippedNotFound: d
5923
5924
  }),
5924
5925
  structuredContent: {
5925
5926
  updatedLabels: n,
5926
- renamedSharedLabels: a,
5927
- totalCount: n.length + a.length,
5927
+ renamedSharedLabels: i,
5928
+ totalCount: n.length + i.length,
5928
5929
  appliedOperations: {
5929
5930
  updateCount: n.length,
5930
- renameCount: a.length,
5931
- skippedCount: i
5931
+ renameCount: i.length,
5932
+ skippedCount: a
5932
5933
  }
5933
5934
  }
5934
5935
  };
@@ -5940,16 +5941,16 @@ function yc({
5940
5941
  skippedNoFields: r,
5941
5942
  skippedNotFound: o
5942
5943
  }) {
5943
- const n = e.length, a = t.length, i = n + a, c = [];
5944
+ const n = e.length, i = t.length, a = n + i, c = [];
5944
5945
  c.push(
5945
- `Updated ${i} label${i === 1 ? "" : "s"} (${n} personal, ${a} shared)`
5946
+ `Updated ${a} label${a === 1 ? "" : "s"} (${n} personal, ${i} shared)`
5946
5947
  );
5947
5948
  const d = [];
5948
5949
  if (r > 0 && d.push(`${r} skipped - no changes`), o > 0 && d.push(`${o} skipped - shared label not found`), d.length > 0 && (c[0] += ` (${d.join(", ")})`), n > 0) {
5949
5950
  c.push("Personal:");
5950
5951
  for (const l of e) c.push(`• ${l.name} (id=${l.id})`);
5951
5952
  }
5952
- if (a > 0) {
5953
+ if (i > 0) {
5953
5954
  c.push("Shared:");
5954
5955
  for (const l of t) c.push(`• ${l.name} → ${l.newName}`);
5955
5956
  }
@@ -6006,34 +6007,34 @@ const kc = s.object({
6006
6007
  const { id: p, ...m } = l;
6007
6008
  return { kind: "updated", project: await O(() => t.updateProject(p, m)) };
6008
6009
  })
6009
- ), n = [], a = [];
6010
- let i = 0, c = 0;
6010
+ ), n = [], i = [];
6011
+ let a = 0, c = 0;
6011
6012
  for (const [l, u] of o.entries()) {
6012
6013
  if (u.status === "rejected") {
6013
- a.push({
6014
+ i.push({
6014
6015
  item: r[l]?.id ?? `Project ${l + 1}`,
6015
6016
  error: z(u.reason)
6016
6017
  });
6017
6018
  continue;
6018
6019
  }
6019
- u.value.kind === "updated" ? n.push(Z(u.value.project)) : u.value.reason === "no-fields" ? i++ : c++;
6020
+ u.value.kind === "updated" ? n.push(Z(u.value.project)) : u.value.reason === "no-fields" ? a++ : c++;
6020
6021
  }
6021
6022
  return {
6022
6023
  textContent: Sc({
6023
6024
  projects: n,
6024
- skippedNoFields: i,
6025
+ skippedNoFields: a,
6025
6026
  skippedNoValidValues: c,
6026
- failures: a
6027
+ failures: i
6027
6028
  }),
6028
6029
  structuredContent: {
6029
6030
  projects: n,
6030
6031
  totalCount: n.length,
6031
6032
  updatedProjectIds: n.map((l) => l.id),
6032
- failures: a,
6033
+ failures: i,
6033
6034
  appliedOperations: {
6034
6035
  updateCount: n.length,
6035
- skippedCount: i + c,
6036
- failureCount: a.length
6036
+ skippedCount: a + c,
6037
+ failureCount: i.length
6037
6038
  }
6038
6039
  }
6039
6040
  };
@@ -6045,12 +6046,12 @@ function Sc({
6045
6046
  skippedNoValidValues: r,
6046
6047
  failures: o
6047
6048
  }) {
6048
- const n = e.length, a = e.map((d) => `• ${d.name} (id=${d.id})`).join(`
6049
+ const n = e.length, i = e.map((d) => `• ${d.name} (id=${d.id})`).join(`
6049
6050
  `);
6050
- let i = `Updated ${n} project${n === 1 ? "" : "s"}`;
6051
+ let a = `Updated ${n} project${n === 1 ? "" : "s"}`;
6051
6052
  const c = [];
6052
- return t > 0 && c.push(`${t} skipped - no changes`), r > 0 && c.push(`${r} skipped - no valid field values`), c.length > 0 && (i += ` (${c.join(", ")})`), n > 0 && (i += `:
6053
- ${a}`), at(i, o);
6053
+ return t > 0 && c.push(`${t} skipped - no changes`), r > 0 && c.push(`${r} skipped - no valid field values`), c.length > 0 && (a += ` (${c.join(", ")})`), n > 0 && (a += `:
6054
+ ${i}`), it(a, o);
6054
6055
  }
6055
6056
  function jc({ id: e, ...t }) {
6056
6057
  const r = Object.values(t);
@@ -6118,13 +6119,13 @@ const Cc = s.object({
6118
6119
  return await t.updateLocationReminder(l, p);
6119
6120
  }
6120
6121
  }
6121
- }), a = (await Promise.all(o)).map(be), i = a.length === 1 ? "reminder" : "reminders";
6122
+ }), i = (await Promise.all(o)).map(be), a = i.length === 1 ? "reminder" : "reminders";
6122
6123
  return {
6123
- textContent: `Updated ${a.length} ${i}`,
6124
+ textContent: `Updated ${i.length} ${a}`,
6124
6125
  structuredContent: {
6125
- reminders: a,
6126
- totalCount: a.length,
6127
- updatedReminderIds: a.map((d) => d.id)
6126
+ reminders: i,
6127
+ totalCount: i.length,
6128
+ updatedReminderIds: i.map((d) => d.id)
6128
6129
  }
6129
6130
  };
6130
6131
  }
@@ -6157,10 +6158,10 @@ const Cc = s.object({
6157
6158
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
6158
6159
  async execute({ sections: e }, t) {
6159
6160
  const r = await Promise.all(
6160
- e.map(({ id: n, name: a, description: i }) => {
6161
+ e.map(({ id: n, name: i, description: a }) => {
6161
6162
  const c = {
6162
- ...a !== void 0 ? { name: a } : {},
6163
- ...i !== void 0 ? { description: i === "" ? null : i } : {}
6163
+ ...i !== void 0 ? { name: i } : {},
6164
+ ...a !== void 0 ? { description: a === "" ? null : a } : {}
6164
6165
  };
6165
6166
  return t.updateSection(n, c);
6166
6167
  })
@@ -6204,18 +6205,18 @@ function Hc({
6204
6205
  const o = Fc(t);
6205
6206
  if (o.length === 0)
6206
6207
  return { redundantMoveSkipped: !1 };
6207
- let n = o, a = !1;
6208
+ let n = o, i = !1;
6208
6209
  if (r) {
6209
- const i = o.length === 1 ? (c) => Ss(r, c) : (c) => Nc(r, c);
6210
- n = o.filter((c) => !i(c)), a = n.length < o.length;
6210
+ const a = o.length === 1 ? (c) => Ss(r, c) : (c) => Nc(r, c);
6211
+ n = o.filter((c) => !a(c)), i = n.length < o.length;
6211
6212
  }
6212
6213
  if (n.length === 0)
6213
- return { redundantMoveSkipped: a };
6214
+ return { redundantMoveSkipped: i };
6214
6215
  if (n.length > 1)
6215
6216
  throw new Error(
6216
6217
  `Task ${e}: Only one of projectId, sectionId, or parentId can be specified at a time. The Todoist API requires exactly one destination for move operations.`
6217
6218
  );
6218
- return { move: n[0], redundantMoveSkipped: a };
6219
+ return { move: n[0], redundantMoveSkipped: i };
6219
6220
  }
6220
6221
  const Wc = s.object({
6221
6222
  id: s.string().min(1).describe("The ID of the task to update."),
@@ -6288,17 +6289,17 @@ const Wc = s.object({
6288
6289
  async execute(e, t) {
6289
6290
  const { tasks: r } = s.object(Ot).parse(e), o = r.map(() => ({ kind: "skipped" })), n = (T, b) => {
6290
6291
  o[T] = { kind: "failed", error: b };
6291
- }, a = (T, b) => {
6292
+ }, i = (T, b) => {
6292
6293
  n(T, z(b));
6293
- }, i = r.map((T, b) => ({ task: T, index: b })).filter(({ task: T }) => rd(T)), c = await Jc(
6294
- i.map(({ task: T }) => T),
6294
+ }, a = r.map((T, b) => ({ task: T, index: b })).filter(({ task: T }) => rd(T)), c = await Jc(
6295
+ a.map(({ task: T }) => T),
6295
6296
  t
6296
6297
  ), d = await Promise.allSettled(
6297
- i.map(({ task: T, index: b }) => ed({ task: T, index: b, client: t, inbox: c }))
6298
+ a.map(({ task: T, index: b }) => ed({ task: T, index: b, client: t, inbox: c }))
6298
6299
  ), l = [];
6299
6300
  for (const [T, b] of d.entries()) {
6300
- const S = i[T]?.index ?? T;
6301
- b.status === "fulfilled" ? l.push(b.value) : a(S, b.reason);
6301
+ const S = a[T]?.index ?? T;
6302
+ b.status === "fulfilled" ? l.push(b.value) : i(S, b.reason);
6302
6303
  }
6303
6304
  const u = await Cs({
6304
6305
  client: t,
@@ -6317,7 +6318,7 @@ const Wc = s.object({
6317
6318
  });
6318
6319
  T.redundantMoveSkipped = b.redundantMoveSkipped, b.move && p.push({ item: T, move: b.move });
6319
6320
  } catch (b) {
6320
- a(T.index, b), T.failed = !0;
6321
+ i(T.index, b), T.failed = !0;
6321
6322
  }
6322
6323
  const m = /* @__PURE__ */ new Map(), h = [], y = (T) => {
6323
6324
  const b = T.filter((S) => !S.failed);
@@ -6338,7 +6339,7 @@ const Wc = s.object({
6338
6339
  };
6339
6340
  return;
6340
6341
  }
6341
- a(S.index, $);
6342
+ i(S.index, $);
6342
6343
  }
6343
6344
  })
6344
6345
  );
@@ -6392,17 +6393,17 @@ const Wc = s.object({
6392
6393
  function Vc({ tasks: e, outcomes: t }) {
6393
6394
  const r = [], o = [];
6394
6395
  let n = 0;
6395
- for (const [a, i] of t.entries()) {
6396
- const c = e[a]?.id ?? `Task ${a + 1}`;
6397
- if (i.kind === "skipped") {
6396
+ for (const [i, a] of t.entries()) {
6397
+ const c = e[i]?.id ?? `Task ${i + 1}`;
6398
+ if (a.kind === "skipped") {
6398
6399
  n++;
6399
6400
  continue;
6400
6401
  }
6401
- if (i.kind === "failed") {
6402
- o.push({ item: c, error: i.error });
6402
+ if (a.kind === "failed") {
6403
+ o.push({ item: c, error: a.error });
6403
6404
  continue;
6404
6405
  }
6405
- r.push(i.task), i.kind === "partial" && o.push({ item: c, error: i.error, code: "PARTIAL_MOVE_APPLIED" });
6406
+ r.push(a.task), a.kind === "partial" && o.push({ item: c, error: a.error, code: "PARTIAL_MOVE_APPLIED" });
6406
6407
  }
6407
6408
  return { updatedTasks: r, failures: o, skippedCount: n };
6408
6409
  }
@@ -6426,9 +6427,9 @@ async function Cs({
6426
6427
  const o = new Set(t), n = {
6427
6428
  ids: t.join(","),
6428
6429
  limit: Ye
6429
- }, { results: a } = await O(() => e.getTasks(n));
6430
- for (const i of a)
6431
- o.has(i.id) && r.set(i.id, i);
6430
+ }, { results: i } = await O(() => e.getTasks(n));
6431
+ for (const a of i)
6432
+ o.has(a.id) && r.set(a.id, a);
6432
6433
  } catch {
6433
6434
  }
6434
6435
  return r;
@@ -6446,36 +6447,36 @@ async function Xc({
6446
6447
  const d = Mc(c.move), l = n.get(d);
6447
6448
  l ? l.push(c) : n.set(d, [c]);
6448
6449
  }
6449
- const a = lr(e), i = [];
6450
+ const i = lr(e), a = [];
6450
6451
  for (const c of n.values()) {
6451
6452
  const d = [...new Set(c.map(({ item: p }) => p.id))], l = c[0]?.move, u = c.length === 1 ? c[0] : void 0;
6452
6453
  try {
6453
6454
  if (u) {
6454
- const f = await a(
6455
+ const f = await i(
6455
6456
  () => O(() => e.moveTask(u.item.id, l))
6456
6457
  );
6457
6458
  r.set(u.item.index, { task: f }), o(c);
6458
6459
  continue;
6459
6460
  }
6460
- const p = await a(
6461
+ const p = await i(
6461
6462
  () => O(() => e.moveTasks(d, l))
6462
6463
  ), m = new Map(p.map((f) => [f.id, f])), h = [], y = [];
6463
6464
  for (const f of c) {
6464
6465
  const v = m.get(f.item.id);
6465
6466
  v ? (r.set(f.item.index, { task: v }), y.push(f)) : h.push(f);
6466
6467
  }
6467
- o(y), h.length > 0 && i.push({ group: h, destination: l });
6468
+ o(y), h.length > 0 && a.push({ group: h, destination: l });
6468
6469
  } catch (p) {
6469
6470
  if (u) {
6470
6471
  r.set(u.item.index, { error: z(p) }), o(c);
6471
6472
  continue;
6472
6473
  }
6473
- i.push({ group: c, destination: l, error: p });
6474
+ a.push({ group: c, destination: l, error: p });
6474
6475
  }
6475
6476
  }
6476
- if (i.length > 0) {
6477
- await Zc({ client: e, unresolved: i, results: r });
6478
- for (const { group: c } of i)
6477
+ if (a.length > 0) {
6478
+ await Zc({ client: e, unresolved: a, results: r });
6479
+ for (const { group: c } of a)
6479
6480
  o(c);
6480
6481
  }
6481
6482
  }
@@ -6484,12 +6485,12 @@ async function Zc({
6484
6485
  unresolved: t,
6485
6486
  results: r
6486
6487
  }) {
6487
- const o = [...new Set(t.flatMap(({ group: a }) => a.map(({ item: i }) => i.id)))], n = await Cs({ client: e, ids: o });
6488
- for (const { group: a, destination: i, error: c } of t) {
6488
+ const o = [...new Set(t.flatMap(({ group: i }) => i.map(({ item: a }) => a.id)))], n = await Cs({ client: e, ids: o });
6489
+ for (const { group: i, destination: a, error: c } of t) {
6489
6490
  const d = c === void 0 ? "Task not returned by the move" : z(c);
6490
- for (const { item: l } of a) {
6491
+ for (const { item: l } of i) {
6491
6492
  const u = n.get(l.id);
6492
- if (u && Ss(u, i)) {
6493
+ if (u && Ss(u, a)) {
6493
6494
  r.set(l.index, { task: u });
6494
6495
  continue;
6495
6496
  }
@@ -6505,14 +6506,14 @@ async function Qc({
6505
6506
  }) {
6506
6507
  const n = ur(e);
6507
6508
  await Promise.all(
6508
- t.filter((a) => js(a.updateArgs)).map(async (a) => {
6509
+ t.filter((i) => js(i.updateArgs)).map(async (i) => {
6509
6510
  try {
6510
- const i = await n(
6511
- () => O(() => e.updateTask(a.id, a.updateArgs))
6511
+ const a = await n(
6512
+ () => O(() => e.updateTask(i.id, i.updateArgs))
6512
6513
  );
6513
- r(a, i);
6514
- } catch (i) {
6515
- o(a, i);
6514
+ r(i, a);
6515
+ } catch (a) {
6516
+ o(i, a);
6516
6517
  }
6517
6518
  })
6518
6519
  );
@@ -6525,8 +6526,8 @@ async function ed({
6525
6526
  }) {
6526
6527
  const {
6527
6528
  id: n,
6528
- projectId: a,
6529
- sectionId: i,
6529
+ projectId: i,
6530
+ sectionId: a,
6530
6531
  parentId: c,
6531
6532
  dueString: d,
6532
6533
  duration: l,
@@ -6536,9 +6537,9 @@ async function ed({
6536
6537
  deadlineDate: h,
6537
6538
  ...y
6538
6539
  } = e;
6539
- if (N(a) && o.error !== void 0)
6540
+ if (N(i) && o.error !== void 0)
6540
6541
  throw o.error;
6541
- const f = N(a) ? o.projectId : a;
6542
+ const f = N(i) ? o.projectId : i;
6542
6543
  let v = {
6543
6544
  ...y,
6544
6545
  ...m !== void 0 && { labels: m }
@@ -6571,7 +6572,7 @@ async function ed({
6571
6572
  updateArgs: v,
6572
6573
  moveRequest: {
6573
6574
  projectId: f,
6574
- sectionId: i,
6575
+ sectionId: a,
6575
6576
  parentId: c
6576
6577
  },
6577
6578
  redundantMoveSkipped: !1,
@@ -6581,14 +6582,14 @@ async function ed({
6581
6582
  async function td(e, t, r) {
6582
6583
  if (r === null || r === "unassign")
6583
6584
  return null;
6584
- const o = await it.validateTaskUpdateAssignment(
6585
+ const o = await at.validateTaskUpdateAssignment(
6585
6586
  e,
6586
6587
  t,
6587
6588
  r
6588
6589
  );
6589
6590
  if (!o.isValid) {
6590
- const n = o.error?.message || "Assignment validation failed", a = o.error?.suggestions?.join(". ") || "";
6591
- throw new Error(`Task ${t}: ${n}${a ? `. ${a}` : ""}`);
6591
+ const n = o.error?.message || "Assignment validation failed", i = o.error?.suggestions?.join(". ") || "";
6592
+ throw new Error(`Task ${t}: ${n}${i ? `. ${i}` : ""}`);
6592
6593
  }
6593
6594
  return o.resolvedUser?.userId;
6594
6595
  }
@@ -6600,16 +6601,16 @@ function sd({
6600
6601
  }) {
6601
6602
  const n = [];
6602
6603
  r > 0 && n.push(`${r} skipped - no changes`), o > 0 && n.push(`${o} already in requested destination`), t.length > 0 && n.push(`${t.length} failed`);
6603
- const a = n.length > 0 ? ` (${n.join(", ")})` : "", i = ot("Updated", e, {
6604
- context: a,
6604
+ const i = n.length > 0 ? ` (${n.join(", ")})` : "", a = ot("Updated", e, {
6605
+ context: i,
6605
6606
  showDetails: e.length <= 5
6606
6607
  });
6607
6608
  if (t.length === 0)
6608
- return i;
6609
+ return a;
6609
6610
  const c = t.slice(0, fe.MAX_FAILURES_SHOWN), d = t.length - c.length, l = c.map((p) => ` ${p.item}: ${p.error}`).join(`
6610
6611
  `), u = d > 0 ? `
6611
6612
  +${d} more` : "";
6612
- return `${i}
6613
+ return `${a}
6613
6614
  Failed (${t.length}) - address or drop these items:
6614
6615
  ${l}${u}`;
6615
6616
  }
@@ -6641,10 +6642,10 @@ const od = {}, nd = {
6641
6642
  email: s.string().describe("The email address of the user."),
6642
6643
  plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
6643
6644
  };
6644
- function ad(e) {
6645
+ function id(e) {
6645
6646
  return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
6646
6647
  }
6647
- function id(e, t) {
6648
+ function ad(e, t) {
6648
6649
  const o = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
6649
6650
  return n.setDate(e.getDate() - o), n;
6650
6651
  }
@@ -6683,20 +6684,20 @@ function pd(e, t) {
6683
6684
  });
6684
6685
  }
6685
6686
  async function md(e) {
6686
- const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = $s(r), n = /* @__PURE__ */ new Date(), a = pd(n, o), i = t.startDay ?? 1, c = ld(i), d = ad(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = id(l, i), p = cd(u), m = dd(l), y = [
6687
+ const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = $s(r), n = /* @__PURE__ */ new Date(), i = pd(n, o), a = t.startDay ?? 1, c = ld(a), d = id(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = ad(l, a), p = cd(u), m = dd(l), y = [
6687
6688
  "# User Information",
6688
6689
  "",
6689
6690
  `**User ID:** ${t.id}`,
6690
6691
  `**Full Name:** ${t.fullName}`,
6691
6692
  `**Email:** ${t.email}`,
6692
6693
  `**Timezone:** ${o}`,
6693
- `**Current Local Time:** ${a}`,
6694
+ `**Current Local Time:** ${i}`,
6694
6695
  "",
6695
6696
  "## Week Settings",
6696
- `**Week Start Day:** ${c} (${i})`,
6697
+ `**Week Start Day:** ${c} (${a})`,
6697
6698
  `**Current Week:** Week ${m}`,
6698
- `**Week Start Date:** ${ie(u)}`,
6699
- `**Week End Date:** ${ie(p)}`,
6699
+ `**Week Start Date:** ${ae(u)}`,
6700
+ `**Week End Date:** ${ae(p)}`,
6700
6701
  "",
6701
6702
  "## Daily Progress",
6702
6703
  `**Completed Today:** ${t.completedToday}`,
@@ -6711,11 +6712,11 @@ async function md(e) {
6711
6712
  userId: t.id,
6712
6713
  fullName: t.fullName,
6713
6714
  timezone: o,
6714
- currentLocalTime: a,
6715
- startDay: i,
6715
+ currentLocalTime: i,
6716
+ startDay: a,
6716
6717
  startDayName: c,
6717
- weekStartDate: ie(u),
6718
- weekEndDate: ie(p),
6718
+ weekStartDate: ae(u),
6719
+ weekEndDate: ae(p),
6719
6720
  currentWeekNumber: m,
6720
6721
  completedToday: t.completedToday,
6721
6722
  dailyGoal: t.dailyGoal,
@@ -6805,15 +6806,15 @@ const vd = {
6805
6806
  idempotentHint: !0
6806
6807
  },
6807
6808
  async execute({ fileUrl: e }, t) {
6808
- const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, a = wd(e), i = r.headers["content-type"], c = i ? Td(i) : void 0, d = c && c !== "application/octet-stream" ? c : kd(e) ?? c ?? "application/octet-stream";
6809
+ const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, i = wd(e), a = r.headers["content-type"], c = a ? Td(a) : void 0, d = c && c !== "application/octet-stream" ? c : kd(e) ?? c ?? "application/octet-stream";
6809
6810
  if (n && n > _t)
6810
6811
  return {
6811
- textContent: `Attachment "${a ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
6812
+ textContent: `Attachment "${i ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
6812
6813
  };
6813
6814
  const l = Buffer.from(await r.arrayBuffer()), u = l.byteLength;
6814
6815
  if (u > _t)
6815
6816
  return {
6816
- textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
6817
+ textContent: `Attachment "${i ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`
6817
6818
  };
6818
6819
  const p = yd(d), m = [];
6819
6820
  return p === "image" ? m.push({
@@ -6831,12 +6832,12 @@ const vd = {
6831
6832
  blob: l.toString("base64")
6832
6833
  }
6833
6834
  }), {
6834
- textContent: `Attachment: ${a ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
6835
+ textContent: `Attachment: ${i ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
6835
6836
  contentItems: m
6836
6837
  };
6837
6838
  }
6838
6839
  }, Sd = {
6839
- ...Pa,
6840
+ ...Pi,
6840
6841
  _meta: {
6841
6842
  ui: {
6842
6843
  resourceUri: Le
@@ -6846,64 +6847,64 @@ const vd = {
6846
6847
  // Task management tools
6847
6848
  addTasks: pn,
6848
6849
  completeTasks: wn,
6849
- uncompleteTasks: Zi,
6850
+ uncompleteTasks: Za,
6850
6851
  updateTasks: Gc,
6851
- rescheduleTasks: Ki,
6852
- findTasks: Fa,
6852
+ rescheduleTasks: Ka,
6853
+ findTasks: Fi,
6853
6854
  findTasksByDate: Sd,
6854
- findCompletedTasks: aa,
6855
+ findCompletedTasks: ii,
6855
6856
  // Project management tools
6856
6857
  addProjects: Yo,
6857
6858
  updateProjects: Ic,
6858
- findProjects: ka,
6859
- projectManagement: Ri,
6860
- projectMove: Ni,
6859
+ findProjects: ki,
6860
+ projectManagement: Ra,
6861
+ projectMove: Na,
6861
6862
  // Section management tools
6862
6863
  addSections: an,
6863
6864
  updateSections: Uc,
6864
- findSections: xa,
6865
+ findSections: xi,
6865
6866
  // Comment management tools
6866
6867
  addComments: Io,
6867
6868
  findComments: Xn,
6868
6869
  updateComments: rc,
6869
6870
  // Reminder management tools
6870
6871
  addReminders: tn,
6871
- findReminders: Sa,
6872
+ findReminders: Si,
6872
6873
  updateReminders: Oc,
6873
6874
  // Attachment tools
6874
6875
  viewAttachment: Id,
6875
6876
  // Label management tools
6876
6877
  addLabels: Uo,
6877
6878
  updateLabels: gc,
6878
- findLabels: la,
6879
+ findLabels: li,
6879
6880
  // Filter management tools
6880
6881
  findFilters: $o,
6881
6882
  addFilters: Oo,
6882
6883
  updateFilters: cc,
6883
6884
  // Activity and audit tools
6884
6885
  findActivity: zn,
6885
- getProductivityStats: Qa,
6886
+ getProductivityStats: Qi,
6886
6887
  // Health and insights tools
6887
- getProjectHealth: ui,
6888
- getProjectActivityStats: oi,
6888
+ getProjectHealth: ua,
6889
+ getProjectActivityStats: oa,
6889
6890
  analyzeProjectHealth: yn,
6890
- getWorkspaceInsights: fi,
6891
+ getWorkspaceInsights: fa,
6891
6892
  // General tools
6892
- getOverview: Ja,
6893
+ getOverview: Ji,
6893
6894
  deleteObject: jn,
6894
6895
  fetchObject: Ln,
6895
- reorderObjects: Hi,
6896
+ reorderObjects: Ha,
6896
6897
  userInfo: hd,
6897
6898
  // Assignment and collaboration tools
6898
- findProjectCollaborators: ha,
6899
- manageAssignments: Oi,
6899
+ findProjectCollaborators: hi,
6900
+ manageAssignments: Oa,
6900
6901
  // Template tools
6901
6902
  exportProjectTemplate: Dn,
6902
- importProjectTemplate: ki,
6903
+ importProjectTemplate: ka,
6903
6904
  // Workspace tools
6904
- listWorkspaces: Ci,
6905
+ listWorkspaces: Ca,
6905
6906
  // OpenAI MCP tools
6906
- search: Vi,
6907
+ search: Va,
6907
6908
  fetch: Fn
6908
6909
  }, Cd = Object.values(jd), $d = `
6909
6910
  ## Todoist Task and Project Management Tools
@@ -6973,9 +6974,9 @@ function Hd({
6973
6974
  }
6974
6975
  ), n = jr(e, { baseUrl: t });
6975
6976
  Gs(o);
6976
- const a = { server: o, client: n, features: r };
6977
- for (const i of Cd)
6978
- Kr({ tool: i, ...a });
6977
+ const i = { server: o, client: n, features: r };
6978
+ for (const a of Cd)
6979
+ Kr({ tool: a, ...i });
6979
6980
  return o.registerPrompt(
6980
6981
  he.name,
6981
6982
  {
@@ -6988,22 +6989,22 @@ function Hd({
6988
6989
  }
6989
6990
  export {
6990
6991
  Er as $,
6991
- Ja as A,
6992
- Qa as B,
6993
- oi as C,
6994
- ui as D,
6995
- fi as E,
6992
+ Ji as A,
6993
+ Qi as B,
6994
+ oa as C,
6995
+ ua as D,
6996
+ fa as E,
6996
6997
  Fd as F,
6997
- ki as G,
6998
- Ci as H,
6999
- Oi as I,
7000
- Ri as J,
7001
- Ni as K,
6998
+ ka as G,
6999
+ Ca as H,
7000
+ Oa as I,
7001
+ Ra as J,
7002
+ Na as K,
7002
7003
  Cd as L,
7003
- Hi as M,
7004
- Ki as N,
7005
- Vi as O,
7006
- Zi as P,
7004
+ Ha as M,
7005
+ Ka as N,
7006
+ Va as O,
7007
+ Za as P,
7007
7008
  rc as Q,
7008
7009
  cc as R,
7009
7010
  gc as S,
@@ -7031,14 +7032,14 @@ export {
7031
7032
  Ln as n,
7032
7033
  zn as o,
7033
7034
  Xn as p,
7034
- aa as q,
7035
+ ii as q,
7035
7036
  $o as r,
7036
- la as s,
7037
+ li as s,
7037
7038
  jd as t,
7038
- ha as u,
7039
- ka as v,
7040
- Sa as w,
7041
- xa as x,
7042
- Fa as y,
7043
- Pa as z
7039
+ hi as u,
7040
+ ki as v,
7041
+ Si as w,
7042
+ xi as x,
7043
+ Fi as y,
7044
+ Pi as z
7044
7045
  };