@doist/todoist-ai 8.8.6 → 8.8.7

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.
@@ -70,16 +70,16 @@ function Y(e) {
70
70
  function Ee(...e) {
71
71
  return e.find(Y);
72
72
  }
73
- function U(...e) {
73
+ function N(...e) {
74
74
  return e.find((t) => t !== void 0);
75
75
  }
76
- function E(e) {
76
+ function O(e) {
77
77
  if (typeof e == "number" && Number.isFinite(e))
78
78
  return e;
79
79
  if (typeof e == "string" && /^\d+$/.test(e.trim()))
80
80
  return Number(e.trim());
81
81
  }
82
- function y(e) {
82
+ function g(e) {
83
83
  if (typeof e == "string") {
84
84
  const t = e.trim();
85
85
  return t.length > 0 ? t : void 0;
@@ -88,8 +88,8 @@ function y(e) {
88
88
  return String(e);
89
89
  }
90
90
  function X(e) {
91
- const t = E(e);
92
- return t !== void 0 ? t : y(e);
91
+ const t = O(e);
92
+ return t !== void 0 ? t : g(e);
93
93
  }
94
94
  function ss(e) {
95
95
  return e.replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi, "$1 [REDACTED]").replace(
@@ -97,7 +97,7 @@ function ss(e) {
97
97
  "$1: [REDACTED]"
98
98
  ).replace(/([?&](?:token|api[_-]?key|authorization)=)[^&\s]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[REDACTED]");
99
99
  }
100
- function P(e, t = 220) {
100
+ function _(e, t = 220) {
101
101
  const r = ss(e).replace(/\s+/g, " ").trim();
102
102
  return r.length <= t ? r : `${r.slice(0, t - 3)}...`;
103
103
  }
@@ -110,45 +110,45 @@ function ve(e) {
110
110
  return;
111
111
  const t = e.match(/\b(?:HTTP|status code)\s*[:#-]?\s*(\d{3})\b/i);
112
112
  if (t?.[1])
113
- return E(t[1]);
113
+ return O(t[1]);
114
114
  }
115
115
  function W(e) {
116
- const t = y(e);
116
+ const t = g(e);
117
117
  if (t)
118
- return P(t);
118
+ return _(t);
119
119
  if (Array.isArray(e)) {
120
- const n = e.map((a) => Y(a) ? y(a.message) || y(a.error) : y(a)).filter((a) => !!a);
121
- return n.length > 0 ? P(n.slice(0, 2).join("; ")) : void 0;
120
+ const n = e.map((i) => Y(i) ? g(i.message) || g(i.error) : g(i)).filter((i) => !!i);
121
+ return n.length > 0 ? _(n.slice(0, 2).join("; ")) : void 0;
122
122
  }
123
123
  if (!Y(e))
124
124
  return;
125
- const r = U(
126
- y(e.detail),
127
- y(e.details),
128
- y(e.message),
129
- y(e.error),
130
- y(e.description)
125
+ const r = N(
126
+ g(e.detail),
127
+ g(e.details),
128
+ g(e.message),
129
+ g(e.error),
130
+ g(e.description)
131
131
  );
132
132
  if (r)
133
- return P(r);
133
+ return _(r);
134
134
  const o = [];
135
- for (const [n, a] of Object.entries(e)) {
136
- const i = y(a);
137
- if (i && (o.push(`${n}: ${i}`), o.length >= 2))
135
+ for (const [n, i] of Object.entries(e)) {
136
+ const a = g(i);
137
+ if (a && (o.push(`${n}: ${a}`), o.length >= 2))
138
138
  break;
139
139
  }
140
- return o.length > 0 ? P(o.join("; ")) : void 0;
140
+ return o.length > 0 ? _(o.join("; ")) : void 0;
141
141
  }
142
142
  function rs(e) {
143
143
  if (!e)
144
144
  return [];
145
- const t = /* @__PURE__ */ new Set(), r = (i) => {
146
- i && t.add(P(i, 120));
147
- }, o = U(
148
- y(e.field),
149
- y(e.parameter),
150
- y(e.param),
151
- y(e.path)
145
+ const t = /* @__PURE__ */ new Set(), r = (a) => {
146
+ a && t.add(_(a, 120));
147
+ }, o = N(
148
+ g(e.field),
149
+ g(e.parameter),
150
+ g(e.param),
151
+ g(e.path)
152
152
  );
153
153
  r(o);
154
154
  const n = Ee(
@@ -158,46 +158,46 @@ function rs(e) {
158
158
  e.error_extra
159
159
  );
160
160
  if (n) {
161
- const i = U(
162
- y(n.field),
163
- y(n.parameter),
164
- y(n.param),
165
- y(n.path),
166
- y(n.argument)
161
+ const a = N(
162
+ g(n.field),
163
+ g(n.parameter),
164
+ g(n.param),
165
+ g(n.path),
166
+ g(n.argument)
167
167
  );
168
- r(i);
168
+ r(a);
169
169
  }
170
- const a = e.errors;
171
- if (Array.isArray(a))
172
- for (const i of a) {
173
- if (!Y(i)) {
174
- r(y(i));
170
+ const i = e.errors;
171
+ if (Array.isArray(i))
172
+ for (const a of i) {
173
+ if (!Y(a)) {
174
+ r(g(a));
175
175
  continue;
176
176
  }
177
- const c = U(
178
- y(i.field),
179
- y(i.parameter),
180
- y(i.param),
181
- y(i.path),
182
- y(i.name)
183
- ), d = U(
184
- y(i.message),
185
- y(i.error),
186
- y(i.detail),
187
- y(i.description)
177
+ const c = N(
178
+ g(a.field),
179
+ g(a.parameter),
180
+ g(a.param),
181
+ g(a.path),
182
+ g(a.name)
183
+ ), d = N(
184
+ g(a.message),
185
+ g(a.error),
186
+ g(a.detail),
187
+ g(a.description)
188
188
  );
189
189
  r(c && d ? `${c}: ${d}` : c || d);
190
190
  }
191
- else if (Y(a))
192
- for (const [i, c] of Object.entries(a)) {
193
- const d = y(c);
191
+ else if (Y(i))
192
+ for (const [a, c] of Object.entries(i)) {
193
+ const d = g(c);
194
194
  if (d) {
195
- r(`${i}: ${d}`);
195
+ r(`${a}: ${d}`);
196
196
  continue;
197
197
  }
198
198
  if (Array.isArray(c)) {
199
- const l = c.map((u) => y(u)).filter((u) => !!u).join(", ");
200
- r(l ? `${i}: ${l}` : i);
199
+ const l = c.map((u) => g(u)).filter((u) => !!u).join(", ");
200
+ r(l ? `${a}: ${l}` : a);
201
201
  }
202
202
  }
203
203
  return Array.from(t).slice(0, 3);
@@ -216,51 +216,51 @@ const os = [
216
216
  function ns(e) {
217
217
  return e ? os.some((t) => e[t] !== void 0) : !1;
218
218
  }
219
- function as(e, t) {
219
+ function is(e, t) {
220
220
  return e === 401 || e === 403 ? "Verify your API token and access permissions, then retry." : e === 404 ? "Confirm the referenced IDs exist and are accessible, then retry." : e === 429 ? "Rate limit reached. Wait briefly and retry." : e !== void 0 && e >= 500 ? "Todoist API may be temporarily unavailable. Retry shortly." : t ? "Fix the field hints above and retry." : e === 400 || e === 422 ? "Check parameter values and formats, then retry." : "Check the request parameters and retry.";
221
221
  }
222
- function is(e) {
222
+ function as(e) {
223
223
  const t = Y(e) ? e : void 0, r = e instanceof Error && Y(e.cause) ? e.cause : void 0, o = Ee(t?.response, r?.response), n = Ee(
224
224
  t?.responseData,
225
225
  o?.data,
226
226
  t?.data,
227
227
  r?.responseData,
228
228
  r?.data
229
- ), a = U(
230
- E(t?.httpStatusCode),
231
- E(t?.statusCode),
232
- E(t?.status),
233
- E(o?.status),
234
- E(n?.httpStatusCode),
235
- E(n?.statusCode),
236
- E(n?.status),
237
- E(n?.httpCode),
238
- E(n?.http_code),
239
- ve(y(t?.message)),
240
- ve(y(r?.message)),
229
+ ), i = N(
230
+ O(t?.httpStatusCode),
231
+ O(t?.statusCode),
232
+ O(t?.status),
233
+ O(o?.status),
234
+ O(n?.httpStatusCode),
235
+ O(n?.statusCode),
236
+ O(n?.status),
237
+ O(n?.httpCode),
238
+ O(n?.http_code),
239
+ ve(g(t?.message)),
240
+ ve(g(r?.message)),
241
241
  ve(typeof e == "string" ? e : void 0)
242
- ), i = U(
242
+ ), a = N(
243
243
  X(n?.errorCode),
244
244
  X(n?.error_code),
245
245
  X(n?.code),
246
246
  X(t?.errorCode),
247
247
  X(t?.error_code),
248
248
  X(t?.code)
249
- ), c = U(
250
- y(n?.errorTag),
251
- y(n?.error_tag),
252
- y(n?.tag),
253
- y(t?.errorTag),
254
- y(t?.error_tag),
255
- y(t?.tag)
249
+ ), c = N(
250
+ g(n?.errorTag),
251
+ g(n?.error_tag),
252
+ g(n?.tag),
253
+ g(t?.errorTag),
254
+ g(t?.error_tag),
255
+ g(t?.tag)
256
256
  ), d = [
257
- y(n?.error),
258
- y(n?.message),
257
+ g(n?.error),
258
+ g(n?.message),
259
259
  W(n?.message),
260
- y(t?.message),
261
- y(r?.message),
262
- e instanceof Error ? e.message : y(e)
263
- ].filter((h) => !!h), l = d.find((h) => !Qe(h)) || d[0], u = U(
260
+ g(t?.message),
261
+ g(r?.message),
262
+ e instanceof Error ? e.message : g(e)
263
+ ].filter((h) => !!h), l = d.find((h) => !Qe(h)) || d[0], u = N(
264
264
  W(n?.errorExtra),
265
265
  W(n?.error_extra),
266
266
  W(n?.details),
@@ -268,12 +268,12 @@ function is(e) {
268
268
  W(n?.errors),
269
269
  W(t?.details)
270
270
  ), p = rs(n);
271
- return a !== void 0 || ns(n) || c !== void 0 || i !== void 0 || (l ? Qe(l) : !1) ? {
272
- statusCode: a,
273
- code: i,
274
- tag: c ? P(c, 80) : void 0,
275
- message: l ? P(l) : void 0,
276
- details: u ? P(u) : void 0,
271
+ return i !== void 0 || ns(n) || c !== void 0 || a !== void 0 || (l ? Qe(l) : !1) ? {
272
+ statusCode: i,
273
+ code: a,
274
+ tag: c ? _(c, 80) : void 0,
275
+ message: l ? _(l) : void 0,
276
+ details: u ? _(u) : void 0,
277
277
  fieldHints: p
278
278
  } : null;
279
279
  }
@@ -283,16 +283,16 @@ function cs(e) {
283
283
  const r = [
284
284
  t.length > 0 ? `Todoist API request failed (${t.join(", ")}).` : "Todoist API request failed."
285
285
  ];
286
- return e.message && r.push(`Message: ${e.message}`), e.details && e.details !== e.message && r.push(`Details: ${e.details}`), e.fieldHints.length > 0 && r.push(`Field hints: ${e.fieldHints.join("; ")}`), r.push(`Try next: ${as(e.statusCode, e.fieldHints.length > 0)}`), r.join(`
286
+ return e.message && r.push(`Message: ${e.message}`), e.details && e.details !== e.message && r.push(`Details: ${e.details}`), e.fieldHints.length > 0 && r.push(`Field hints: ${e.fieldHints.join("; ")}`), r.push(`Try next: ${is(e.statusCode, e.fieldHints.length > 0)}`), r.join(`
287
287
  `);
288
288
  }
289
289
  function ds(e) {
290
- return e instanceof Error ? P(e.message) : typeof e == "string" ? P(e) : "An unknown error occurred";
290
+ return e instanceof Error ? _(e.message) : typeof e == "string" ? _(e) : "An unknown error occurred";
291
291
  }
292
292
  function ls(e) {
293
293
  if (e instanceof Vt)
294
294
  return e.message;
295
- const t = is(e);
295
+ const t = as(e);
296
296
  return t ? cs(t) : ds(e);
297
297
  }
298
298
  const us = 2, ps = 500, ms = 2e3, hs = /* @__PURE__ */ new Set([502, 503, 504]);
@@ -329,19 +329,19 @@ function ys(e) {
329
329
  }
330
330
  async function ks(e, t = {}) {
331
331
  const r = t.maxRetries ?? us, o = t.baseDelayMs ?? ps, n = t.maxDelayMs ?? ms;
332
- let a;
333
- for (let i = 0; i <= r; i++)
332
+ let i;
333
+ for (let a = 0; a <= r; a++)
334
334
  try {
335
335
  return await e();
336
336
  } catch (c) {
337
- if (a = c, i < r && bs(c)) {
338
- const d = gs({ attempt: i, baseDelayMs: o, maxDelayMs: n });
337
+ if (i = c, a < r && bs(c)) {
338
+ const d = gs({ attempt: a, baseDelayMs: o, maxDelayMs: n });
339
339
  await ys(d);
340
340
  continue;
341
341
  }
342
342
  throw c;
343
343
  }
344
- throw a;
344
+ throw i;
345
345
  }
346
346
  function Oe(e) {
347
347
  if (e == null)
@@ -420,7 +420,7 @@ const f = {
420
420
  // OpenAI MCP tools
421
421
  SEARCH: "search",
422
422
  FETCH: "fetch"
423
- }, _i = {
423
+ }, _a = {
424
424
  /**
425
425
  * Strips email addresses from tool outputs that expose user data.
426
426
  * Affects: find-project-collaborators, find-completed-tasks
@@ -432,12 +432,12 @@ function ws({
432
432
  structuredContent: t,
433
433
  contentItems: r
434
434
  }) {
435
- const o = Oe(t), n = {}, a = [];
436
- if (e && a.push({ type: "text", text: e }), r && a.push(...r), a.length > 0 && (n.content = a), t && (n.structuredContent = o), !Ts && t) {
437
- const i = JSON.stringify(o);
435
+ const o = Oe(t), n = {}, i = [];
436
+ if (e && i.push({ type: "text", text: e }), r && i.push(...r), i.length > 0 && (n.content = i), t && (n.structuredContent = o), !Ts && t) {
437
+ const a = JSON.stringify(o);
438
438
  n.content || (n.content = []), n.content.push({
439
439
  type: "text",
440
- text: i
440
+ text: a
441
441
  });
442
442
  }
443
443
  return n;
@@ -481,13 +481,13 @@ function $s(e) {
481
481
  const t = /\s*\([^)]*@[^)]+\)/g, r = /\S+@\S+\.\S+/g;
482
482
  return e.replace(t, "").replace(r, "[email hidden]");
483
483
  }
484
- function k({
484
+ function y({
485
485
  tool: e,
486
486
  server: t,
487
487
  client: r,
488
488
  features: o = []
489
489
  }) {
490
- const n = o.some((c) => c.name === "strip_emails") && Cs.includes(e.name), a = async (c, d) => {
490
+ const n = o.some((c) => c.name === "strip_emails") && Cs.includes(e.name), i = async (c, d) => {
491
491
  try {
492
492
  let { textContent: l, structuredContent: u, contentItems: p } = await ks(
493
493
  () => e.execute(c, r)
@@ -496,7 +496,7 @@ function k({
496
496
  } catch (l) {
497
497
  return console.error(`Error executing tool ${e.name}:`, { args: c, error: l }), Is(ls(l));
498
498
  }
499
- }, i = {
499
+ }, a = {
500
500
  description: e.description,
501
501
  inputSchema: e.parameters,
502
502
  outputSchema: e.outputSchema,
@@ -508,14 +508,14 @@ function k({
508
508
  t,
509
509
  e.name,
510
510
  {
511
- ...i,
511
+ ...a,
512
512
  _meta: e._meta
513
513
  },
514
- a
514
+ i
515
515
  );
516
516
  return;
517
517
  }
518
- t.registerTool(e.name, i, a);
518
+ t.registerTool(e.name, a, i);
519
519
  }
520
520
  const Ds = {
521
521
  period: s.enum(["today", "7d", "14d", "30d", "this-week", "this-month"]).default("7d").describe(
@@ -556,9 +556,9 @@ function xs(e, t = /* @__PURE__ */ new Date()) {
556
556
  };
557
557
  }
558
558
  case "this-week": {
559
- const n = t.getUTCDay(), a = new Date(t);
560
- return a.setDate(t.getDate() - (n + 6) % 7), {
561
- since: r(a),
559
+ const n = t.getUTCDay(), i = new Date(t);
560
+ return i.setDate(t.getDate() - (n + 6) % 7), {
561
+ since: r(i),
562
562
  until: o,
563
563
  periodDescription: "this week (Monday to today)"
564
564
  };
@@ -649,13 +649,13 @@ function Os(e) {
649
649
  ]
650
650
  };
651
651
  }
652
- const ie = {
652
+ const ae = {
653
653
  name: "productivity-analysis",
654
654
  title: "Productivity Analysis",
655
655
  description: "Analyze your Todoist productivity with insights on completion trends, goal streaks, project distribution, and actionable recommendations. Gathers data from multiple tools and synthesizes a comprehensive report.",
656
656
  argsSchema: Ds,
657
657
  callback: Os
658
- }, C = {
658
+ }, D = {
659
659
  /** Default limit for task listings */
660
660
  TASKS_DEFAULT: 10,
661
661
  /** Maximum limit for task search and list operations */
@@ -688,43 +688,43 @@ const ie = {
688
688
  /** Maximum number of failures to show in detailed error messages */
689
689
  MAX_FAILURES_SHOWN: 3
690
690
  };
691
- class O extends Error {
691
+ class P extends Error {
692
692
  constructor(t, r) {
693
693
  super(`Invalid duration format "${t}": ${r}`), this.name = "DurationParseError";
694
694
  }
695
695
  }
696
696
  function ft(e) {
697
697
  if (!e || typeof e != "string")
698
- throw new O(e, "Duration must be a non-empty string");
698
+ throw new P(e, "Duration must be a non-empty string");
699
699
  const t = e.trim().toLowerCase().replace(/\s+/g, "");
700
700
  if (!t)
701
- throw new O(e, "Duration must be a non-empty string");
701
+ throw new P(e, "Duration must be a non-empty string");
702
702
  const r = t.match(/^(?:(\d+(?:\.\d+)?)h)?(?:(\d+(?:\.\d+)?)m)?$/);
703
703
  if (!r || !r[1] && !r[2])
704
- throw new O(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
704
+ throw new P(e, 'Use format like "2h", "30m", "2h30m", or "1.5h"');
705
705
  let o = 0;
706
- const [, n, a] = r;
706
+ const [, n, i] = r;
707
707
  if (n) {
708
- const i = Number.parseFloat(n);
709
- if (Number.isNaN(i) || i < 0)
710
- throw new O(e, "Hours must be a positive number");
711
- o += i * 60;
712
- }
713
- if (a) {
714
- const i = Number.parseFloat(a);
715
- if (Number.isNaN(i) || i < 0)
716
- throw new O(e, "Minutes must be a positive number");
717
- if (i % 1 !== 0)
718
- throw new O(
708
+ const a = Number.parseFloat(n);
709
+ if (Number.isNaN(a) || a < 0)
710
+ throw new P(e, "Hours must be a positive number");
711
+ o += a * 60;
712
+ }
713
+ if (i) {
714
+ const a = Number.parseFloat(i);
715
+ if (Number.isNaN(a) || a < 0)
716
+ throw new P(e, "Minutes must be a positive number");
717
+ if (a % 1 !== 0)
718
+ throw new P(
719
719
  e,
720
720
  "Minutes must be a whole number (use decimal hours instead)"
721
721
  );
722
- o += i;
722
+ o += a;
723
723
  }
724
724
  if (o = Math.round(o), o === 0)
725
- throw new O(e, "Duration must be greater than 0 minutes");
725
+ throw new P(e, "Duration must be greater than 0 minutes");
726
726
  if (o > 1440)
727
- throw new O(e, "Duration cannot exceed 24 hours (1440 minutes)");
727
+ throw new P(e, "Duration cannot exceed 24 hours (1440 minutes)");
728
728
  return { minutes: o };
729
729
  }
730
730
  function Ps(e) {
@@ -739,7 +739,7 @@ function bt(e) {
739
739
  function Rs(e) {
740
740
  return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
741
741
  }
742
- const A = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), Se = 300 * 1e3, Us = "me";
742
+ const E = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), Se = 300 * 1e3, Us = "me";
743
743
  class Ns {
744
744
  /**
745
745
  * Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
@@ -748,26 +748,26 @@ class Ns {
748
748
  async resolveUser(t, r) {
749
749
  if (!r || r.trim().length === 0)
750
750
  return null;
751
- const o = r.trim(), n = A.get(o);
751
+ const o = r.trim(), n = E.get(o);
752
752
  if (n && Date.now() - n.timestamp < Se)
753
753
  return n.result;
754
754
  if (o.toLowerCase() === Us)
755
755
  try {
756
- const a = await t.getUser();
756
+ const i = await t.getUser();
757
757
  return {
758
- userId: a.id,
759
- displayName: a.fullName,
760
- email: a.email
758
+ userId: i.id,
759
+ displayName: i.fullName,
760
+ email: i.email
761
761
  };
762
762
  } catch {
763
763
  return null;
764
764
  }
765
765
  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)) {
766
- const a = { userId: o, displayName: o, email: o };
767
- return A.set(o, { result: a, timestamp: Date.now() }), a;
766
+ const i = { userId: o, displayName: o, email: o };
767
+ return E.set(o, { result: i, timestamp: Date.now() }), i;
768
768
  }
769
769
  try {
770
- let a = await this.getAllCollaborators(t);
770
+ let i = await this.getAllCollaborators(t);
771
771
  try {
772
772
  const l = await t.getUser();
773
773
  if (l) {
@@ -776,38 +776,38 @@ class Ns {
776
776
  name: l.fullName,
777
777
  email: l.email
778
778
  };
779
- a.some((p) => p.id === l.id) || (a = [u, ...a]);
779
+ i.some((p) => p.id === l.id) || (i = [u, ...i]);
780
780
  }
781
781
  } catch {
782
782
  }
783
- if (a.length === 0)
784
- return A.set(o, { result: null, timestamp: Date.now() }), null;
785
- const i = r.toLowerCase().trim();
786
- let c = a.find((l) => l.id === o);
783
+ if (i.length === 0)
784
+ return E.set(o, { result: null, timestamp: Date.now() }), null;
785
+ const a = r.toLowerCase().trim();
786
+ let c = i.find((l) => l.id === o);
787
787
  if (c) {
788
788
  const l = { userId: c.id, displayName: c.name, email: c.email };
789
- return A.set(o, { result: l, timestamp: Date.now() }), l;
789
+ return E.set(o, { result: l, timestamp: Date.now() }), l;
790
790
  }
791
- if (c = a.find((l) => l.name.toLowerCase() === i), c) {
791
+ if (c = i.find((l) => l.name.toLowerCase() === a), c) {
792
792
  const l = { userId: c.id, displayName: c.name, email: c.email };
793
- return A.set(o, { result: l, timestamp: Date.now() }), l;
793
+ return E.set(o, { result: l, timestamp: Date.now() }), l;
794
794
  }
795
- if (c = a.find((l) => l.email.toLowerCase() === i), c) {
795
+ if (c = i.find((l) => l.email.toLowerCase() === a), c) {
796
796
  const l = { userId: c.id, displayName: c.name, email: c.email };
797
- return A.set(o, { result: l, timestamp: Date.now() }), l;
797
+ return E.set(o, { result: l, timestamp: Date.now() }), l;
798
798
  }
799
- if (c = a.find((l) => l.name.toLowerCase().includes(i)), c) {
799
+ if (c = i.find((l) => l.name.toLowerCase().includes(a)), c) {
800
800
  const l = { userId: c.id, displayName: c.name, email: c.email };
801
- return A.set(o, { result: l, timestamp: Date.now() }), l;
801
+ return E.set(o, { result: l, timestamp: Date.now() }), l;
802
802
  }
803
- if (c = a.find((l) => l.email.toLowerCase().includes(i)), c) {
803
+ if (c = i.find((l) => l.email.toLowerCase().includes(a)), c) {
804
804
  const l = { userId: c.id, displayName: c.name, email: c.email };
805
- return A.set(o, { result: l, timestamp: Date.now() }), l;
805
+ return E.set(o, { result: l, timestamp: Date.now() }), l;
806
806
  }
807
807
  const d = null;
808
- return A.set(o, { result: d, timestamp: Date.now() }), d;
808
+ return E.set(o, { result: d, timestamp: Date.now() }), d;
809
809
  } catch {
810
- return A.set(o, { result: null, timestamp: Date.now() }), null;
810
+ return E.set(o, { result: null, timestamp: Date.now() }), null;
811
811
  }
812
812
  }
813
813
  /**
@@ -815,7 +815,7 @@ class Ns {
815
815
  */
816
816
  async validateProjectCollaborator(t, r, o) {
817
817
  try {
818
- return (await this.getProjectCollaborators(t, r)).some((a) => a.id === o);
818
+ return (await this.getProjectCollaborators(t, r)).some((i) => i.id === o);
819
819
  } catch {
820
820
  return !1;
821
821
  }
@@ -828,7 +828,7 @@ class Ns {
828
828
  if (n && Date.now() - n.timestamp < Se)
829
829
  return n.result;
830
830
  try {
831
- const a = await t.getProjectCollaborators(r), c = (Array.isArray(a) ? a : a.results || []).filter((d) => d?.id && d.name && d.email);
831
+ const i = await t.getProjectCollaborators(r), c = (Array.isArray(i) ? i : i.results || []).filter((d) => d?.id && d.name && d.email);
832
832
  return Z.set(o, {
833
833
  result: c,
834
834
  timestamp: Date.now()
@@ -845,22 +845,22 @@ class Ns {
845
845
  if (o && Date.now() - o.timestamp < Se)
846
846
  return o.result;
847
847
  try {
848
- const { results: n } = await t.getProjects({}), a = n.filter((u) => u.isShared);
849
- if (a.length === 0) {
848
+ const { results: n } = await t.getProjects({}), i = n.filter((u) => u.isShared);
849
+ if (i.length === 0) {
850
850
  const u = [];
851
851
  return Z.set(r, { result: u, timestamp: Date.now() }), u;
852
852
  }
853
- const i = [], c = /* @__PURE__ */ new Set(), d = a.map(
853
+ const a = [], c = /* @__PURE__ */ new Set(), d = i.map(
854
854
  (u) => this.getProjectCollaborators(t, u.id)
855
855
  ), l = await Promise.allSettled(d);
856
856
  for (const u of l)
857
857
  if (u.status === "fulfilled")
858
858
  for (const p of u.value)
859
- p && !c.has(p.id) && (i.push(p), c.add(p.id));
859
+ p && !c.has(p.id) && (a.push(p), c.add(p.id));
860
860
  return Z.set(r, {
861
- result: i,
861
+ result: a,
862
862
  timestamp: Date.now()
863
- }), i;
863
+ }), a;
864
864
  } catch {
865
865
  return [];
866
866
  }
@@ -869,7 +869,7 @@ class Ns {
869
869
  * Clear all caches - useful for testing
870
870
  */
871
871
  clearCache() {
872
- A.clear(), Z.clear();
872
+ E.clear(), Z.clear();
873
873
  }
874
874
  }
875
875
  const B = new Ns();
@@ -919,15 +919,15 @@ async function G(e) {
919
919
  }
920
920
  async function oe(e) {
921
921
  const { apiMethod: t, args: r, limit: o = 100 } = e, n = [];
922
- let a = null;
922
+ let i = null;
923
923
  do {
924
- const i = await t({
924
+ const a = await t({
925
925
  ...r,
926
- cursor: a,
926
+ cursor: i,
927
927
  limit: o
928
928
  });
929
- n.push(...i.results), a = i.nextCursor ?? null;
930
- } while (a !== null);
929
+ n.push(...a.results), i = a.nextCursor ?? null;
930
+ } while (i !== null);
931
931
  return n;
932
932
  }
933
933
  function Me(e) {
@@ -937,21 +937,21 @@ async function kt(e, t) {
937
937
  return oe({
938
938
  apiMethod: e.searchProjects.bind(e),
939
939
  args: { query: Me(t) },
940
- limit: C.PROJECTS_MAX
940
+ limit: D.PROJECTS_MAX
941
941
  });
942
942
  }
943
943
  async function Fs(e, t) {
944
944
  return oe({
945
945
  apiMethod: e.searchLabels.bind(e),
946
946
  args: { query: Me(t) },
947
- limit: C.LABELS_MAX
947
+ limit: D.LABELS_MAX
948
948
  });
949
949
  }
950
950
  async function Hs(e) {
951
951
  return oe({
952
952
  apiMethod: e.getSharedLabels.bind(e),
953
953
  args: {},
954
- limit: C.LABELS_MAX
954
+ limit: D.LABELS_MAX
955
955
  });
956
956
  }
957
957
  async function Ws(e, t, r) {
@@ -959,7 +959,7 @@ async function Ws(e, t, r) {
959
959
  return oe({
960
960
  apiMethod: e.searchSections.bind(e),
961
961
  args: r ? { query: o, projectId: r } : { query: o },
962
- limit: C.SECTIONS_MAX
962
+ limit: D.SECTIONS_MAX
963
963
  });
964
964
  }
965
965
  function Bs(e, t, r, o) {
@@ -977,7 +977,7 @@ function Bs(e, t, r, o) {
977
977
  if (o) return { parentId: o };
978
978
  throw new Error("Unexpected error: No valid move parameter found");
979
979
  }
980
- function _(e) {
980
+ function R(e) {
981
981
  return {
982
982
  id: e.id,
983
983
  content: e.content,
@@ -1064,15 +1064,15 @@ async function Fe({
1064
1064
  cursor: o
1065
1065
  }) {
1066
1066
  try {
1067
- const { results: n, nextCursor: a } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1068
- return { tasks: n.map(_), nextCursor: a };
1067
+ const { results: n, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: o, limit: r });
1068
+ return { tasks: n.map(R), nextCursor: i };
1069
1069
  } catch (n) {
1070
- const a = Ys.safeParse(n);
1071
- if (!a.success)
1070
+ const i = Ys.safeParse(n);
1071
+ if (!i.success)
1072
1072
  throw n;
1073
- const { responseData: i } = a.data;
1074
- throw i.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1075
- `${i.error} (tag: ${i.errorTag}, code: ${i.errorCode})`
1073
+ const { responseData: a } = i.data;
1074
+ throw a.errorTag === "INVALID_SEARCH_QUERY" ? new Error(`Invalid filter query: ${t}`) : new Error(
1075
+ `${a.error} (tag: ${a.errorTag}, code: ${a.errorCode})`
1076
1076
  );
1077
1077
  }
1078
1078
  }
@@ -1150,7 +1150,7 @@ const ne = s.enum(he).optional().catch(void 0).describe("The color key of the en
1150
1150
  assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
1151
1151
  checked: s.boolean().describe("Whether the task is checked/completed."),
1152
1152
  completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
1153
- }), ae = s.object({
1153
+ }), ie = s.object({
1154
1154
  id: s.string().describe("The unique ID of the project."),
1155
1155
  name: s.string().describe("The name of the project."),
1156
1156
  color: ne,
@@ -1262,7 +1262,7 @@ const ne = s.enum(he).optional().catch(void 0).describe("The color key of the en
1262
1262
  `Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
1263
1263
  );
1264
1264
  }
1265
- const n = r.some((l) => de(l.projectId)) ? await t.getUser() : void 0, a = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1265
+ const n = r.some((l) => de(l.projectId)) ? await t.getUser() : void 0, i = r.map(async ({ content: l, taskId: u, projectId: p }) => {
1266
1266
  const m = await G({
1267
1267
  projectId: p,
1268
1268
  user: n,
@@ -1272,7 +1272,7 @@ const ne = s.enum(he).optional().catch(void 0).describe("The color key of the en
1272
1272
  content: l,
1273
1273
  ...u ? { taskId: u } : { projectId: m }
1274
1274
  });
1275
- }), c = (await Promise.all(a)).map(me);
1275
+ }), c = (await Promise.all(i)).map(me);
1276
1276
  return {
1277
1277
  textContent: sr({ comments: c }),
1278
1278
  structuredContent: {
@@ -1284,14 +1284,14 @@ const ne = s.enum(he).optional().catch(void 0).describe("The color key of the en
1284
1284
  }
1285
1285
  };
1286
1286
  function sr({ comments: e }) {
1287
- const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
1287
+ const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
1288
1288
  if (t > 0) {
1289
- const a = t > 1 ? "comments" : "comment";
1290
- o.push(`${t} task ${a}`);
1289
+ const i = t > 1 ? "comments" : "comment";
1290
+ o.push(`${t} task ${i}`);
1291
1291
  }
1292
1292
  if (r > 0) {
1293
- const a = r > 1 ? "comments" : "comment";
1294
- o.push(`${r} project ${a}`);
1293
+ const i = r > 1 ? "comments" : "comment";
1294
+ o.push(`${r} project ${i}`);
1295
1295
  }
1296
1296
  return o.length > 0 ? `Added ${o.join(" and ")}` : "No comments added";
1297
1297
  }
@@ -1316,22 +1316,22 @@ const rr = {
1316
1316
  outputSchema: or,
1317
1317
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
1318
1318
  async execute(e, t) {
1319
- let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((i) => !i.isDeleted);
1319
+ let o = ((await t.sync({ resourceTypes: ["filters"], syncToken: "*" })).filters ?? []).filter((a) => !a.isDeleted);
1320
1320
  if (e.search) {
1321
- const i = e.search.toLowerCase();
1322
- o = o.filter((c) => c.name.toLowerCase().includes(i));
1321
+ const a = e.search.toLowerCase();
1322
+ o = o.filter((c) => c.name.toLowerCase().includes(a));
1323
1323
  }
1324
- o.sort((i, c) => i.itemOrder - c.itemOrder);
1325
- const n = o.map((i) => ({
1326
- id: i.id,
1327
- name: i.name,
1328
- query: i.query,
1329
- color: ne.parse(i.color),
1330
- isFavorite: i.isFavorite,
1331
- itemOrder: i.itemOrder
1324
+ o.sort((a, c) => a.itemOrder - c.itemOrder);
1325
+ const n = o.map((a) => ({
1326
+ id: a.id,
1327
+ name: a.name,
1328
+ query: a.query,
1329
+ color: ne.parse(a.color),
1330
+ isFavorite: a.isFavorite,
1331
+ itemOrder: a.itemOrder
1332
1332
  }));
1333
1333
  return {
1334
- textContent: ar({ filters: n, search: e.search }),
1334
+ textContent: ir({ filters: n, search: e.search }),
1335
1335
  structuredContent: {
1336
1336
  filters: n,
1337
1337
  totalCount: n.length
@@ -1339,7 +1339,7 @@ const rr = {
1339
1339
  };
1340
1340
  }
1341
1341
  };
1342
- function ar({
1342
+ function ir({
1343
1343
  filters: e,
1344
1344
  search: t
1345
1345
  }) {
@@ -1349,18 +1349,18 @@ function ar({
1349
1349
  return `${r}: 0 found
1350
1350
 
1351
1351
  Suggestions:
1352
- ${n.map((a) => `- ${a}`).join(`
1352
+ ${n.map((i) => `- ${i}`).join(`
1353
1353
  `)}`;
1354
1354
  }
1355
1355
  const o = [`${r}: ${e.length} found`, ""];
1356
1356
  for (const n of e) {
1357
- const a = n.isFavorite ? " ★" : "";
1358
- o.push(`• ${n.name}${a} (id=${n.id})`), o.push(` Query: ${n.query}`);
1357
+ const i = n.isFavorite ? " ★" : "";
1358
+ o.push(`• ${n.name}${i} (id=${n.id})`), o.push(` Query: ${n.query}`);
1359
1359
  }
1360
1360
  return o.join(`
1361
1361
  `);
1362
1362
  }
1363
- const ir = s.object({
1363
+ const ar = s.object({
1364
1364
  name: s.string().min(1).describe("The name of the filter."),
1365
1365
  query: s.string().min(1).describe(
1366
1366
  'The filter query string. Examples: "today & p1", "#Work & overdue", "@email & today", "(p1 | p2) & !assigned". Operators: | (OR), & (AND), ! (NOT), () grouping, , (multiple queries).'
@@ -1368,7 +1368,7 @@ const ir = s.object({
1368
1368
  color: le,
1369
1369
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite. Defaults to false.")
1370
1370
  }), cr = {
1371
- filters: s.array(ir).min(1).describe("The array of filters to add.")
1371
+ filters: s.array(ar).min(1).describe("The array of filters to add.")
1372
1372
  }, dr = {
1373
1373
  filters: s.array(Be).describe("The created filters."),
1374
1374
  totalCount: s.number().describe("The total number of filters created.")
@@ -1388,15 +1388,15 @@ const ir = s.object({
1388
1388
  ...p.isFavorite !== void 0 ? { isFavorite: p.isFavorite } : {}
1389
1389
  },
1390
1390
  o[m]
1391
- )), i = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1392
- const h = o[m], g = h !== void 0 ? i[h] : void 0;
1393
- if (!g) return null;
1394
- const I = p.color !== void 0 ? ne.parse(p.color) : void 0;
1391
+ )), a = (await t.sync({ commands: n })).tempIdMapping ?? {}, c = e.map((p, m) => {
1392
+ const h = o[m], I = h !== void 0 ? a[h] : void 0;
1393
+ if (!I) return null;
1394
+ const T = p.color !== void 0 ? ne.parse(p.color) : void 0;
1395
1395
  return {
1396
- id: g,
1396
+ id: I,
1397
1397
  name: p.name,
1398
1398
  query: p.query,
1399
- color: I,
1399
+ color: T,
1400
1400
  isFavorite: p.isFavorite ?? !1,
1401
1401
  itemOrder: 0
1402
1402
  };
@@ -1473,15 +1473,15 @@ class yr {
1473
1473
  const o = r.trim();
1474
1474
  if (!o)
1475
1475
  throw new Error("Workspace reference cannot be empty");
1476
- const n = await this.getWorkspaces(t), a = n.find((u) => u.id === o);
1477
- if (a)
1478
- return { workspaceId: a.id, workspaceName: a.name };
1476
+ const n = await this.getWorkspaces(t), i = n.find((u) => u.id === o);
1477
+ if (i)
1478
+ return { workspaceId: i.id, workspaceName: i.name };
1479
1479
  if (gr(o))
1480
1480
  return { workspaceId: o, workspaceName: o };
1481
- const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
1481
+ const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
1482
1482
  if (c)
1483
1483
  return { workspaceId: c.id, workspaceName: c.name };
1484
- const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
1484
+ const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
1485
1485
  if (l)
1486
1486
  return { workspaceId: l.id, workspaceName: l.name };
1487
1487
  if (d.length > 1) {
@@ -1516,7 +1516,7 @@ const wt = new yr(), kr = s.object({
1516
1516
  }), Tr = {
1517
1517
  projects: s.array(kr).min(1).describe("The array of projects to add.")
1518
1518
  }, wr = {
1519
- projects: s.array(ae).describe("The created projects."),
1519
+ projects: s.array(ie).describe("The created projects."),
1520
1520
  totalCount: s.number().describe("The total number of projects created.")
1521
1521
  }, Ir = {
1522
1522
  name: f.ADD_PROJECTS,
@@ -1537,12 +1537,12 @@ const wt = new yr(), kr = s.object({
1537
1537
  const l = c ? o.get(c) : void 0;
1538
1538
  return t.addProject({ ...d, ...l ? { workspaceId: l } : {} });
1539
1539
  })
1540
- ), a = vr({ projects: n }), i = n.map(q);
1540
+ ), i = vr({ projects: n }), a = n.map(q);
1541
1541
  return {
1542
- textContent: a,
1542
+ textContent: i,
1543
1543
  structuredContent: {
1544
- projects: i,
1545
- totalCount: i.length
1544
+ projects: a,
1545
+ totalCount: a.length
1546
1546
  }
1547
1547
  };
1548
1548
  }
@@ -1633,13 +1633,13 @@ const pe = 25, ye = s.enum(Nt), It = s.object({
1633
1633
  radius: c.radius
1634
1634
  });
1635
1635
  }
1636
- }), a = (await Promise.all(o)).map(ce);
1636
+ }), i = (await Promise.all(o)).map(ce);
1637
1637
  return {
1638
- textContent: Er(a),
1638
+ textContent: Er(i),
1639
1639
  structuredContent: {
1640
- reminders: a,
1641
- totalCount: a.length,
1642
- addedReminderIds: a.map((c) => c.id)
1640
+ reminders: i,
1641
+ totalCount: i.length,
1642
+ addedReminderIds: i.map((c) => c.id)
1643
1643
  }
1644
1644
  };
1645
1645
  }
@@ -1682,14 +1682,14 @@ const Or = s.object({
1682
1682
  client: o ? void 0 : t
1683
1683
  }) ?? c.projectId
1684
1684
  }))
1685
- ), a = await Promise.all(
1685
+ ), i = await Promise.all(
1686
1686
  n.map((c) => t.addSection(c))
1687
1687
  );
1688
1688
  return {
1689
- textContent: Ur({ sections: a }),
1689
+ textContent: Ur({ sections: i }),
1690
1690
  structuredContent: {
1691
- sections: a,
1692
- totalCount: a.length
1691
+ sections: i,
1692
+ totalCount: i.length
1693
1693
  }
1694
1694
  };
1695
1695
  }
@@ -1714,15 +1714,15 @@ class Nr {
1714
1714
  * Validate a single assignment operation
1715
1715
  */
1716
1716
  async validateAssignment(t, r) {
1717
- const { taskId: o, projectId: n, responsibleUid: a } = r, i = await B.resolveUser(t, a);
1718
- if (!i)
1717
+ const { taskId: o, projectId: n, responsibleUid: i } = r, a = await B.resolveUser(t, i);
1718
+ if (!a)
1719
1719
  return {
1720
1720
  isValid: !1,
1721
1721
  taskId: o,
1722
1722
  projectId: n,
1723
1723
  error: {
1724
1724
  type: Q.USER_NOT_FOUND,
1725
- message: `User "${a}" not found`,
1725
+ message: `User "${i}" not found`,
1726
1726
  suggestions: [
1727
1727
  "Check the spelling of the user name or email",
1728
1728
  "Ensure the user is a collaborator on at least one shared project",
@@ -1737,7 +1737,7 @@ class Nr {
1737
1737
  isValid: !1,
1738
1738
  taskId: o,
1739
1739
  projectId: n,
1740
- resolvedUser: i,
1740
+ resolvedUser: a,
1741
1741
  error: {
1742
1742
  type: Q.PROJECT_NOT_SHARED,
1743
1743
  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.`,
@@ -1750,16 +1750,16 @@ class Nr {
1750
1750
  if (!await B.validateProjectCollaborator(
1751
1751
  t,
1752
1752
  n,
1753
- i.userId
1753
+ a.userId
1754
1754
  ))
1755
1755
  return {
1756
1756
  isValid: !1,
1757
1757
  taskId: o,
1758
1758
  projectId: n,
1759
- resolvedUser: i,
1759
+ resolvedUser: a,
1760
1760
  error: {
1761
1761
  type: Q.USER_NOT_COLLABORATOR,
1762
- message: `User "${i.displayName}" is not a collaborator on project "${c.name}"`,
1762
+ message: `User "${a.displayName}" is not a collaborator on project "${c.name}"`,
1763
1763
  suggestions: [
1764
1764
  "Invite the user to collaborate on this project first",
1765
1765
  "Check if the user has been removed from the project",
@@ -1775,7 +1775,7 @@ class Nr {
1775
1775
  isValid: !1,
1776
1776
  taskId: o,
1777
1777
  projectId: n,
1778
- resolvedUser: i,
1778
+ resolvedUser: a,
1779
1779
  error: {
1780
1780
  type: Q.TASK_NOT_FOUND,
1781
1781
  message: `Task "${o}" not found or not accessible`,
@@ -1791,14 +1791,14 @@ class Nr {
1791
1791
  isValid: !0,
1792
1792
  taskId: o,
1793
1793
  projectId: n,
1794
- resolvedUser: i
1794
+ resolvedUser: a
1795
1795
  };
1796
1796
  } catch {
1797
1797
  return {
1798
1798
  isValid: !1,
1799
1799
  taskId: o,
1800
1800
  projectId: n,
1801
- resolvedUser: i,
1801
+ resolvedUser: a,
1802
1802
  error: {
1803
1803
  type: Q.PERMISSION_DENIED,
1804
1804
  message: "Permission denied or API error occurred",
@@ -1865,8 +1865,8 @@ class Nr {
1865
1865
  * Get detailed assignment eligibility information for troubleshooting
1866
1866
  */
1867
1867
  async getAssignmentEligibility(t, r, o, n) {
1868
- const a = [];
1869
- let i = !1, c;
1868
+ const i = [];
1869
+ let a = !1, c;
1870
1870
  try {
1871
1871
  c = await t.getProject(r);
1872
1872
  } catch {
@@ -1886,35 +1886,35 @@ class Nr {
1886
1886
  collaboratorCount: d.length
1887
1887
  };
1888
1888
  if (!c.isShared)
1889
- return a.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: a };
1889
+ return i.push("Share this project to enable task assignments"), { canAssign: !1, projectInfo: l, recommendations: i };
1890
1890
  const u = await B.resolveUser(t, o);
1891
1891
  if (!u)
1892
- return a.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: a };
1893
- const p = d.some((g) => g.id === u.userId), m = {
1892
+ return i.push("User not found - check spelling or invite to a shared project"), { canAssign: !1, projectInfo: l, recommendations: i };
1893
+ const p = d.some((I) => I.id === u.userId), m = {
1894
1894
  resolvedName: u.displayName,
1895
1895
  isCollaborator: p
1896
1896
  };
1897
1897
  if (!p)
1898
- return a.push(
1898
+ return i.push(
1899
1899
  `Invite ${u.displayName} to collaborate on project "${c.name}"`
1900
- ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: a };
1900
+ ), { canAssign: !1, projectInfo: l, userInfo: m, recommendations: i };
1901
1901
  let h;
1902
1902
  if (n && n.length > 0) {
1903
- let g = 0, I = 0;
1904
- for (const D of n)
1903
+ let I = 0, T = 0;
1904
+ for (const j of n)
1905
1905
  try {
1906
- await t.getTask(D), g++;
1906
+ await t.getTask(j), I++;
1907
1907
  } catch {
1908
- I++;
1908
+ T++;
1909
1909
  }
1910
- h = { accessibleTasks: g, inaccessibleTasks: I }, I > 0 && a.push(`${I} task(s) are not accessible`);
1910
+ h = { accessibleTasks: I, inaccessibleTasks: T }, T > 0 && i.push(`${T} task(s) are not accessible`);
1911
1911
  }
1912
- return i = !0, a.push(`Ready to assign tasks to ${u.displayName}`), {
1913
- canAssign: i,
1912
+ return a = !0, i.push(`Ready to assign tasks to ${u.displayName}`), {
1913
+ canAssign: a,
1914
1914
  projectInfo: l,
1915
1915
  userInfo: m,
1916
1916
  taskInfo: h,
1917
- recommendations: a
1917
+ recommendations: i
1918
1918
  };
1919
1919
  }
1920
1920
  }
@@ -1924,27 +1924,27 @@ function te(e = /* @__PURE__ */ new Date()) {
1924
1924
  return `${t}-${r}-${o}`;
1925
1925
  }
1926
1926
  function Ye(e, t, r = {}) {
1927
- const { context: o, showDetails: n = !1 } = r, a = t.length, i = [], d = `${e} ${a} ${a === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1928
- i.push(d);
1927
+ const { context: o, showDetails: n = !1 } = r, i = t.length, a = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${o ? ` ${o}` : ""}.`;
1928
+ a.push(d);
1929
1929
  const l = 5;
1930
- if (n || a <= l) {
1930
+ if (n || i <= l) {
1931
1931
  const u = Te(t, l);
1932
1932
  if (u.length > 0) {
1933
- const p = a > l ? `, +${a - l} more` : "";
1934
- i.push(`Tasks:
1933
+ const p = i > l ? `, +${i - l} more` : "";
1934
+ a.push(`Tasks:
1935
1935
  ${u}${p}.`);
1936
1936
  }
1937
1937
  }
1938
- return i.join(`
1938
+ return a.join(`
1939
1939
  `);
1940
1940
  }
1941
1941
  function Ge(e) {
1942
- const { action: t, success: r, total: o, successItems: n, successLabel: a = "Completed", failures: i } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1943
- if (c.push(d), n?.length && n.length <= 5 && c.push(`${a}:
1942
+ const { action: t, success: r, total: o, successItems: n, successLabel: i = "Completed", failures: a } = e, c = [], d = `${t}: ${r}/${o} successful.`;
1943
+ if (c.push(d), n?.length && n.length <= 5 && c.push(`${i}:
1944
1944
  ${n.map((l) => ` ${l}`).join(`
1945
- `)}.`), i?.length) {
1946
- const l = i.length, u = `Failed (${l}):
1947
- ${i.slice(0, je.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1945
+ `)}.`), a?.length) {
1946
+ const l = a.length, u = `Failed (${l}):
1947
+ ${a.slice(0, je.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}${p.code ? ` [${p.code}]` : ""})`).join(
1948
1948
  `
1949
1949
  `
1950
1950
  )}${l > je.MAX_FAILURES_SHOWN ? `, +${l - je.MAX_FAILURES_SHOWN} more` : ""}.`;
@@ -1954,16 +1954,16 @@ ${i.slice(0, je.MAX_FAILURES_SHOWN).map((p) => ` ${p.item} (Error: ${p.error}
1954
1954
  `);
1955
1955
  }
1956
1956
  function Lr(e) {
1957
- 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}` : "";
1958
- return ` ${t}${r}${o}${n}${a}`;
1957
+ 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}` : "";
1958
+ return ` ${t}${r}${o}${n}${i}`;
1959
1959
  }
1960
1960
  function Mr(e) {
1961
1961
  const t = ` (${e.color})`, r = e.isFavorite ? " • ⭐" : "", o = ` • id=${e.id}`;
1962
1962
  return ` ${e.name}${t}${r}${o}`;
1963
1963
  }
1964
1964
  function Fr(e) {
1965
- const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", a = ` • id=${e.id}`;
1966
- return ` ${e.name}${t}${r}${o}${n}${a}`;
1965
+ const t = e.inboxProject ? " • Inbox" : "", r = e.isFavorite ? " • ⭐" : "", o = e.isShared ? " • Shared" : "", n = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
1966
+ return ` ${e.name}${t}${r}${o}${n}${i}`;
1967
1967
  }
1968
1968
  function Te(e, t = 5) {
1969
1969
  const o = e.slice(0, t).map(Lr).join(`
@@ -1981,13 +1981,13 @@ function F({
1981
1981
  limit: r,
1982
1982
  nextCursor: o,
1983
1983
  filterHints: n,
1984
- previewLines: a,
1985
- zeroReasonHints: i,
1984
+ previewLines: i,
1985
+ zeroReasonHints: a,
1986
1986
  nextSteps: c
1987
1987
  }) {
1988
1988
  const d = [], l = `${e}: ${t}${typeof r == "number" ? ` (limit ${r})` : ""}${o ? ", more available" : ""}.`;
1989
- return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), a?.length && d.push(`Preview:
1990
- ${a}`), !t && i?.length && d.push(`No results. ${i.join("; ")}.`), (c?.length || o) && d.push(jt(c || [], o)), d.join(`
1989
+ return d.push(l), n?.length && d.push(`Filter: ${n.join("; ")}.`), i?.length && d.push(`Preview:
1990
+ ${i}`), !t && a?.length && d.push(`No results. ${a.join("; ")}.`), (c?.length || o) && d.push(jt(c || [], o)), d.join(`
1991
1991
  `);
1992
1992
  }
1993
1993
  function jt(e, t) {
@@ -2060,30 +2060,30 @@ const tt = 25, Hr = s.object({
2060
2060
  }
2061
2061
  return u;
2062
2062
  })
2063
- )).flat().sort((l, u) => l.index - u.index), a = [], i = [];
2063
+ )).flat().sort((l, u) => l.index - u.index), i = [], a = [];
2064
2064
  for (const { index: l, result: u } of n)
2065
- u.status === "fulfilled" ? a.push(u.value) : i.push({
2065
+ u.status === "fulfilled" ? i.push(u.value) : a.push({
2066
2066
  item: e[l]?.content ?? `Task ${l + 1}`,
2067
2067
  error: u.reason instanceof Error ? u.reason.message : String(u.reason)
2068
2068
  });
2069
- if (a.length === 0 && i.length > 0) {
2070
- const l = i.map((u) => `"${u.item}": ${u.error}`).join("; ");
2071
- throw new Error(`All ${i.length} task(s) failed to create: ${l}`);
2069
+ if (i.length === 0 && a.length > 0) {
2070
+ const l = a.map((u) => `"${u.item}": ${u.error}`).join("; ");
2071
+ throw new Error(`All ${a.length} task(s) failed to create: ${l}`);
2072
2072
  }
2073
- const c = a.map(_);
2073
+ const c = i.map(R);
2074
2074
  return {
2075
2075
  textContent: qr({
2076
2076
  tasks: c,
2077
- failures: i,
2077
+ failures: a,
2078
2078
  args: { tasks: e }
2079
2079
  }),
2080
2080
  structuredContent: {
2081
2081
  tasks: c,
2082
2082
  totalCount: c.length,
2083
- failures: i,
2083
+ failures: a,
2084
2084
  totalRequested: e.length,
2085
- successCount: a.length,
2086
- failureCount: i.length
2085
+ successCount: i.length,
2086
+ failureCount: a.length
2087
2087
  }
2088
2088
  };
2089
2089
  }
@@ -2092,79 +2092,81 @@ function Yr(e) {
2092
2092
  return `${e.projectId ?? ""}|${e.sectionId ?? ""}|${e.parentId ?? ""}`;
2093
2093
  }
2094
2094
  async function Gr(e, t) {
2095
- const {
2096
- duration: r,
2097
- projectId: o,
2098
- sectionId: n,
2095
+ const r = Object.fromEntries(
2096
+ Object.entries(e).map(([T, j]) => [T, j === "" ? void 0 : j])
2097
+ ), {
2098
+ duration: o,
2099
+ projectId: n,
2100
+ sectionId: i,
2099
2101
  parentId: a,
2100
- order: i,
2101
- responsibleUser: c,
2102
- priority: d,
2103
- labels: l,
2104
- deadlineDate: u,
2105
- ...p
2106
- } = e, m = de(o) ? void 0 : o;
2107
- if (m) {
2108
- const g = await t.getProject(m);
2109
- if (g.isArchived)
2102
+ order: c,
2103
+ responsibleUser: d,
2104
+ priority: l,
2105
+ labels: u,
2106
+ deadlineDate: p,
2107
+ ...m
2108
+ } = r, h = de(n) ? void 0 : n;
2109
+ if (h) {
2110
+ const T = await t.getProject(h);
2111
+ if (T.isArchived)
2110
2112
  throw new Error(
2111
- `Task "${e.content}": Cannot create task in archived project "${g.name}"`
2113
+ `Task "${e.content}": Cannot create task in archived project "${T.name}"`
2112
2114
  );
2113
2115
  }
2114
- let h = {
2115
- ...p,
2116
- projectId: m,
2117
- sectionId: n,
2116
+ let I = {
2117
+ ...m,
2118
+ projectId: h,
2119
+ sectionId: i,
2118
2120
  parentId: a,
2119
- order: i,
2120
- labels: l,
2121
- deadlineDate: u
2121
+ order: c,
2122
+ labels: u,
2123
+ deadlineDate: p
2122
2124
  };
2123
- if (d && (h.priority = bt(d)), c && !m && !n && !a)
2125
+ if (l && (I.priority = bt(l)), d && !h && !i && !a)
2124
2126
  throw new Error(
2125
2127
  `Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
2126
2128
  );
2127
- if (r)
2129
+ if (o)
2128
2130
  try {
2129
- const { minutes: g } = ft(r);
2130
- h = {
2131
- ...h,
2132
- duration: g,
2131
+ const { minutes: T } = ft(o);
2132
+ I = {
2133
+ ...I,
2134
+ duration: T,
2133
2135
  durationUnit: "minute"
2134
2136
  };
2135
- } catch (g) {
2136
- throw g instanceof O ? new Error(`Task "${e.content}": ${g.message}`) : g;
2137
+ } catch (T) {
2138
+ throw T instanceof P ? new Error(`Task "${e.content}": ${T.message}`) : T;
2137
2139
  }
2138
- if (c) {
2139
- let g = m;
2140
- if (!g && a)
2140
+ if (d) {
2141
+ let T = h;
2142
+ if (!T && a)
2141
2143
  try {
2142
- g = (await t.getTask(a)).projectId;
2144
+ T = (await t.getTask(a)).projectId;
2143
2145
  } catch {
2144
2146
  throw new Error(`Task "${e.content}": Parent task "${a}" not found`);
2145
2147
  }
2146
- else if (!g && n)
2148
+ else if (!T && i)
2147
2149
  throw new Error(
2148
2150
  `Task "${e.content}": When assigning tasks to sections, please also specify projectId`
2149
2151
  );
2150
- if (!g)
2152
+ if (!T)
2151
2153
  throw new Error(
2152
2154
  `Task "${e.content}": Cannot determine target project for assignment validation`
2153
2155
  );
2154
- const I = await ze.validateTaskCreationAssignment(
2156
+ const j = await ze.validateTaskCreationAssignment(
2155
2157
  t,
2156
- g,
2157
- c
2158
+ T,
2159
+ d
2158
2160
  );
2159
- if (!I.isValid) {
2160
- const D = I.error?.message || "Assignment validation failed", $ = I.error?.suggestions?.join(". ") || "";
2161
+ if (!j.isValid) {
2162
+ const $ = j.error?.message || "Assignment validation failed", A = j.error?.suggestions?.join(". ") || "";
2161
2163
  throw new Error(
2162
- `Task "${e.content}": ${D}${$ ? `. ${$}` : ""}`
2164
+ `Task "${e.content}": ${$}${A ? `. ${A}` : ""}`
2163
2165
  );
2164
2166
  }
2165
- h.assigneeId = I.resolvedUser?.userId;
2167
+ I.assigneeId = j.resolvedUser?.userId;
2166
2168
  }
2167
- return await t.addTask(h);
2169
+ return await t.addTask(I);
2168
2170
  }
2169
2171
  function qr({
2170
2172
  tasks: e,
@@ -2172,18 +2174,18 @@ function qr({
2172
2174
  args: r
2173
2175
  }) {
2174
2176
  const o = /* @__PURE__ */ new Set();
2175
- for (const a of r.tasks)
2176
- a.projectId && !de(a.projectId) ? o.add("projects") : a.sectionId ? o.add("sections") : a.parentId ? o.add("subtasks") : o.add("inbox");
2177
+ for (const i of r.tasks)
2178
+ i.projectId && !de(i.projectId) ? o.add("projects") : i.sectionId ? o.add("sections") : i.parentId ? o.add("subtasks") : o.add("inbox");
2177
2179
  let n = "";
2178
2180
  if (o.size === 1) {
2179
- const a = Array.from(o)[0];
2180
- n = a === "inbox" ? "" : `to ${a}`;
2181
+ const i = Array.from(o)[0];
2182
+ n = i === "inbox" ? "" : `to ${i}`;
2181
2183
  } else o.size > 1 && (n = "to multiple contexts");
2182
2184
  return t.length > 0 ? Ge({
2183
2185
  action: `Added tasks${n ? ` ${n}` : ""}`,
2184
2186
  success: e.length,
2185
2187
  total: r.tasks.length,
2186
- successItems: e.map((a) => a.content ?? "Untitled"),
2188
+ successItems: e.map((i) => i.content ?? "Untitled"),
2187
2189
  successLabel: "Created",
2188
2190
  failures: t
2189
2191
  }) : Ye("Added", e, {
@@ -2246,13 +2248,13 @@ ${n}`,
2246
2248
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
2247
2249
  async execute(e, t) {
2248
2250
  const r = [], o = [];
2249
- for (const a of e.ids)
2251
+ for (const i of e.ids)
2250
2252
  try {
2251
- await t.closeTask(a), r.push(a);
2252
- } catch (i) {
2253
- const c = i instanceof Error ? i.message : "Unknown error";
2253
+ await t.closeTask(i), r.push(i);
2254
+ } catch (a) {
2255
+ const c = a instanceof Error ? a.message : "Unknown error";
2254
2256
  o.push({
2255
- item: a,
2257
+ item: i,
2256
2258
  error: c
2257
2259
  });
2258
2260
  }
@@ -2358,8 +2360,8 @@ const St = [
2358
2360
  }, no = {
2359
2361
  type: s.enum(Ct).describe("The type of object fetched."),
2360
2362
  id: s.string().describe("The ID of the fetched object."),
2361
- object: s.union([K, ae, be, fe]).describe("The fetched object data.")
2362
- }, ao = {
2363
+ object: s.union([K, ie, be, fe]).describe("The fetched object data.")
2364
+ }, io = {
2363
2365
  name: f.FETCH_OBJECT,
2364
2366
  description: "Fetch a single task, project, comment, or section by its ID. Use this when you have a specific object ID and want to retrieve its full details.",
2365
2367
  parameters: oo,
@@ -2370,35 +2372,35 @@ const St = [
2370
2372
  try {
2371
2373
  switch (r) {
2372
2374
  case "task": {
2373
- const n = await t.getTask(o), a = _(n);
2375
+ const n = await t.getTask(o), i = R(n);
2374
2376
  return {
2375
- textContent: `Found task: ${a.content} • id=${a.id} • priority=${a.priority} • project=${a.projectId}`,
2377
+ textContent: `Found task: ${i.content} • id=${i.id} • priority=${i.priority} • project=${i.projectId}`,
2376
2378
  structuredContent: {
2377
2379
  type: r,
2378
2380
  id: o,
2379
- object: a
2381
+ object: i
2380
2382
  }
2381
2383
  };
2382
2384
  }
2383
2385
  case "project": {
2384
- const n = await t.getProject(o), a = q(n);
2386
+ const n = await t.getProject(o), i = q(n);
2385
2387
  return {
2386
- textContent: `Found project: ${a.name} • id=${a.id} • color=${a.color} • viewStyle=${a.viewStyle}`,
2388
+ textContent: `Found project: ${i.name} • id=${i.id} • color=${i.color} • viewStyle=${i.viewStyle}`,
2387
2389
  structuredContent: {
2388
2390
  type: r,
2389
2391
  id: o,
2390
- object: a
2392
+ object: i
2391
2393
  }
2392
2394
  };
2393
2395
  }
2394
2396
  case "comment": {
2395
- const n = await t.getComment(o), a = me(n), i = a.content.length > 50 ? `${a.content.substring(0, 50)}...` : a.content;
2397
+ const n = await t.getComment(o), i = me(n), a = i.content.length > 50 ? `${i.content.substring(0, 50)}...` : i.content;
2396
2398
  return {
2397
- textContent: `Found comment • id=${a.id} • content="${i}" • posted=${a.postedAt}`,
2399
+ textContent: `Found comment • id=${i.id} • content="${a}" • posted=${i.postedAt}`,
2398
2400
  structuredContent: {
2399
2401
  type: r,
2400
2402
  id: o,
2401
- object: a
2403
+ object: i
2402
2404
  }
2403
2405
  };
2404
2406
  }
@@ -2406,16 +2408,16 @@ const St = [
2406
2408
  const n = await t.getSection(o);
2407
2409
  if (!n)
2408
2410
  throw new Error(`Section ${o} not found.`);
2409
- const a = {
2411
+ const i = {
2410
2412
  id: n.id,
2411
2413
  name: n.name
2412
2414
  };
2413
2415
  return {
2414
- textContent: `Found section: ${a.name} • id=${a.id}`,
2416
+ textContent: `Found section: ${i.name} • id=${i.id}`,
2415
2417
  structuredContent: {
2416
2418
  type: r,
2417
2419
  id: o,
2418
- object: a
2420
+ object: i
2419
2421
  }
2420
2422
  };
2421
2423
  }
@@ -2426,7 +2428,7 @@ const St = [
2426
2428
  );
2427
2429
  }
2428
2430
  }
2429
- }, io = {
2431
+ }, ao = {
2430
2432
  id: s.string().min(1).describe(
2431
2433
  'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
2432
2434
  )
@@ -2439,7 +2441,7 @@ const St = [
2439
2441
  }, lo = {
2440
2442
  name: f.FETCH,
2441
2443
  description: 'Fetch the full contents of a task or project by its ID. The ID should be in the format "task:{id}" or "project:{id}".',
2442
- parameters: io,
2444
+ parameters: ao,
2443
2445
  outputSchema: co,
2444
2446
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2445
2447
  async execute(e, t) {
@@ -2448,14 +2450,14 @@ const St = [
2448
2450
  throw new Error(
2449
2451
  'Invalid ID format. Expected "task:{id}" or "project:{id}". Example: "task:8485093748" or "project:6cfCcrrCFg2xP94Q"'
2450
2452
  );
2451
- let a;
2453
+ let i;
2452
2454
  if (o === "task") {
2453
- const i = await t.getTask(n), c = _(i), d = [c.content];
2455
+ const a = await t.getTask(n), c = R(a), d = [c.content];
2454
2456
  c.description && d.push(`
2455
2457
 
2456
2458
  Description: ${c.description}`), c.dueDate && d.push(`
2457
2459
  Due: ${c.dueDate}`), c.labels.length > 0 && d.push(`
2458
- Labels: ${c.labels.join(", ")}`), a = {
2460
+ Labels: ${c.labels.join(", ")}`), i = {
2459
2461
  id: `task:${c.id}`,
2460
2462
  title: c.content,
2461
2463
  text: d.join(""),
@@ -2474,11 +2476,11 @@ Labels: ${c.labels.join(", ")}`), a = {
2474
2476
  }
2475
2477
  };
2476
2478
  } else {
2477
- const i = await t.getProject(n), c = q(i), d = [c.name];
2479
+ const a = await t.getProject(n), c = q(a), d = [c.name];
2478
2480
  c.isShared && d.push(`
2479
2481
 
2480
2482
  Shared project`), c.isFavorite && d.push(`
2481
- Favorite: Yes`), a = {
2483
+ Favorite: Yes`), i = {
2482
2484
  id: `project:${c.id}`,
2483
2485
  title: c.name,
2484
2486
  text: d.join(""),
@@ -2494,8 +2496,8 @@ Favorite: Yes`), a = {
2494
2496
  };
2495
2497
  }
2496
2498
  return {
2497
- textContent: JSON.stringify(a),
2498
- structuredContent: a
2499
+ textContent: JSON.stringify(i),
2500
+ structuredContent: i
2499
2501
  };
2500
2502
  }
2501
2503
  }, uo = {
@@ -2515,7 +2517,7 @@ Favorite: Yes`), a = {
2515
2517
  projectId: s.string().optional().describe("Filter events by parent project ID."),
2516
2518
  taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
2517
2519
  initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
2518
- limit: s.number().int().min(1).max(C.ACTIVITY_MAX).default(C.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
2520
+ limit: s.number().int().min(1).max(D.ACTIVITY_MAX).default(D.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
2519
2521
  cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
2520
2522
  }, po = {
2521
2523
  events: s.array(Vs).describe("The activity events."),
@@ -2530,11 +2532,11 @@ Favorite: Yes`), a = {
2530
2532
  outputSchema: po,
2531
2533
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2532
2534
  async execute(e, t) {
2533
- const { objectType: r, objectId: o, eventType: n, projectId: a, taskId: i, initiatorId: c, limit: d, cursor: l } = e, u = {
2535
+ const { objectType: r, objectId: o, eventType: n, projectId: i, taskId: a, initiatorId: c, limit: d, cursor: l } = e, u = {
2534
2536
  limit: d,
2535
2537
  cursor: l ?? null
2536
2538
  };
2537
- r && n ? u.objectEventTypes = `${r}:${n}` : r ? u.objectEventTypes = `${r}:` : n && (u.objectEventTypes = `:${n}`), o && o !== "remove" && (u.objectId = o), a && (u.parentProjectId = a), i && (u.parentItemId = i), c && (u.initiatorId = c);
2539
+ r && n ? u.objectEventTypes = `${r}:${n}` : r ? u.objectEventTypes = `${r}:` : n && (u.objectEventTypes = `:${n}`), o && o !== "remove" && (u.objectId = o), i && (u.parentProjectId = i), a && (u.parentItemId = a), c && (u.initiatorId = c);
2538
2540
  const { results: p, nextCursor: m } = await t.getActivityLogs(u), h = p.map(zs);
2539
2541
  return {
2540
2542
  textContent: ho({ events: h, args: e, nextCursor: m }),
@@ -2560,17 +2562,17 @@ function ho({
2560
2562
  n.push(c);
2561
2563
  }
2562
2564
  n.length > 0 && (o = `Activity: ${n.join(" ")}`);
2563
- const a = [];
2564
- 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}`);
2565
2565
  const i = [];
2566
- return e.length === 0 && (i.push("No activity events match the specified filters"), i.push("Note: Activity logs only show recent events"), t.eventType && i.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && i.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && i.push("Verify the object ID is correct")), F({
2566
+ 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}`);
2567
+ const a = [];
2568
+ return e.length === 0 && (a.push("No activity events match the specified filters"), a.push("Note: Activity logs only show recent events"), t.eventType && a.push(`Try removing the eventType filter (${t.eventType})`), t.objectType && a.push(`Try removing the objectType filter (${t.objectType})`), (t.objectId || t.projectId || t.taskId) && a.push("Verify the object ID is correct")), F({
2567
2569
  subject: o,
2568
2570
  count: e.length,
2569
2571
  limit: t.limit,
2570
2572
  nextCursor: r ?? void 0,
2571
- filterHints: a,
2573
+ filterHints: i,
2572
2574
  previewLines: fo(e, Math.min(e.length, t.limit)),
2573
- zeroReasonHints: i
2575
+ zeroReasonHints: a
2574
2576
  });
2575
2577
  }
2576
2578
  function fo(e, t = 10) {
@@ -2590,8 +2592,8 @@ function bo(e) {
2590
2592
  const c = e.extraData.content || e.extraData.name || e.extraData.last_content;
2591
2593
  c && typeof c == "string" && (o = ` • "${c.length > 50 ? `${c.substring(0, 47)}...` : c}"`);
2592
2594
  }
2593
- const n = e.objectId ? ` • id=${e.objectId}` : "", a = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", i = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
2594
- return ` [${t}] ${r}${o}${n}${a}${i}`;
2595
+ const n = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", a = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
2596
+ return ` [${t}] ${r}${o}${n}${i}${a}`;
2595
2597
  }
2596
2598
  function go(e) {
2597
2599
  try {
@@ -2613,7 +2615,7 @@ const yo = {
2613
2615
  ),
2614
2616
  commentId: s.string().optional().describe("Get a specific comment by ID."),
2615
2617
  cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
2616
- limit: s.number().int().min(1).max(C.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
2618
+ limit: s.number().int().min(1).max(D.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
2617
2619
  }, ko = {
2618
2620
  comments: s.array(be).describe("The found comments."),
2619
2621
  searchType: s.string().describe(
@@ -2641,40 +2643,40 @@ const yo = {
2641
2643
  projectId: e.projectId,
2642
2644
  client: t
2643
2645
  });
2644
- let n = !1, a = null, i;
2646
+ let n = !1, i = null, a;
2645
2647
  if (e.commentId)
2646
- i = [await t.getComment(e.commentId)];
2648
+ a = [await t.getComment(e.commentId)];
2647
2649
  else if (e.taskId) {
2648
2650
  const l = await t.getComments({
2649
2651
  taskId: e.taskId,
2650
2652
  cursor: e.cursor || null,
2651
- limit: e.limit || C.COMMENTS_DEFAULT
2653
+ limit: e.limit || D.COMMENTS_DEFAULT
2652
2654
  });
2653
- i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2655
+ a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
2654
2656
  } else if (o) {
2655
2657
  const l = await t.getComments({
2656
2658
  projectId: o,
2657
2659
  cursor: e.cursor || null,
2658
- limit: e.limit || C.COMMENTS_DEFAULT
2660
+ limit: e.limit || D.COMMENTS_DEFAULT
2659
2661
  });
2660
- i = l.results, n = l.nextCursor !== null, a = l.nextCursor;
2662
+ a = l.results, n = l.nextCursor !== null, i = l.nextCursor;
2661
2663
  } else
2662
2664
  throw new Error("Invalid state: no search parameter provided");
2663
- const c = i.map(me);
2665
+ const c = a.map(me);
2664
2666
  return {
2665
2667
  textContent: wo({
2666
2668
  comments: c,
2667
2669
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
2668
2670
  searchId: e.commentId || e.taskId || e.projectId || "",
2669
2671
  hasMore: n,
2670
- nextCursor: a
2672
+ nextCursor: i
2671
2673
  }),
2672
2674
  structuredContent: {
2673
2675
  comments: c,
2674
2676
  searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
2675
2677
  searchId: e.commentId || e.taskId || e.projectId || "",
2676
2678
  hasMore: n,
2677
- nextCursor: a ?? void 0,
2679
+ nextCursor: i ?? void 0,
2678
2680
  totalCount: c.length
2679
2681
  }
2680
2682
  };
@@ -2689,22 +2691,22 @@ function wo({
2689
2691
  }) {
2690
2692
  if (e.length === 0)
2691
2693
  return `No comments found for ${t}${t !== "single" ? ` ${r}` : ""}`;
2692
- let a;
2694
+ let i;
2693
2695
  if (t === "single") {
2694
- const i = e[0];
2695
- if (!i)
2696
+ const a = e[0];
2697
+ if (!a)
2696
2698
  return "Comment not found";
2697
- a = `Found comment${i.fileAttachment !== void 0 ? ` • Has attachment: ${i.fileAttachment?.fileName || "file"}` : ""} • id=${i.id}`;
2699
+ i = `Found comment${a.fileAttachment !== void 0 ? ` • Has attachment: ${a.fileAttachment?.fileName || "file"}` : ""} • id=${a.id}`;
2698
2700
  } else {
2699
- const i = e.filter((l) => l.fileAttachment !== void 0).length, c = i > 0 ? ` (${i} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
2700
- a = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (a += " • More available");
2701
+ const a = e.filter((l) => l.fileAttachment !== void 0).length, c = a > 0 ? ` (${a} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
2702
+ i = `Found ${e.length} ${d} for ${t} ${r}${c}`, o && (i += " • More available");
2701
2703
  }
2702
2704
  if (n) {
2703
- const i = jt([], n);
2704
- return `${a}
2705
- ${i}`;
2705
+ const a = jt([], n);
2706
+ return `${i}
2707
+ ${a}`;
2706
2708
  }
2707
- return a;
2709
+ return i;
2708
2710
  }
2709
2711
  function $t(e) {
2710
2712
  const t = e.getUTCFullYear(), r = String(e.getUTCMonth() + 1).padStart(2, "0"), o = String(e.getUTCDate()).padStart(2, "0");
@@ -2714,18 +2716,18 @@ function Io(e) {
2714
2716
  const t = /^([+-])(\d{2}):(\d{2})$/.exec(e);
2715
2717
  if (!t)
2716
2718
  return 0;
2717
- const [, r, o, n] = t, a = Number(o) * 60 + Number(n);
2718
- return r === "-" ? -a : a;
2719
+ const [, r, o, n] = t, i = Number(o) * 60 + Number(n);
2720
+ return r === "-" ? -i : i;
2719
2721
  }
2720
2722
  function vo(e, t) {
2721
2723
  const r = new Date(e.getTime() + t * 60 * 1e3);
2722
2724
  return $t(r);
2723
2725
  }
2724
2726
  function st(e, t) {
2725
- const [r, o, n] = e.split("-"), a = Number(r), i = Number(o), c = Number(n);
2726
- if (!Number.isFinite(a) || !Number.isFinite(i) || !Number.isFinite(c))
2727
+ const [r, o, n] = e.split("-"), i = Number(r), a = Number(o), c = Number(n);
2728
+ if (!Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(c))
2727
2729
  throw new Error(`Invalid date format: ${e}. Expected YYYY-MM-DD.`);
2728
- const d = new Date(Date.UTC(a, i - 1, c));
2730
+ const d = new Date(Date.UTC(i, a - 1, c));
2729
2731
  return d.setUTCDate(d.getUTCDate() + t), $t(d);
2730
2732
  }
2731
2733
  const jo = ["and", "or"], qe = {
@@ -2737,7 +2739,7 @@ const jo = ["and", "or"], qe = {
2737
2739
  function Ke(e = [], t = "or") {
2738
2740
  if (e.length === 0) return "";
2739
2741
  const r = t === "and" ? " & " : " | ";
2740
- return `(${e.map((a) => a.startsWith("@") ? a : `@${a}`).join(` ${r} `)})`;
2742
+ return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${r} `)})`;
2741
2743
  }
2742
2744
  const So = 7;
2743
2745
  function Co({
@@ -2746,9 +2748,9 @@ function Co({
2746
2748
  userGmtOffset: r,
2747
2749
  now: o = /* @__PURE__ */ new Date()
2748
2750
  }) {
2749
- const n = Io(r), a = vo(o, n), i = So - 1, c = t ?? (e ? st(e, i) : a);
2751
+ const n = Io(r), i = vo(o, n), a = So - 1, c = t ?? (e ? st(e, a) : i);
2750
2752
  return {
2751
- since: e ?? st(c, -i),
2753
+ since: e ?? st(c, -a),
2752
2754
  until: c
2753
2755
  };
2754
2756
  }
@@ -2771,7 +2773,7 @@ const $o = {
2771
2773
  responsibleUser: s.string().optional().describe(
2772
2774
  "Filter completed tasks assigned to this user. User ID, name, or email. For personal queries (summaries, plans, reports), set to current user from user-info to exclude collaborators. Defaults to all collaborators."
2773
2775
  ),
2774
- limit: s.number().int().min(1).max(C.COMPLETED_TASKS_MAX).default(C.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
2776
+ limit: s.number().int().min(1).max(D.COMPLETED_TASKS_MAX).default(D.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
2775
2777
  cursor: s.string().optional().describe(
2776
2778
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
2777
2779
  ),
@@ -2789,51 +2791,51 @@ const $o = {
2789
2791
  outputSchema: Do,
2790
2792
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2791
2793
  async execute(e, t) {
2792
- const { getBy: r, labels: o, labelsOperator: n, since: a, until: i, responsibleUser: c, projectId: d, ...l } = e;
2793
- if (e.cursor && (!a || !i))
2794
+ const { getBy: r, labels: o, labelsOperator: n, since: i, until: a, responsibleUser: c, projectId: d, ...l } = e;
2795
+ if (e.cursor && (!i || !a))
2794
2796
  throw new Error(
2795
2797
  "Cursor pagination requires explicit since and until. Reuse structuredContent.appliedFilters.since and structuredContent.appliedFilters.until from the previous page."
2796
2798
  );
2797
2799
  const u = await Le(t, c), p = u?.email;
2798
2800
  let h = Ke(o, n);
2799
2801
  u && p && (h = se(h, `assigned to: ${p}`));
2800
- const g = await t.getUser(), I = g.tzInfo?.gmtString || "+00:00", D = await G({
2802
+ const I = await t.getUser(), T = I.tzInfo?.gmtString || "+00:00", j = await G({
2801
2803
  projectId: d,
2802
- user: g
2804
+ user: I
2803
2805
  }), $ = Co({
2804
- since: a,
2805
- until: i,
2806
- userGmtOffset: I
2807
- }), N = `${$.since}T00:00:00${I}`, T = `${$.until}T23:59:59${I}`, b = new Date(N).toISOString(), S = new Date(T).toISOString(), R = {
2806
+ since: i,
2807
+ until: a,
2808
+ userGmtOffset: T
2809
+ }), A = `${$.since}T00:00:00${T}`, k = `${$.until}T23:59:59${T}`, b = new Date(A).toISOString(), C = new Date(k).toISOString(), U = {
2808
2810
  ...e,
2809
2811
  since: $.since,
2810
2812
  until: $.until
2811
- }, { items: w, nextCursor: j } = r === "completion" ? await t.getCompletedTasksByCompletionDate({
2813
+ }, { items: w, nextCursor: S } = r === "completion" ? await t.getCompletedTasksByCompletionDate({
2812
2814
  ...l,
2813
- projectId: D,
2815
+ projectId: j,
2814
2816
  since: b,
2815
- until: S,
2817
+ until: C,
2816
2818
  ...h ? { filterQuery: h, filterLang: "en" } : {}
2817
2819
  }) : await t.getCompletedTasksByDueDate({
2818
2820
  ...l,
2819
- projectId: D,
2821
+ projectId: j,
2820
2822
  since: b,
2821
- until: S,
2823
+ until: C,
2822
2824
  ...h ? { filterQuery: h, filterLang: "en" } : {}
2823
- }), v = w.map(_);
2825
+ }), v = w.map(R);
2824
2826
  return {
2825
2827
  textContent: Ao({
2826
2828
  tasks: v,
2827
- args: R,
2828
- nextCursor: j,
2829
+ args: U,
2830
+ nextCursor: S,
2829
2831
  assigneeEmail: p
2830
2832
  }),
2831
2833
  structuredContent: {
2832
2834
  tasks: v,
2833
- nextCursor: j ?? void 0,
2835
+ nextCursor: S ?? void 0,
2834
2836
  totalCount: v.length,
2835
- hasMore: !!j,
2836
- appliedFilters: R
2837
+ hasMore: !!S,
2838
+ appliedFilters: U
2837
2839
  }
2838
2840
  };
2839
2841
  }
@@ -2844,22 +2846,22 @@ function Ao({
2844
2846
  nextCursor: r,
2845
2847
  assigneeEmail: o
2846
2848
  }) {
2847
- const n = t.getBy === "completion" ? "completed" : "due", a = `Completed tasks (by ${n} date)`, i = [];
2848
- 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) {
2849
+ const n = t.getBy === "completion" ? "completed" : "due", i = `Completed tasks (by ${n} date)`, a = [];
2850
+ if (a.push(`${n} date: ${t.since} to ${t.until}`), t.projectId && a.push(`project: ${t.projectId}`), t.sectionId && a.push(`section: ${t.sectionId}`), t.parentId && a.push(`parent: ${t.parentId}`), t.workspaceId && a.push(`workspace: ${t.workspaceId}`), t.labels && t.labels.length > 0) {
2849
2851
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
2850
- i.push(`labels: ${d}`);
2852
+ a.push(`labels: ${d}`);
2851
2853
  }
2852
2854
  if (t.responsibleUser) {
2853
2855
  const d = o || t.responsibleUser;
2854
- i.push(`assigned to: ${d}`);
2856
+ a.push(`assigned to: ${d}`);
2855
2857
  }
2856
2858
  const c = [];
2857
2859
  return e.length === 0 && (c.push("No tasks completed in this date range"), c.push("Try expanding the date range"), (t.projectId || t.sectionId || t.parentId) && c.push("Try removing project/section/parent filters"), t.getBy === "due" && c.push('Try switching to "completion" date instead')), F({
2858
- subject: a,
2860
+ subject: i,
2859
2861
  count: e.length,
2860
2862
  limit: t.limit,
2861
2863
  nextCursor: r ?? void 0,
2862
- filterHints: i,
2864
+ filterHints: a,
2863
2865
  previewLines: Te(e, Math.min(e.length, t.limit)),
2864
2866
  zeroReasonHints: c
2865
2867
  });
@@ -2868,7 +2870,7 @@ const Eo = {
2868
2870
  searchText: s.string().optional().describe(
2869
2871
  'Search for a label by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all labels are returned.'
2870
2872
  ),
2871
- limit: s.number().int().min(1).max(C.LABELS_MAX).default(C.LABELS_DEFAULT).describe("The maximum number of labels to return."),
2873
+ limit: s.number().int().min(1).max(D.LABELS_MAX).default(D.LABELS_DEFAULT).describe("The maximum number of labels to return."),
2872
2874
  cursor: s.string().optional().describe(
2873
2875
  "The cursor to get the next page of labels (cursor is obtained from the previous call to this tool, with the same parameters). Ignored when searchText is provided."
2874
2876
  )
@@ -2894,16 +2896,16 @@ const Eo = {
2894
2896
  nextCursor: null
2895
2897
  })) : t.getLabels({ limit: e.limit, cursor: e.cursor ?? null }),
2896
2898
  Hs(t)
2897
- ]), { results: n, nextCursor: a } = r, i = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
2899
+ ]), { results: n, nextCursor: i } = r, a = e.searchText ? { searchText: e.searchText } : { limit: e.limit, cursor: e.cursor };
2898
2900
  return {
2899
- textContent: _o({ labels: n, args: e, nextCursor: a, sharedLabels: o }),
2901
+ textContent: _o({ labels: n, args: e, nextCursor: i, sharedLabels: o }),
2900
2902
  structuredContent: {
2901
2903
  labels: n.map((c) => ge.parse(c)),
2902
- nextCursor: a ?? void 0,
2904
+ nextCursor: i ?? void 0,
2903
2905
  totalCount: n.length,
2904
- hasMore: !!a,
2906
+ hasMore: !!i,
2905
2907
  sharedLabels: o,
2906
- appliedFilters: i
2908
+ appliedFilters: a
2907
2909
  }
2908
2910
  };
2909
2911
  }
@@ -2914,10 +2916,10 @@ function _o({
2914
2916
  nextCursor: r,
2915
2917
  sharedLabels: o
2916
2918
  }) {
2917
- const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", a = [];
2918
- t.searchText && a.push(`searchText: "${t.searchText}"`);
2919
- const i = 10, d = e.slice(0, i).map(Mr).join(`
2920
- `), l = e.length - i, u = l > 0 ? `${d}
2919
+ const n = t.searchText ? `All labels matching "${t.searchText}"` : "Labels", i = [];
2920
+ t.searchText && i.push(`searchText: "${t.searchText}"`);
2921
+ const a = 10, d = e.slice(0, a).map(Mr).join(`
2922
+ `), l = e.length - a, u = l > 0 ? `${d}
2921
2923
  …and ${l} more` : d, p = [];
2922
2924
  e.length === 0 && (t.searchText ? (p.push("Try broader search terms"), p.push("Check spelling"), p.push("Remove searchText to see all labels")) : p.push("No personal labels created yet"));
2923
2925
  const m = o.length > 0 ? `
@@ -2928,7 +2930,7 @@ No shared labels.`;
2928
2930
  count: e.length,
2929
2931
  limit: t.searchText ? void 0 : t.limit,
2930
2932
  nextCursor: r ?? void 0,
2931
- filterHints: a,
2933
+ filterHints: i,
2932
2934
  previewLines: u,
2933
2935
  zeroReasonHints: p
2934
2936
  }) + m;
@@ -2956,11 +2958,11 @@ const { FIND_PROJECTS: Ro, ADD_TASKS: Dt, UPDATE_TASKS: xt } = f, Uo = {
2956
2958
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
2957
2959
  async execute(e, t) {
2958
2960
  const { projectId: r, searchTerm: o } = e;
2959
- let n = r, a;
2961
+ let n = r, i;
2960
2962
  try {
2961
- if (a = await t.getProject(r), !a)
2963
+ if (i = await t.getProject(r), !i)
2962
2964
  throw new Error(`Project with ID "${r}" not found or not accessible`);
2963
- if (n = a.name, !a.isShared)
2965
+ if (n = i.name, !i.isShared)
2964
2966
  return {
2965
2967
  textContent: `Project "${n}" is not shared and has no collaborators.
2966
2968
 
@@ -2983,8 +2985,8 @@ const { FIND_PROJECTS: Ro, ADD_TASKS: Dt, UPDATE_TASKS: xt } = f, Uo = {
2983
2985
  `Failed to access project "${r}": ${l instanceof Error ? l.message : "Unknown error"}`
2984
2986
  );
2985
2987
  }
2986
- const i = await B.getProjectCollaborators(t, r);
2987
- if (i.length === 0)
2988
+ const a = await B.getProjectCollaborators(t, r);
2989
+ if (a.length === 0)
2988
2990
  return {
2989
2991
  textContent: `Project "${n}" has no collaborators or collaborator data is not accessible.
2990
2992
 
@@ -3003,10 +3005,10 @@ const { FIND_PROJECTS: Ro, ADD_TASKS: Dt, UPDATE_TASKS: xt } = f, Uo = {
3003
3005
  appliedFilters: e
3004
3006
  }
3005
3007
  };
3006
- let c = i;
3008
+ let c = a;
3007
3009
  if (o) {
3008
3010
  const l = o.toLowerCase().trim();
3009
- c = i.filter(
3011
+ c = a.filter(
3010
3012
  (u) => u.name.toLowerCase().includes(l) || u.email.toLowerCase().includes(l)
3011
3013
  );
3012
3014
  }
@@ -3015,7 +3017,7 @@ const { FIND_PROJECTS: Ro, ADD_TASKS: Dt, UPDATE_TASKS: xt } = f, Uo = {
3015
3017
  collaborators: c,
3016
3018
  projectName: n,
3017
3019
  searchTerm: o,
3018
- totalAvailable: i.length
3020
+ totalAvailable: a.length
3019
3021
  }),
3020
3022
  structuredContent: {
3021
3023
  collaborators: c,
@@ -3025,7 +3027,7 @@ const { FIND_PROJECTS: Ro, ADD_TASKS: Dt, UPDATE_TASKS: xt } = f, Uo = {
3025
3027
  isShared: !0
3026
3028
  },
3027
3029
  totalCount: c.length,
3028
- totalAvailable: i.length,
3030
+ totalAvailable: a.length,
3029
3031
  appliedFilters: e
3030
3032
  }
3031
3033
  };
@@ -3037,21 +3039,21 @@ function Mo({
3037
3039
  searchTerm: r,
3038
3040
  totalAvailable: o
3039
3041
  }) {
3040
- const n = r ? `Project collaborators matching "${r}"` : "Project collaborators", a = [];
3041
- r && a.push(`matching "${r}"`), a.push(`in project "${t}"`);
3042
- let i = [];
3043
- e.length > 0 && (i = e.slice(0, 10).map((l) => {
3042
+ const n = r ? `Project collaborators matching "${r}"` : "Project collaborators", i = [];
3043
+ r && i.push(`matching "${r}"`), i.push(`in project "${t}"`);
3044
+ let a = [];
3045
+ e.length > 0 && (a = e.slice(0, 10).map((l) => {
3044
3046
  const u = l.name || "Unknown Name", p = l.email || "No email";
3045
3047
  return `• ${u} (${p}) - ID: ${l.id}`;
3046
- }), e.length > 10 && i.push(`... and ${e.length - 10} more`));
3048
+ }), e.length > 10 && a.push(`... and ${e.length - 10} more`));
3047
3049
  const c = [];
3048
3050
  e.length === 0 && (r ? (c.push(`No collaborators match "${r}"`), c.push("Try a broader search term or check spelling"), o > 0 && c.push(`${o} collaborators available without filter`)) : (c.push("Project has no collaborators"), c.push("Share the project to add collaborators")));
3049
3051
  const d = [];
3050
3052
  return e.length > 0 ? (d.push(`Use ${Dt} with responsibleUser to assign new tasks`), d.push(`Use ${xt} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${Ro} to find other projects`), r && o > 0 && d.push("Try searching without filters to see all collaborators")), F({
3051
3053
  subject: n,
3052
3054
  count: e.length,
3053
- filterHints: a,
3054
- previewLines: i.join(`
3055
+ filterHints: i,
3056
+ previewLines: a.join(`
3055
3057
  `),
3056
3058
  zeroReasonHints: c,
3057
3059
  nextSteps: d
@@ -3061,12 +3063,12 @@ const { ADD_PROJECTS: Fo } = f, Ho = {
3061
3063
  searchText: s.string().optional().describe(
3062
3064
  'Search for a project by name (partial and case insensitive match). Supports wildcards (e.g. "work*" for prefix match). Use "\\*" for a literal asterisk. If omitted, all projects are returned.'
3063
3065
  ),
3064
- limit: s.number().int().min(1).max(C.PROJECTS_MAX).default(C.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
3066
+ limit: s.number().int().min(1).max(D.PROJECTS_MAX).default(D.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
3065
3067
  cursor: s.string().optional().describe(
3066
3068
  "The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
3067
3069
  )
3068
3070
  }, Wo = {
3069
- projects: s.array(ae).describe("The found projects."),
3071
+ projects: s.array(ie).describe("The found projects."),
3070
3072
  nextCursor: s.string().optional().describe("Cursor for the next page of results."),
3071
3073
  totalCount: s.number().describe("The total number of projects in this page."),
3072
3074
  hasMore: s.boolean().describe("Whether there are more results available."),
@@ -3082,11 +3084,11 @@ const { ADD_PROJECTS: Fo } = f, Ho = {
3082
3084
  if (e.searchText)
3083
3085
  r = await kt(t, e.searchText), o = null;
3084
3086
  else {
3085
- const a = await t.getProjects({
3087
+ const i = await t.getProjects({
3086
3088
  limit: e.limit,
3087
3089
  cursor: e.cursor ?? null
3088
3090
  });
3089
- r = a.results, o = a.nextCursor;
3091
+ r = i.results, o = i.nextCursor;
3090
3092
  }
3091
3093
  const n = r.map(q);
3092
3094
  return {
@@ -3108,8 +3110,8 @@ function zo({
3108
3110
  }) {
3109
3111
  const o = t.searchText ? `All projects matching "${t.searchText}"` : "Projects", n = [];
3110
3112
  t.searchText && n.push(`searchText: "${t.searchText}"`);
3111
- const a = 10, c = e.slice(0, a).map(Fr).join(`
3112
- `), d = e.length - a, l = d > 0 ? `${c}
3113
+ const i = 10, c = e.slice(0, i).map(Fr).join(`
3114
+ `), d = e.length - i, l = d > 0 ? `${c}
3113
3115
  …and ${d} more` : c, u = [];
3114
3116
  return e.length === 0 && (t.searchText ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove searchText to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${Fo} to create a project`))), F({
3115
3117
  subject: o,
@@ -3139,17 +3141,17 @@ const Yo = {
3139
3141
  outputSchema: Go,
3140
3142
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
3141
3143
  async execute(e, t) {
3142
- const { taskId: r, reminderId: o, locationReminderId: n } = e, a = [r, o, n].filter(Boolean);
3143
- if (a.length === 0)
3144
+ const { taskId: r, reminderId: o, locationReminderId: n } = e, i = [r, o, n].filter(Boolean);
3145
+ if (i.length === 0)
3144
3146
  throw new Error("One of taskId, reminderId, or locationReminderId must be provided.");
3145
- if (a.length > 1)
3147
+ if (i.length > 1)
3146
3148
  throw new Error(
3147
3149
  "Only one of taskId, reminderId, or locationReminderId can be provided at a time."
3148
3150
  );
3149
3151
  if (o) {
3150
- const i = await t.getReminder(o), c = ce(i);
3152
+ const a = await t.getReminder(o), c = ce(a);
3151
3153
  return {
3152
- textContent: `Found ${i.type} reminder (id=${o})`,
3154
+ textContent: `Found ${a.type} reminder (id=${o})`,
3153
3155
  structuredContent: {
3154
3156
  reminders: [c],
3155
3157
  searchType: "reminder",
@@ -3159,7 +3161,7 @@ const Yo = {
3159
3161
  };
3160
3162
  }
3161
3163
  if (n) {
3162
- const i = await t.getLocationReminder(n), c = ce(i);
3164
+ const a = await t.getLocationReminder(n), c = ce(a);
3163
3165
  return {
3164
3166
  textContent: `Found location reminder (id=${n})`,
3165
3167
  structuredContent: {
@@ -3171,7 +3173,7 @@ const Yo = {
3171
3173
  };
3172
3174
  }
3173
3175
  if (r) {
3174
- const [i, c] = await Promise.all([
3176
+ const [a, c] = await Promise.all([
3175
3177
  oe({
3176
3178
  apiMethod: (p) => t.getReminders(p),
3177
3179
  args: { taskId: r }
@@ -3180,7 +3182,7 @@ const Yo = {
3180
3182
  apiMethod: (p) => t.getLocationReminders(p),
3181
3183
  args: { taskId: r }
3182
3184
  })
3183
- ]), l = [...i, ...c].map(ce);
3185
+ ]), l = [...a, ...c].map(ce);
3184
3186
  return {
3185
3187
  textContent: Ko(l, r),
3186
3188
  structuredContent: {
@@ -3199,12 +3201,12 @@ function Ko(e, t) {
3199
3201
  return `No reminders found for task ${t}`;
3200
3202
  const { timeBasedCount: r, locationCount: o } = Tt(e), n = [];
3201
3203
  if (r > 0) {
3202
- const a = r > 1 ? "time-based reminders" : "time-based reminder";
3203
- n.push(`${r} ${a}`);
3204
+ const i = r > 1 ? "time-based reminders" : "time-based reminder";
3205
+ n.push(`${r} ${i}`);
3204
3206
  }
3205
3207
  if (o > 0) {
3206
- const a = o > 1 ? "location reminders" : "location reminder";
3207
- n.push(`${o} ${a}`);
3208
+ const i = o > 1 ? "location reminders" : "location reminder";
3209
+ n.push(`${o} ${i}`);
3208
3210
  }
3209
3211
  return `Found ${n.join(" and ")} for task ${t}`;
3210
3212
  }
@@ -3234,7 +3236,7 @@ const { ADD_SECTIONS: Vo } = f, Jo = {
3234
3236
  e.searchText ? o = await Ws(t, e.searchText, r) : o = (await t.getSections({
3235
3237
  projectId: r
3236
3238
  })).results;
3237
- const n = o.map(({ id: i, name: c }) => ({ id: i, name: c }));
3239
+ const n = o.map(({ id: a, name: c }) => ({ id: a, name: c }));
3238
3240
  return {
3239
3241
  textContent: Qo({
3240
3242
  sections: n,
@@ -3256,12 +3258,12 @@ function Qo({
3256
3258
  }) {
3257
3259
  const o = [];
3258
3260
  r ? (o.push("Try broader search terms"), o.push("Check spelling"), o.push("Remove searchText to see all sections")) : (o.push("Project has no sections yet"), o.push(`Use ${Vo} to create sections`));
3259
- 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(`
3261
+ const n = r ? `Sections in project ${t} matching "${r}"` : `Sections in project ${t}`, i = e.length > 0 ? e.map((a) => ` ${a.name} • id=${a.id}`).join(`
3260
3262
  `) : void 0;
3261
3263
  return F({
3262
3264
  subject: n,
3263
3265
  count: e.length,
3264
- previewLines: a,
3266
+ previewLines: i,
3265
3267
  zeroReasonHints: o
3266
3268
  });
3267
3269
  }
@@ -3276,7 +3278,7 @@ const en = {
3276
3278
  daysCount: s.number().int().min(1).max(30).default(1).describe(
3277
3279
  "The number of days to get the tasks for, starting from the start date. Default is 1 which means only tasks for the start date."
3278
3280
  ),
3279
- limit: s.number().int().min(1).max(C.TASKS_MAX).default(C.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3281
+ limit: s.number().int().min(1).max(D.TASKS_MAX).default(D.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3280
3282
  cursor: s.string().optional().describe(
3281
3283
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3282
3284
  ),
@@ -3305,30 +3307,30 @@ const en = {
3305
3307
  "Either startDate must be provided or overdueOption must be set to overdue-only"
3306
3308
  );
3307
3309
  const r = await Le(t, e.responsibleUser), o = r?.userId, n = r?.email;
3308
- let a = "";
3310
+ let i = "";
3309
3311
  if (e.overdueOption === "overdue-only")
3310
- a = "overdue";
3312
+ i = "overdue";
3311
3313
  else if (e.startDate === "today")
3312
3314
  if (e.daysCount > 1) {
3313
- const p = /* @__PURE__ */ new Date(), m = te(p), h = xe(p, e.daysCount), g = Je(h, { representation: "date" }), I = `(due after: ${m} | due: ${m}) & due before: ${g}`;
3314
- a = e.overdueOption === "exclude-overdue" ? I : `(${I} | overdue)`;
3315
+ const p = /* @__PURE__ */ new Date(), m = te(p), h = xe(p, e.daysCount), I = Je(h, { representation: "date" }), T = `(due after: ${m} | due: ${m}) & due before: ${I}`;
3316
+ i = e.overdueOption === "exclude-overdue" ? T : `(${T} | overdue)`;
3315
3317
  } else
3316
- a = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3318
+ i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
3317
3319
  else if (e.startDate) {
3318
3320
  const p = e.startDate, m = xe(At(p), e.daysCount), h = Je(m, { representation: "date" });
3319
- a = `(due after: ${p} | due: ${p}) & due before: ${h}`;
3321
+ i = `(due after: ${p} | due: ${p}) & due before: ${h}`;
3320
3322
  }
3321
- const i = Ke(e.labels, e.labelsOperator);
3322
- i.length > 0 && (a = se(a, `(${i})`));
3323
+ const a = Ke(e.labels, e.labelsOperator);
3324
+ a.length > 0 && (i = se(i, `(${a})`));
3323
3325
  const c = yt({
3324
3326
  resolvedAssigneeId: o,
3325
3327
  assigneeEmail: n,
3326
3328
  responsibleUserFiltering: e.responsibleUserFiltering
3327
3329
  });
3328
- a = se(a, c);
3330
+ i = se(i, c);
3329
3331
  const { tasks: d, nextCursor: l } = await Fe({
3330
3332
  client: t,
3331
- query: a,
3333
+ query: i,
3332
3334
  cursor: e.cursor,
3333
3335
  limit: e.limit
3334
3336
  });
@@ -3370,28 +3372,28 @@ function rn({
3370
3372
  const c = o || t.responsibleUser;
3371
3373
  n.push(`assigned to: ${c}`);
3372
3374
  }
3373
- let a = "";
3374
- 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) {
3375
+ let i = "";
3376
+ 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) {
3375
3377
  const c = o || t.responsibleUser;
3376
- a += ` assigned to ${c}`;
3378
+ i += ` assigned to ${c}`;
3377
3379
  }
3378
- const i = [];
3380
+ const a = [];
3379
3381
  if (e.length === 0)
3380
3382
  if (t.overdueOption === "overdue-only")
3381
- i.push("Great job! No overdue tasks");
3383
+ a.push("Great job! No overdue tasks");
3382
3384
  else if (t.startDate === "today") {
3383
3385
  const c = t.overdueOption === "exclude-overdue" ? "" : " or overdue";
3384
- i.push(`Great job! No tasks for today${c}`);
3386
+ a.push(`Great job! No tasks for today${c}`);
3385
3387
  } else
3386
- i.push("Expand date range with larger 'daysCount'"), i.push("Check today's tasks with startDate='today'");
3388
+ a.push("Expand date range with larger 'daysCount'"), a.push("Check today's tasks with startDate='today'");
3387
3389
  return F({
3388
- subject: a,
3390
+ subject: i,
3389
3391
  count: e.length,
3390
3392
  limit: t.limit,
3391
3393
  nextCursor: r ?? void 0,
3392
3394
  filterHints: n,
3393
3395
  previewLines: Te(e, Math.min(e.length, t.limit)),
3394
- zeroReasonHints: i
3396
+ zeroReasonHints: a
3395
3397
  });
3396
3398
  }
3397
3399
  const on = 300 * 1e3;
@@ -3422,17 +3424,17 @@ class nn {
3422
3424
  const o = r.trim();
3423
3425
  if (!o)
3424
3426
  throw new Error("Filter reference cannot be empty");
3425
- const n = await this.getFilters(t), a = n.find((u) => u.id === o);
3426
- if (a)
3427
- return { filterId: a.id, filterName: a.name, filterQuery: a.query };
3428
- const i = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === i);
3427
+ const n = await this.getFilters(t), i = n.find((u) => u.id === o);
3428
+ if (i)
3429
+ return { filterId: i.id, filterName: i.name, filterQuery: i.query };
3430
+ const a = o.toLowerCase(), c = n.find((u) => u.name.toLowerCase() === a);
3429
3431
  if (c)
3430
3432
  return {
3431
3433
  filterId: c.id,
3432
3434
  filterName: c.name,
3433
3435
  filterQuery: c.query
3434
3436
  };
3435
- const d = n.filter((u) => u.name.toLowerCase().includes(i)), l = d.length === 1 ? d[0] : void 0;
3437
+ const d = n.filter((u) => u.name.toLowerCase().includes(a)), l = d.length === 1 ? d[0] : void 0;
3436
3438
  if (l)
3437
3439
  return {
3438
3440
  filterId: l.id,
@@ -3468,7 +3470,7 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3468
3470
  responsibleUserFiltering: s.enum(gt).optional().describe(
3469
3471
  'How to filter by responsible user when responsibleUser is not provided. "assigned" = only tasks assigned to others; "unassignedOrMe" = only unassigned tasks or tasks assigned to me; "all" = all tasks regardless of assignment. Default value will be `unassignedOrMe`.'
3470
3472
  ),
3471
- limit: s.number().int().min(1).max(C.TASKS_MAX).default(C.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3473
+ limit: s.number().int().min(1).max(D.TASKS_MAX).default(D.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
3472
3474
  cursor: s.string().optional().describe(
3473
3475
  "The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
3474
3476
  ),
@@ -3496,8 +3498,8 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3496
3498
  searchText: r,
3497
3499
  projectId: o,
3498
3500
  sectionId: n,
3499
- parentId: a,
3500
- responsibleUser: i,
3501
+ parentId: i,
3502
+ responsibleUser: a,
3501
3503
  responsibleUserFiltering: c,
3502
3504
  limit: d,
3503
3505
  cursor: l,
@@ -3505,8 +3507,8 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3505
3507
  labelsOperator: p,
3506
3508
  filter: m,
3507
3509
  filterIdOrName: h
3508
- } = e, g = await t.getUser(), I = u && u.length > 0;
3509
- if (!r && !o && !n && !a && !i && !I && !m && !h)
3510
+ } = e, I = await t.getUser(), T = u && u.length > 0;
3511
+ if (!r && !o && !n && !i && !a && !T && !m && !h)
3510
3512
  throw new Error(
3511
3513
  "At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, labels, filter, or filterIdOrName"
3512
3514
  );
@@ -3514,27 +3516,27 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3514
3516
  throw new Error(
3515
3517
  "The `filter` and `filterIdOrName` parameters cannot be used together. Provide only one."
3516
3518
  );
3517
- if ((m || h) && (o || n || a))
3519
+ if ((m || h) && (o || n || i))
3518
3520
  throw new Error(
3519
3521
  'The `filter`/`filterIdOrName` parameter cannot be combined with projectId, sectionId, or parentId. Use filter syntax instead (e.g. "##ProjectName").'
3520
3522
  );
3521
- let D = m;
3522
- h && (D = (await an.resolveFilter(t, h)).filterQuery);
3523
- const $ = await Le(t, i), N = $?.userId, T = $?.email;
3524
- if (o || n || a) {
3523
+ let j = m;
3524
+ h && (j = (await an.resolveFilter(t, h)).filterQuery);
3525
+ const $ = await Le(t, a), A = $?.userId, k = $?.email;
3526
+ if (o || n || i) {
3525
3527
  const x = {
3526
3528
  limit: d,
3527
3529
  cursor: l ?? null
3528
3530
  };
3529
- o && (x.projectId = await G({ projectId: o, user: g })), n && (x.sectionId = n), a && (x.parentId = a);
3530
- const { results: L, nextCursor: H } = await t.getTasks(x), we = L.map(_);
3531
+ o && (x.projectId = await G({ projectId: o, user: I })), n && (x.sectionId = n), i && (x.parentId = i);
3532
+ const { results: L, nextCursor: H } = await t.getTasks(x), we = L.map(R);
3531
3533
  let M = r ? we.filter(
3532
3534
  (V) => V.content.toLowerCase().includes(r.toLowerCase()) || V.description?.toLowerCase().includes(r.toLowerCase())
3533
3535
  ) : we;
3534
3536
  return M = Ms({
3535
3537
  tasks: M,
3536
- resolvedAssigneeId: N,
3537
- currentUserId: g.id,
3538
+ resolvedAssigneeId: A,
3539
+ currentUserId: I.id,
3538
3540
  responsibleUserFiltering: c
3539
3541
  }), u && u.length > 0 && (M = p === "and" ? M.filter(
3540
3542
  (V) => u.every((Ie) => V.labels.includes(Ie))
@@ -3546,7 +3548,7 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3546
3548
  args: e,
3547
3549
  nextCursor: H,
3548
3550
  isContainerSearch: !0,
3549
- assigneeEmail: T
3551
+ assigneeEmail: k
3550
3552
  }),
3551
3553
  structuredContent: {
3552
3554
  tasks: M,
@@ -3557,20 +3559,20 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3557
3559
  }
3558
3560
  };
3559
3561
  }
3560
- if (N && !r && !I && !D) {
3562
+ if (A && !r && !T && !j) {
3561
3563
  const { results: x, nextCursor: L } = await t.getTasksByFilter({
3562
- query: `assigned to: ${T}`,
3564
+ query: `assigned to: ${k}`,
3563
3565
  lang: "en",
3564
3566
  limit: d,
3565
3567
  cursor: l ?? null
3566
- }), H = x.map(_);
3568
+ }), H = x.map(R);
3567
3569
  return {
3568
3570
  textContent: Ce({
3569
3571
  tasks: H,
3570
3572
  args: e,
3571
3573
  nextCursor: L,
3572
3574
  isContainerSearch: !1,
3573
- assigneeEmail: T
3575
+ assigneeEmail: k
3574
3576
  }),
3575
3577
  structuredContent: {
3576
3578
  tasks: H,
@@ -3581,18 +3583,18 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3581
3583
  }
3582
3584
  };
3583
3585
  }
3584
- let b = D ? `(${D})` : "";
3586
+ let b = j ? `(${j})` : "";
3585
3587
  r && (b = se(b, `search: ${r}`));
3586
- const S = Ke(u, p);
3587
- if (b = se(b, S), !(h && !i && !c)) {
3588
+ const C = Ke(u, p);
3589
+ if (b = se(b, C), !(h && !a && !c)) {
3588
3590
  const x = yt({
3589
- resolvedAssigneeId: N,
3590
- assigneeEmail: T,
3591
+ resolvedAssigneeId: A,
3592
+ assigneeEmail: k,
3591
3593
  responsibleUserFiltering: c
3592
3594
  });
3593
3595
  b = se(b, x);
3594
3596
  }
3595
- const { tasks: w, nextCursor: j } = await Fe({
3597
+ const { tasks: w, nextCursor: S } = await Fe({
3596
3598
  client: t,
3597
3599
  query: b,
3598
3600
  cursor: e.cursor,
@@ -3602,15 +3604,15 @@ const an = new nn(), { FIND_COMPLETED_TASKS: rt, ADD_TASKS: ot } = f, cn = {
3602
3604
  textContent: Ce({
3603
3605
  tasks: w,
3604
3606
  args: e,
3605
- nextCursor: j,
3607
+ nextCursor: S,
3606
3608
  isContainerSearch: !1,
3607
- assigneeEmail: T
3609
+ assigneeEmail: k
3608
3610
  }),
3609
3611
  structuredContent: {
3610
3612
  tasks: w,
3611
- nextCursor: j ?? void 0,
3613
+ nextCursor: S ?? void 0,
3612
3614
  totalCount: w.length,
3613
- hasMore: !!j,
3615
+ hasMore: !!S,
3614
3616
  appliedFilters: e
3615
3617
  }
3616
3618
  };
@@ -3640,16 +3642,16 @@ function Ce({
3640
3642
  isContainerSearch: o,
3641
3643
  assigneeEmail: n
3642
3644
  }) {
3643
- let a = "Tasks";
3644
- const i = [], c = [];
3645
+ let i = "Tasks";
3646
+ const a = [], c = [];
3645
3647
  if (o) {
3646
- 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) {
3648
+ 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) {
3647
3649
  const d = n || t.responsibleUser;
3648
- a += ` assigned to ${d}`, i.push(`assigned to ${d}`);
3650
+ i += ` assigned to ${d}`, a.push(`assigned to ${d}`);
3649
3651
  }
3650
3652
  if (t.labels && t.labels.length > 0) {
3651
3653
  const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
3652
- i.push(`labels: ${d}`);
3654
+ a.push(`labels: ${d}`);
3653
3655
  }
3654
3656
  e.length === 0 && c.push(...un(t));
3655
3657
  } else {
@@ -3658,9 +3660,9 @@ function Ce({
3658
3660
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
3659
3661
  l.push(`with labels: ${u}`);
3660
3662
  }
3661
- 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) {
3663
+ 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) {
3662
3664
  const u = t.labels.map((p) => `@${p}`).join(t.labelsOperator === "and" ? " & " : " | ");
3663
- i.push(`labels: ${u}`);
3665
+ a.push(`labels: ${u}`);
3664
3666
  }
3665
3667
  if (e.length === 0) {
3666
3668
  if (t.responsibleUser) {
@@ -3671,11 +3673,11 @@ function Ce({
3671
3673
  }
3672
3674
  }
3673
3675
  return F({
3674
- subject: a,
3676
+ subject: i,
3675
3677
  count: e.length,
3676
3678
  limit: t.limit,
3677
3679
  nextCursor: r ?? void 0,
3678
- filterHints: i,
3680
+ filterHints: a,
3679
3681
  previewLines: Te(e, Math.min(e.length, t.limit)),
3680
3682
  zeroReasonHints: c
3681
3683
  });
@@ -3753,18 +3755,18 @@ function hn(e) {
3753
3755
  };
3754
3756
  const r = [];
3755
3757
  for (const n of e) {
3756
- const a = t[n.id];
3757
- if (a)
3758
+ const i = t[n.id];
3759
+ if (i)
3758
3760
  if (re(n) && n.parentId) {
3759
- const i = t[n.parentId];
3760
- i ? i.children.push(a) : r.push(a);
3761
+ const a = t[n.parentId];
3762
+ a ? a.children.push(i) : r.push(i);
3761
3763
  } else
3762
- r.push(a);
3764
+ r.push(i);
3763
3765
  }
3764
3766
  function o(n) {
3765
- n.sort((a, i) => a.childOrder - i.childOrder);
3766
- for (const a of n)
3767
- o(a.children);
3767
+ n.sort((i, a) => i.childOrder - a.childOrder);
3768
+ for (const i of n)
3769
+ o(i.children);
3768
3770
  }
3769
3771
  return o(r), r;
3770
3772
  }
@@ -3781,10 +3783,10 @@ function Ot(e, t, r = "") {
3781
3783
  const o = [];
3782
3784
  o.push(`${r}- Project: ${e.name} (id=${e.id})`);
3783
3785
  const n = t[e.id] || [];
3784
- for (const a of n)
3785
- o.push(`${r} - Section: ${a.name} (id=${a.id})`);
3786
- for (const a of e.children)
3787
- o.push(...Ot(a, t, `${r} `));
3786
+ for (const i of n)
3787
+ o.push(`${r} - Section: ${i.name} (id=${i.id})`);
3788
+ for (const i of e.children)
3789
+ o.push(...Ot(i, t, `${r} `));
3788
3790
  return o;
3789
3791
  }
3790
3792
  function nt(e) {
@@ -3799,16 +3801,16 @@ function nt(e) {
3799
3801
  r.push(n);
3800
3802
  continue;
3801
3803
  }
3802
- const a = t[o.parentId];
3803
- a ? a.children.push(n) : r.push(n);
3804
+ const i = t[o.parentId];
3805
+ i ? i.children.push(n) : r.push(n);
3804
3806
  }
3805
3807
  return r;
3806
3808
  }
3807
3809
  function _e(e, t = "") {
3808
3810
  const r = [];
3809
3811
  for (const o of e) {
3810
- const n = `id=${o.id}`, a = o.dueDate ? `; due=${o.dueDate}` : "", i = `; content=${o.content}`;
3811
- r.push(`${t}- ${n}${a}${i}`), o.children.length > 0 && r.push(..._e(o.children, `${t} `));
3812
+ const n = `id=${o.id}`, i = o.dueDate ? `; due=${o.dueDate}` : "", a = `; content=${o.content}`;
3813
+ r.push(`${t}- ${n}${i}${a}`), o.children.length > 0 && r.push(..._e(o.children, `${t} `));
3812
3814
  }
3813
3815
  return r;
3814
3816
  }
@@ -3828,12 +3830,12 @@ function Pt(e, t) {
3828
3830
  async function bn(e, t) {
3829
3831
  let r = [], o;
3830
3832
  do {
3831
- const { results: n, nextCursor: a } = await e.getTasks({
3833
+ const { results: n, nextCursor: i } = await e.getTasks({
3832
3834
  projectId: t,
3833
- limit: C.TASKS_BATCH_SIZE,
3835
+ limit: D.TASKS_BATCH_SIZE,
3834
3836
  cursor: o ?? void 0
3835
3837
  });
3836
- r = r.concat(n.map(_)), o = a ?? void 0;
3838
+ r = r.concat(n.map(R)), o = i ?? void 0;
3837
3839
  } while (o);
3838
3840
  return r;
3839
3841
  }
@@ -3842,15 +3844,15 @@ async function gn(e, t) {
3842
3844
  return r;
3843
3845
  }
3844
3846
  async function yn(e) {
3845
- const { results: t } = await e.getProjects({}), r = t.find((p) => re(p) && p.inboxProject === !0), o = t.filter((p) => !re(p) || p.inboxProject !== !0), n = hn(o), a = t.map((p) => p.id), i = await fn(e, a), c = ["# Personal Projects", ""];
3847
+ const { results: t } = await e.getProjects({}), r = t.find((p) => re(p) && p.inboxProject === !0), o = t.filter((p) => !re(p) || p.inboxProject !== !0), n = hn(o), i = t.map((p) => p.id), a = await fn(e, i), c = ["# Personal Projects", ""];
3846
3848
  if (r) {
3847
3849
  c.push(`- Inbox Project: ${r.name} (id=${r.id})`);
3848
- for (const p of i[r.id] || [])
3850
+ for (const p of a[r.id] || [])
3849
3851
  c.push(` - Section: ${p.name} (id=${p.id})`);
3850
3852
  }
3851
3853
  if (n.length)
3852
3854
  for (const p of n)
3853
- c.push(...Ot(p, i));
3855
+ c.push(...Ot(p, a));
3854
3856
  else
3855
3857
  c.push("_No projects found._");
3856
3858
  c.push("");
@@ -3865,14 +3867,14 @@ async function yn(e) {
3865
3867
  inbox: r ? {
3866
3868
  id: r.id,
3867
3869
  name: r.name,
3868
- sections: i[r.id] || []
3870
+ sections: a[r.id] || []
3869
3871
  } : null,
3870
3872
  projects: n.map(
3871
- (p) => Pt(p, i)
3873
+ (p) => Pt(p, a)
3872
3874
  ),
3873
3875
  totalProjects: t.length,
3874
- totalSections: a.reduce(
3875
- (p, m) => p + (i[m]?.length || 0),
3876
+ totalSections: i.reduce(
3877
+ (p, m) => p + (a[m]?.length || 0),
3876
3878
  0
3877
3879
  ),
3878
3880
  hasNestedProjects: d
@@ -3884,21 +3886,21 @@ async function kn(e, t) {
3884
3886
  e.getProject(t),
3885
3887
  gn(e, t),
3886
3888
  bn(e, t)
3887
- ]), a = {};
3889
+ ]), i = {};
3888
3890
  for (const u of o)
3889
- a[u.id] = [];
3890
- const i = [];
3891
+ i[u.id] = [];
3892
+ const a = [];
3891
3893
  for (const u of n)
3892
- (u.sectionId ? a[u.sectionId] ?? i : i).push(u);
3894
+ (u.sectionId ? i[u.sectionId] ?? a : a).push(u);
3893
3895
  const c = [`# ${r.name}`];
3894
- if (i.length > 0) {
3896
+ if (a.length > 0) {
3895
3897
  c.push("");
3896
- const u = nt(i);
3898
+ const u = nt(a);
3897
3899
  c.push(..._e(u));
3898
3900
  }
3899
3901
  for (const u of o) {
3900
3902
  c.push(""), c.push(`## ${u.name}`);
3901
- const p = a[u.id];
3903
+ const p = i[u.id];
3902
3904
  if (!p?.length)
3903
3905
  continue;
3904
3906
  const m = nt(p);
@@ -3920,7 +3922,7 @@ async function kn(e, t) {
3920
3922
  stats: {
3921
3923
  totalTasks: n.length,
3922
3924
  totalSections: o.length,
3923
- tasksWithoutSection: i.length
3925
+ tasksWithoutSection: a.length
3924
3926
  }
3925
3927
  };
3926
3928
  return { textContent: d, structuredContent: l };
@@ -3942,7 +3944,7 @@ const Tn = {
3942
3944
  count: s.number().describe("Number of consecutive periods in this streak."),
3943
3945
  start: s.string().describe("Start date of the streak."),
3944
3946
  end: s.string().describe("End date of the streak.")
3945
- }), at = s.object({
3947
+ }), it = s.object({
3946
3948
  id: s.string().describe("Project ID."),
3947
3949
  completed: s.number().describe("Number of tasks completed in this project.")
3948
3950
  }), In = {
@@ -3951,7 +3953,7 @@ const Tn = {
3951
3953
  s.object({
3952
3954
  date: s.string().describe("Date string (YYYY-MM-DD)."),
3953
3955
  totalCompleted: s.number().describe("Total tasks completed on this day."),
3954
- items: s.array(at).describe("Per-project completion breakdown for this day.")
3956
+ items: s.array(it).describe("Per-project completion breakdown for this day.")
3955
3957
  })
3956
3958
  ).describe("Daily completion breakdown (most recent days)."),
3957
3959
  weekItems: s.array(
@@ -3959,7 +3961,7 @@ const Tn = {
3959
3961
  from: s.string().describe("Start date of the week."),
3960
3962
  to: s.string().describe("End date of the week."),
3961
3963
  totalCompleted: s.number().describe("Total tasks completed in this week."),
3962
- items: s.array(at).describe("Per-project completion breakdown for this week.")
3964
+ items: s.array(it).describe("Per-project completion breakdown for this week.")
3963
3965
  })
3964
3966
  ).describe("Weekly completion breakdown (most recent weeks)."),
3965
3967
  goals: s.object({
@@ -4111,16 +4113,16 @@ const Dn = {
4111
4113
  idempotentHint: !0
4112
4114
  },
4113
4115
  async execute(e, t) {
4114
- const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, a = await t.getProjectActivityStats(r, {
4116
+ const { projectId: r, weeks: o, includeWeeklyCounts: n } = e, i = await t.getProjectActivityStats(r, {
4115
4117
  weeks: o,
4116
4118
  includeWeeklyCounts: n
4117
4119
  });
4118
4120
  return {
4119
- textContent: $n(r, a),
4121
+ textContent: $n(r, i),
4120
4122
  structuredContent: {
4121
4123
  projectId: r,
4122
- dayItems: a.dayItems,
4123
- weekItems: a.weekItems ?? null
4124
+ dayItems: i.dayItems,
4125
+ weekItems: i.weekItems ?? null
4124
4126
  }
4125
4127
  };
4126
4128
  }
@@ -4174,12 +4176,12 @@ const Dn = {
4174
4176
  };
4175
4177
  async function Pn(e, t, r) {
4176
4178
  if (r) {
4177
- const [a, i, c] = await Promise.all([
4179
+ const [i, a, c] = await Promise.all([
4178
4180
  e.getProjectProgress(t),
4179
4181
  e.getProjectHealth(t),
4180
4182
  e.getProjectHealthContext(t)
4181
4183
  ]);
4182
- return { progress: a, health: i, context: c };
4184
+ return { progress: i, health: a, context: c };
4183
4185
  }
4184
4186
  const [o, n] = await Promise.all([
4185
4187
  e.getProjectProgress(t),
@@ -4193,17 +4195,17 @@ function _n(e, { progress: t, health: r, context: o }) {
4193
4195
  `**Completed:** ${t.completedCount} | **Active:** ${t.activeCount} | **Progress:** ${t.progressPercent}%`
4194
4196
  ), r.description && (n.push(""), n.push("## Health Description"), n.push(r.description)), r.taskRecommendations && r.taskRecommendations.length > 0) {
4195
4197
  n.push(""), n.push("## Task Recommendations");
4196
- for (const a of r.taskRecommendations)
4197
- n.push(`- **Task ${a.taskId}**: ${a.recommendation}`);
4198
+ for (const i of r.taskRecommendations)
4199
+ n.push(`- **Task ${i.taskId}**: ${i.recommendation}`);
4198
4200
  }
4199
4201
  if (o) {
4200
4202
  n.push(""), n.push("## Project Metrics");
4201
- const a = o.projectMetrics;
4202
- if (n.push(`- **Total Tasks:** ${a.totalTasks}`), n.push(`- **Completed:** ${a.completedTasks}`), n.push(`- **Overdue:** ${a.overdueTasks}`), n.push(`- **Created This Week:** ${a.tasksCreatedThisWeek}`), n.push(`- **Completed This Week:** ${a.tasksCompletedThisWeek}`), a.averageCompletionTime !== null && n.push(`- **Avg Completion Time:** ${a.averageCompletionTime} days`), o.tasks.length > 0) {
4203
+ const i = o.projectMetrics;
4204
+ 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) {
4203
4205
  n.push(""), n.push(`## Tasks (${o.tasks.length})`);
4204
- for (const i of o.tasks) {
4205
- const c = [`id=${i.id}`, i.content];
4206
- i.due && c.push(`due=${i.due}`), i.deadline && c.push(`deadline=${i.deadline}`), i.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4206
+ for (const a of o.tasks) {
4207
+ const c = [`id=${a.id}`, a.content];
4208
+ a.due && c.push(`due=${a.due}`), a.deadline && c.push(`deadline=${a.deadline}`), a.isCompleted && c.push("(completed)"), n.push(`- ${c.join("; ")}`);
4207
4209
  }
4208
4210
  }
4209
4211
  }
@@ -4221,7 +4223,7 @@ const Rn = {
4221
4223
  idempotentHint: !0
4222
4224
  },
4223
4225
  async execute(e, t) {
4224
- const { projectId: r, includeContext: o } = e, n = await Pn(t, r, o), a = n.context?.projectName ?? `Project ${r}`, i = _n(a, n), c = n.context ? {
4226
+ const { projectId: r, includeContext: o } = e, n = await Pn(t, r, o), i = n.context?.projectName ?? `Project ${r}`, a = _n(i, n), c = n.context ? {
4225
4227
  projectDescription: n.context.projectDescription,
4226
4228
  projectMetrics: n.context.projectMetrics,
4227
4229
  tasks: n.context.tasks.map((d) => ({
@@ -4235,10 +4237,10 @@ const Rn = {
4235
4237
  }))
4236
4238
  } : void 0;
4237
4239
  return {
4238
- textContent: i,
4240
+ textContent: a,
4239
4241
  structuredContent: {
4240
4242
  projectId: r,
4241
- projectName: a,
4243
+ projectName: i,
4242
4244
  progress: {
4243
4245
  completedCount: n.progress.completedCount,
4244
4246
  activeCount: n.progress.activeCount,
@@ -4290,7 +4292,7 @@ const Rn = {
4290
4292
  idempotentHint: !0
4291
4293
  },
4292
4294
  async execute(e, t) {
4293
- const { workspaceIdOrName: r, projectIds: o } = e, n = await wt.resolveWorkspace(t, r), a = await t.getWorkspaceInsights(n.workspaceId, { projectIds: o }), i = a.projectInsights.map((d) => ({
4295
+ const { workspaceIdOrName: r, projectIds: o } = e, n = await wt.resolveWorkspace(t, r), i = await t.getWorkspaceInsights(n.workspaceId, { projectIds: o }), a = i.projectInsights.map((d) => ({
4294
4296
  projectId: d.projectId,
4295
4297
  health: d.health ? {
4296
4298
  status: d.health.status,
@@ -4305,10 +4307,10 @@ const Rn = {
4305
4307
  })), c = [
4306
4308
  `# Workspace Insights: ${n.workspaceName}`,
4307
4309
  "",
4308
- `**Projects:** ${i.length}`,
4310
+ `**Projects:** ${a.length}`,
4309
4311
  ""
4310
4312
  ];
4311
- for (const d of i) {
4313
+ for (const d of a) {
4312
4314
  const l = d.health?.status ?? "N/A", u = d.progress ? `${d.progress.progressPercent}%` : "N/A";
4313
4315
  c.push(`- Project ${d.projectId}: status=${l}, progress=${u}`);
4314
4316
  }
@@ -4318,8 +4320,8 @@ const Rn = {
4318
4320
  structuredContent: {
4319
4321
  workspaceId: n.workspaceId,
4320
4322
  workspaceName: n.workspaceName,
4321
- folderId: a.folderId,
4322
- projectInsights: i
4323
+ folderId: i.folderId,
4324
+ projectInsights: a
4323
4325
  }
4324
4326
  };
4325
4327
  }
@@ -4338,15 +4340,15 @@ const Rn = {
4338
4340
  count: s.number().describe("The total number of workspaces.")
4339
4341
  };
4340
4342
  async function Bn(e) {
4341
- const r = (await e.getWorkspaces()).map((i) => ({
4342
- id: i.id,
4343
- name: i.name,
4344
- plan: i.plan,
4345
- role: i.role,
4346
- isLinkSharingEnabled: i.isLinkSharingEnabled,
4347
- isGuestAllowed: i.isGuestAllowed,
4348
- createdAt: i.createdAt,
4349
- creatorId: i.creatorId
4343
+ const r = (await e.getWorkspaces()).map((a) => ({
4344
+ id: a.id,
4345
+ name: a.name,
4346
+ plan: a.plan,
4347
+ role: a.role,
4348
+ isLinkSharingEnabled: a.isLinkSharingEnabled,
4349
+ isGuestAllowed: a.isGuestAllowed,
4350
+ createdAt: a.createdAt,
4351
+ creatorId: a.creatorId
4350
4352
  })), o = ["# Workspaces", ""];
4351
4353
  if (r.length === 0)
4352
4354
  o.push("No workspaces found.");
@@ -4355,18 +4357,18 @@ async function Bn(e) {
4355
4357
  `Found ${r.length} workspace${r.length === 1 ? "" : "s"}:`,
4356
4358
  ""
4357
4359
  );
4358
- for (const i of r)
4359
- o.push(`## ${i.name}`), o.push(`- **ID:** ${i.id}`), o.push(`- **Plan:** ${i.plan}`), i.role && o.push(`- **Your Role:** ${i.role}`), o.push(
4360
- `- **Link Sharing:** ${i.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
4361
- ), o.push(`- **Guests Allowed:** ${i.isGuestAllowed ? "Yes" : "No"}`), i.createdAt && o.push(`- **Created:** ${i.createdAt}`), o.push(`- **Creator ID:** ${i.creatorId}`), o.push("");
4360
+ for (const a of r)
4361
+ o.push(`## ${a.name}`), o.push(`- **ID:** ${a.id}`), o.push(`- **Plan:** ${a.plan}`), a.role && o.push(`- **Your Role:** ${a.role}`), o.push(
4362
+ `- **Link Sharing:** ${a.isLinkSharingEnabled ? "Enabled" : "Disabled"}`
4363
+ ), o.push(`- **Guests Allowed:** ${a.isGuestAllowed ? "Yes" : "No"}`), a.createdAt && o.push(`- **Created:** ${a.createdAt}`), o.push(`- **Creator ID:** ${a.creatorId}`), o.push("");
4362
4364
  }
4363
4365
  const n = o.join(`
4364
- `), a = {
4366
+ `), i = {
4365
4367
  type: "workspaces",
4366
4368
  workspaces: r,
4367
4369
  count: r.length
4368
4370
  };
4369
- return { textContent: n, structuredContent: a };
4371
+ return { textContent: n, structuredContent: i };
4370
4372
  }
4371
4373
  const zn = {
4372
4374
  name: f.LIST_WORKSPACES,
@@ -4381,7 +4383,7 @@ const zn = {
4381
4383
  structuredContent: r.structuredContent
4382
4384
  };
4383
4385
  }
4384
- }, { FIND_TASKS: Yn, FIND_PROJECT_COLLABORATORS: it, UPDATE_TASKS: Gn } = f, qn = 50, Kn = {
4386
+ }, { FIND_TASKS: Yn, FIND_PROJECT_COLLABORATORS: at, UPDATE_TASKS: Gn } = f, qn = 50, Kn = {
4385
4387
  operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
4386
4388
  taskIds: s.array(s.string()).min(1).max(qn).describe("The IDs of the tasks to operate on (max 50)."),
4387
4389
  responsibleUser: s.string().optional().describe(
@@ -4414,46 +4416,46 @@ const zn = {
4414
4416
  outputSchema: Vn,
4415
4417
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4416
4418
  async execute(e, t) {
4417
- const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: a, dryRun: i } = e;
4419
+ const { operation: r, taskIds: o, responsibleUser: n, fromAssigneeUser: i, dryRun: a } = e;
4418
4420
  if ((r === "assign" || r === "reassign") && !n)
4419
4421
  throw new Error(`${r} operation requires responsibleUser parameter`);
4420
4422
  const c = await Promise.allSettled(
4421
- o.map(async (T) => {
4423
+ o.map(async (k) => {
4422
4424
  try {
4423
- return await t.getTask(T);
4425
+ return await t.getTask(k);
4424
4426
  } catch {
4425
- throw new Error(`Task ${T} not found or not accessible`);
4427
+ throw new Error(`Task ${k} not found or not accessible`);
4426
4428
  }
4427
4429
  })
4428
4430
  ), d = [], l = [];
4429
- for (let T = 0; T < c.length; T++) {
4430
- const b = c[T];
4431
+ for (let k = 0; k < c.length; k++) {
4432
+ const b = c[k];
4431
4433
  b && b.status === "fulfilled" ? d.push(b.value) : b && b.status === "rejected" ? l.push({
4432
- taskId: o[T] || "invalid-task-id",
4434
+ taskId: o[k] || "invalid-task-id",
4433
4435
  success: !1,
4434
4436
  error: b.reason?.message || "Task not accessible"
4435
4437
  }) : l.push({
4436
- taskId: o[T] || "invalid-task-id",
4438
+ taskId: o[k] || "invalid-task-id",
4437
4439
  success: !1,
4438
4440
  error: "Task not accessible"
4439
4441
  });
4440
4442
  }
4441
4443
  if (d.length === 0) {
4442
- const T = l.map((b) => `"${b.taskId}": ${b.error}`).join("; ");
4443
- throw new Error(`All ${l.length} task(s) failed: ${T}`);
4444
+ const k = l.map((b) => `"${b.taskId}": ${b.error}`).join("; ");
4445
+ throw new Error(`All ${l.length} task(s) failed: ${k}`);
4444
4446
  }
4445
4447
  let u;
4446
- r === "reassign" && a && (u = (await B.resolveUser(t, a))?.userId || a);
4448
+ r === "reassign" && i && (u = (await B.resolveUser(t, i))?.userId || i);
4447
4449
  const p = [];
4448
- for (const T of d)
4449
- r === "reassign" && u && T.responsibleUid !== u || p.push({
4450
- taskId: T.id,
4451
- projectId: T.projectId,
4450
+ for (const k of d)
4451
+ r === "reassign" && u && k.responsibleUid !== u || p.push({
4452
+ taskId: k.id,
4453
+ projectId: k.projectId,
4452
4454
  responsibleUid: n || ""
4453
4455
  // Will be validated appropriately
4454
4456
  });
4455
4457
  if (r === "unassign") {
4456
- if (i) {
4458
+ if (a) {
4457
4459
  const w = d.map((v) => ({
4458
4460
  taskId: v.id,
4459
4461
  success: !0,
@@ -4476,7 +4478,7 @@ const zn = {
4476
4478
  }
4477
4479
  };
4478
4480
  }
4479
- const T = d.map(async (w) => {
4481
+ const k = d.map(async (w) => {
4480
4482
  try {
4481
4483
  return await t.updateTask(w.id, { assigneeId: null }), {
4482
4484
  taskId: w.id,
@@ -4484,31 +4486,31 @@ const zn = {
4484
4486
  originalAssigneeId: w.responsibleUid ?? void 0,
4485
4487
  newAssigneeId: void 0
4486
4488
  };
4487
- } catch (j) {
4489
+ } catch (S) {
4488
4490
  return {
4489
4491
  taskId: w.id,
4490
4492
  success: !1,
4491
- error: j instanceof Error ? j.message : "Update failed",
4493
+ error: S instanceof Error ? S.message : "Update failed",
4492
4494
  originalAssigneeId: w.responsibleUid ?? void 0
4493
4495
  };
4494
4496
  }
4495
- }), b = await Promise.all(T), S = [...b, ...l];
4496
- if (S.length > 0 && S.every((w) => !w.success)) {
4497
- const w = S.map((j) => `"${j.taskId}": ${j.error}`).join("; ");
4498
- throw new Error(`All ${S.length} unassign operation(s) failed: ${w}`);
4497
+ }), b = await Promise.all(k), C = [...b, ...l];
4498
+ if (C.length > 0 && C.every((w) => !w.success)) {
4499
+ const w = C.map((S) => `"${S.taskId}": ${S.error}`).join("; ");
4500
+ throw new Error(`All ${C.length} unassign operation(s) failed: ${w}`);
4499
4501
  }
4500
4502
  return {
4501
4503
  textContent: $e({
4502
4504
  operation: r,
4503
- results: S,
4505
+ results: C,
4504
4506
  dryRun: !1
4505
4507
  }),
4506
4508
  structuredContent: {
4507
4509
  operation: r,
4508
- results: S,
4510
+ results: C,
4509
4511
  totalRequested: o.length,
4510
4512
  successful: b.filter((w) => w.success).length,
4511
- failed: S.filter((w) => !w.success).length,
4513
+ failed: C.filter((w) => !w.success).length,
4512
4514
  dryRun: !1
4513
4515
  }
4514
4516
  };
@@ -4516,23 +4518,23 @@ const zn = {
4516
4518
  const m = await ze.validateBulkAssignment(
4517
4519
  t,
4518
4520
  p
4519
- ), h = [], g = [];
4520
- for (let T = 0; T < p.length; T++) {
4521
- const b = p[T], S = m[T];
4522
- b && S?.isValid ? h.push({ assignment: b, validation: S }) : b?.taskId && g.push({
4521
+ ), h = [], I = [];
4522
+ for (let k = 0; k < p.length; k++) {
4523
+ const b = p[k], C = m[k];
4524
+ b && C?.isValid ? h.push({ assignment: b, validation: C }) : b?.taskId && I.push({
4523
4525
  taskId: b.taskId,
4524
4526
  success: !1,
4525
- error: S?.error?.message || "Validation failed"
4527
+ error: C?.error?.message || "Validation failed"
4526
4528
  });
4527
4529
  }
4528
- async function I(T, b) {
4529
- const S = T.filter(
4530
+ async function T(k, b) {
4531
+ const C = k.filter(
4530
4532
  (w) => w.assignment != null && w.validation != null
4531
4533
  );
4532
4534
  if (!b)
4533
- return S.map(({ assignment: w, validation: j }) => {
4535
+ return C.map(({ assignment: w, validation: S }) => {
4534
4536
  const v = d.find((x) => x.id === w.taskId);
4535
- if (!w.taskId || !j.resolvedUser?.userId)
4537
+ if (!w.taskId || !S.resolvedUser?.userId)
4536
4538
  throw new Error(
4537
4539
  "Invalid assignment or validation data - this should not happen"
4538
4540
  );
@@ -4540,13 +4542,13 @@ const zn = {
4540
4542
  taskId: w.taskId,
4541
4543
  success: !0,
4542
4544
  originalAssigneeId: v?.responsibleUid ?? void 0,
4543
- newAssigneeId: j.resolvedUser.userId
4545
+ newAssigneeId: S.resolvedUser.userId
4544
4546
  };
4545
4547
  });
4546
- const R = S.map(
4547
- async ({ assignment: w, validation: j }) => {
4548
+ const U = C.map(
4549
+ async ({ assignment: w, validation: S }) => {
4548
4550
  const v = d.find((x) => x.id === w.taskId);
4549
- if (!w.taskId || !j.resolvedUser?.userId)
4551
+ if (!w.taskId || !S.resolvedUser?.userId)
4550
4552
  return {
4551
4553
  taskId: w.taskId || "unknown-task",
4552
4554
  success: !1,
@@ -4555,12 +4557,12 @@ const zn = {
4555
4557
  };
4556
4558
  try {
4557
4559
  return await t.updateTask(w.taskId, {
4558
- assigneeId: j.resolvedUser.userId
4560
+ assigneeId: S.resolvedUser.userId
4559
4561
  }), {
4560
4562
  taskId: w.taskId,
4561
4563
  success: !0,
4562
4564
  originalAssigneeId: v?.responsibleUid ?? void 0,
4563
- newAssigneeId: j.resolvedUser.userId
4565
+ newAssigneeId: S.resolvedUser.userId
4564
4566
  };
4565
4567
  } catch (x) {
4566
4568
  return {
@@ -4572,26 +4574,26 @@ const zn = {
4572
4574
  }
4573
4575
  }
4574
4576
  );
4575
- return Promise.all(R);
4577
+ return Promise.all(U);
4576
4578
  }
4577
- const D = await I(h, !i), $ = [...D, ...g, ...l];
4578
- if ($.length > 0 && $.every((T) => !T.success)) {
4579
- const T = $.map((b) => `"${b.taskId}": ${b.error}`).join("; ");
4580
- throw new Error(`All ${$.length} ${r} operation(s) failed: ${T}`);
4579
+ const j = await T(h, !a), $ = [...j, ...I, ...l];
4580
+ if ($.length > 0 && $.every((k) => !k.success)) {
4581
+ const k = $.map((b) => `"${b.taskId}": ${b.error}`).join("; ");
4582
+ throw new Error(`All ${$.length} ${r} operation(s) failed: ${k}`);
4581
4583
  }
4582
4584
  return {
4583
4585
  textContent: $e({
4584
4586
  operation: r,
4585
4587
  results: $,
4586
- dryRun: i
4588
+ dryRun: a
4587
4589
  }),
4588
4590
  structuredContent: {
4589
4591
  operation: r,
4590
4592
  results: $,
4591
4593
  totalRequested: o.length,
4592
- successful: D.filter((T) => T.success).length,
4593
- failed: $.filter((T) => !T.success).length,
4594
- dryRun: i
4594
+ successful: j.filter((k) => k.success).length,
4595
+ failed: $.filter((k) => !k.success).length,
4596
+ dryRun: a
4595
4597
  }
4596
4598
  };
4597
4599
  }
@@ -4601,7 +4603,7 @@ function $e({
4601
4603
  results: t,
4602
4604
  dryRun: r
4603
4605
  }) {
4604
- const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), a = r ? "would be" : "were", i = {
4606
+ const o = t.filter((d) => d.success), n = t.filter((d) => !d.success), i = r ? "would be" : "were", a = {
4605
4607
  assign: "assigned",
4606
4608
  unassign: "unassigned",
4607
4609
  reassign: "reassigned"
@@ -4610,7 +4612,7 @@ function $e({
4610
4612
 
4611
4613
  `;
4612
4614
  if (o.length > 0) {
4613
- c += `**${o.length} task${o.length === 1 ? "" : "s"} ${a} successfully ${i}**
4615
+ c += `**${o.length} task${o.length === 1 ? "" : "s"} ${i} successfully ${a}**
4614
4616
  `;
4615
4617
  const d = o.slice(0, 5);
4616
4618
  for (const l of d) {
@@ -4636,13 +4638,13 @@ function $e({
4636
4638
  return !r && o.length > 0 ? (c += `**Next steps:**
4637
4639
  `, c += `• Use ${Yn} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
4638
4640
  `, c += `• Use ${Gn} for individual assignment changes
4639
- `, n.length > 0 && (c += `• Check failed tasks and use ${it} to verify collaborator access
4641
+ `, n.length > 0 && (c += `• Check failed tasks and use ${at} to verify collaborator access
4640
4642
  `)) : r ? (c += `**To execute:**
4641
4643
  `, c += `• Remove dryRun parameter and run again to execute changes
4642
4644
  `, o.length > 0 && (c += `• ${o.length} task${o.length === 1 ? "" : "s"} ready for ${e} operation
4643
4645
  `), n.length > 0 && (c += `• Fix ${n.length} validation error${n.length === 1 ? "" : "s"} before executing
4644
4646
  `)) : o.length === 0 && (c += `**Suggestions:**
4645
- `, c += `• Use ${it} to find valid assignees
4647
+ `, c += `• Use ${at} to find valid assignees
4646
4648
  `, c += `• Check task IDs and assignee permissions
4647
4649
  `, c += `• Use dryRun=true to validate before executing
4648
4650
  `), c;
@@ -4651,7 +4653,7 @@ const Xn = {
4651
4653
  action: s.enum(["archive", "unarchive"]).describe("The action to perform on the project."),
4652
4654
  projectId: s.string().min(1).describe("The ID of the project.")
4653
4655
  }, Zn = {
4654
- project: ae.describe("The updated project."),
4656
+ project: ie.describe("The updated project."),
4655
4657
  success: s.boolean().describe("Whether the action was successful.")
4656
4658
  }, Qn = {
4657
4659
  name: f.PROJECT_MANAGEMENT,
@@ -4669,7 +4671,7 @@ const Xn = {
4669
4671
  }
4670
4672
  };
4671
4673
  }
4672
- }, ea = {
4674
+ }, ei = {
4673
4675
  action: s.enum(["move-to-workspace", "move-to-personal"]).describe("The action to perform on the project."),
4674
4676
  projectId: s.string().min(1).describe("The ID of the project to move."),
4675
4677
  workspaceId: s.string().min(1).optional().describe("The target workspace ID. Required when action is move-to-workspace."),
@@ -4677,25 +4679,25 @@ const Xn = {
4677
4679
  visibility: s.enum(["restricted", "team", "public"]).optional().describe(
4678
4680
  "Optional access visibility for the project in the workspace (restricted, team, or public)."
4679
4681
  )
4680
- }, ta = {
4681
- project: ae.describe("The moved project."),
4682
+ }, ti = {
4683
+ project: ie.describe("The moved project."),
4682
4684
  success: s.boolean().describe("Whether the move was successful.")
4683
- }, sa = {
4685
+ }, si = {
4684
4686
  name: f.PROJECT_MOVE,
4685
4687
  description: "Move a project between personal and workspace contexts.",
4686
- parameters: ea,
4687
- outputSchema: ta,
4688
+ parameters: ei,
4689
+ outputSchema: ti,
4688
4690
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
4689
4691
  async execute(e, t) {
4690
4692
  let r;
4691
4693
  if (e.action === "move-to-workspace") {
4692
4694
  if (!e.workspaceId)
4693
4695
  throw new Error("workspaceId is required when action is move-to-workspace");
4694
- const a = {
4696
+ const i = {
4695
4697
  projectId: e.projectId,
4696
4698
  workspaceId: e.workspaceId
4697
4699
  };
4698
- e.folderId && (a.folderId = e.folderId), e.visibility && (a.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(a);
4700
+ e.folderId && (i.folderId = e.folderId), e.visibility && (i.access = { visibility: e.visibility }), r = await t.moveProjectToWorkspace(i);
4699
4701
  } else
4700
4702
  r = await t.moveProjectToPersonal({ projectId: e.projectId });
4701
4703
  const o = q(r);
@@ -4707,7 +4709,7 @@ const Xn = {
4707
4709
  }
4708
4710
  };
4709
4711
  }
4710
- }, _t = ["project", "section"], ra = {
4712
+ }, _t = ["project", "section"], ri = {
4711
4713
  type: s.enum(_t).describe(
4712
4714
  '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.'
4713
4715
  ),
@@ -4724,17 +4726,17 @@ const Xn = {
4724
4726
  ).min(1).describe(
4725
4727
  "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."
4726
4728
  )
4727
- }, oa = {
4729
+ }, oi = {
4728
4730
  type: s.enum(_t).describe("The type of entity that was reordered/moved."),
4729
4731
  movedCount: s.number().describe("The number of entities moved to a new parent."),
4730
4732
  reorderedCount: s.number().describe("The number of entities reordered."),
4731
4733
  affectedIds: s.array(s.string()).describe("The IDs of all affected entities."),
4732
4734
  success: s.boolean().describe("Whether the operation was successful.")
4733
- }, na = {
4735
+ }, ni = {
4734
4736
  name: f.REORDER_OBJECTS,
4735
4737
  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.',
4736
- parameters: ra,
4737
- outputSchema: oa,
4738
+ parameters: ri,
4739
+ outputSchema: oi,
4738
4740
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !0 },
4739
4741
  async execute(e, t) {
4740
4742
  const { type: r, items: o } = e, n = /* @__PURE__ */ new Set();
@@ -4750,10 +4752,10 @@ const Xn = {
4750
4752
  `parentId is only supported when type is "project", but type is "${r}".`
4751
4753
  );
4752
4754
  }
4753
- const a = [], i = o.filter((p) => p.parentId !== void 0);
4754
- for (const p of i) {
4755
+ const i = [], a = o.filter((p) => p.parentId !== void 0);
4756
+ for (const p of a) {
4755
4757
  const m = p.parentId;
4756
- a.push(
4758
+ i.push(
4757
4759
  z("project_move", {
4758
4760
  id: p.id,
4759
4761
  parentId: m === "root" ? null : m
@@ -4763,14 +4765,14 @@ const Xn = {
4763
4765
  const c = o.filter(
4764
4766
  (p) => p.order !== void 0
4765
4767
  );
4766
- c.length > 0 && (r === "project" ? a.push(
4768
+ c.length > 0 && (r === "project" ? i.push(
4767
4769
  z("project_reorder", {
4768
4770
  projects: c.map((p) => ({
4769
4771
  id: p.id,
4770
4772
  childOrder: p.order
4771
4773
  }))
4772
4774
  })
4773
- ) : a.push(
4775
+ ) : i.push(
4774
4776
  z("section_reorder", {
4775
4777
  sections: c.map((p) => ({
4776
4778
  id: p.id,
@@ -4779,39 +4781,39 @@ const Xn = {
4779
4781
  })
4780
4782
  ));
4781
4783
  try {
4782
- await t.sync({ commands: a });
4784
+ await t.sync({ commands: i });
4783
4785
  } catch (p) {
4784
4786
  const m = p instanceof Error ? p.message : String(p);
4785
4787
  throw new Error(`Reorder failed: ${m}`);
4786
4788
  }
4787
4789
  const d = r === "project" ? "projects" : "sections", l = o.map((p) => p.id), u = [];
4788
- return i.length > 0 && u.push(`moved ${i.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
4790
+ return a.length > 0 && u.push(`moved ${a.length}`), c.length > 0 && u.push(`reordered ${c.length}`), {
4789
4791
  textContent: `${u.join(" and ")} ${d}: ${l.map((p) => `id=${p}`).join(", ")}`,
4790
4792
  structuredContent: {
4791
4793
  type: r,
4792
- movedCount: i.length,
4794
+ movedCount: a.length,
4793
4795
  reorderedCount: c.length,
4794
4796
  affectedIds: l,
4795
4797
  success: !0
4796
4798
  }
4797
4799
  };
4798
4800
  }
4799
- }, aa = s.object({
4801
+ }, ii = s.object({
4800
4802
  id: s.string().min(1).describe("The ID of the task to reschedule."),
4801
4803
  date: s.string().min(1).describe(
4802
4804
  "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."
4803
4805
  )
4804
- }), ia = {
4805
- tasks: s.array(aa).min(1).describe("The tasks to reschedule with their new dates.")
4806
- }, ca = {
4806
+ }), ai = {
4807
+ tasks: s.array(ii).min(1).describe("The tasks to reschedule with their new dates.")
4808
+ }, ci = {
4807
4809
  tasks: s.array(K).describe("The rescheduled tasks."),
4808
4810
  totalCount: s.number().describe("The total number of tasks rescheduled."),
4809
4811
  rescheduledTaskIds: s.array(s.string()).describe("The IDs of the rescheduled tasks.")
4810
- }, da = {
4812
+ }, di = {
4811
4813
  name: f.RESCHEDULE_TASKS,
4812
4814
  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.",
4813
- parameters: ia,
4814
- outputSchema: ca,
4815
+ parameters: ai,
4816
+ outputSchema: ci,
4815
4817
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4816
4818
  async execute(e, t) {
4817
4819
  const { tasks: r } = e, n = (await Promise.all(
@@ -4824,7 +4826,7 @@ const Xn = {
4824
4826
  throw new Error(
4825
4827
  `Task "${l.content}" (${l.id}) has no due date. Rescheduling requires an existing due date.`
4826
4828
  );
4827
- const u = la(d.date, l.due);
4829
+ const u = li(d.date, l.due);
4828
4830
  return z("item_update", {
4829
4831
  id: d.id,
4830
4832
  due: {
@@ -4842,29 +4844,29 @@ const Xn = {
4842
4844
  const l = d instanceof Error ? d.message : String(d);
4843
4845
  throw new Error(`Reschedule failed: ${l}`);
4844
4846
  }
4845
- const a = await Promise.all(r.map((d) => t.getTask(d.id))), i = a.map(_);
4847
+ const i = await Promise.all(r.map((d) => t.getTask(d.id))), a = i.map(R);
4846
4848
  return {
4847
- textContent: Ye("Rescheduled", i, {
4848
- showDetails: i.length <= 5
4849
+ textContent: Ye("Rescheduled", a, {
4850
+ showDetails: a.length <= 5
4849
4851
  }),
4850
4852
  structuredContent: {
4851
- tasks: i,
4852
- totalCount: i.length,
4853
- rescheduledTaskIds: a.map((d) => d.id)
4853
+ tasks: a,
4854
+ totalCount: a.length,
4855
+ rescheduledTaskIds: i.map((d) => d.id)
4854
4856
  }
4855
4857
  };
4856
4858
  }
4857
4859
  };
4858
- function la(e, t) {
4860
+ function li(e, t) {
4859
4861
  if (/^\d{4}-\d{2}-\d{2}$/.test(e) && t.datetime) {
4860
4862
  const o = t.datetime.substring(10);
4861
4863
  return e + o;
4862
4864
  }
4863
4865
  return e;
4864
4866
  }
4865
- const ua = {
4867
+ const ui = {
4866
4868
  query: s.string().min(1).describe("The search query string to find tasks and projects.")
4867
- }, pa = {
4869
+ }, pi = {
4868
4870
  results: s.array(
4869
4871
  s.object({
4870
4872
  id: s.string().describe("The ID of the result."),
@@ -4873,67 +4875,67 @@ const ua = {
4873
4875
  })
4874
4876
  ).describe("The search results."),
4875
4877
  totalCount: s.number().describe("Total number of results found.")
4876
- }, ma = {
4878
+ }, mi = {
4877
4879
  name: f.SEARCH,
4878
4880
  description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
4879
- parameters: ua,
4880
- outputSchema: pa,
4881
+ parameters: ui,
4882
+ outputSchema: pi,
4881
4883
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
4882
4884
  async execute(e, t) {
4883
4885
  const { query: r } = e, [o, n] = await Promise.all([
4884
4886
  Fe({
4885
4887
  client: t,
4886
4888
  query: `search: ${r}`,
4887
- limit: C.TASKS_MAX,
4889
+ limit: D.TASKS_MAX,
4888
4890
  cursor: void 0
4889
4891
  }),
4890
4892
  kt(t, r)
4891
- ]), a = [];
4892
- for (const i of o.tasks)
4893
- a.push({
4894
- id: `task:${i.id}`,
4895
- title: i.content,
4896
- url: ut(i.id)
4893
+ ]), i = [];
4894
+ for (const a of o.tasks)
4895
+ i.push({
4896
+ id: `task:${a.id}`,
4897
+ title: a.content,
4898
+ url: ut(a.id)
4897
4899
  });
4898
- for (const i of n)
4899
- a.push({
4900
- id: `project:${i.id}`,
4901
- title: i.name,
4902
- url: pt(i.id)
4900
+ for (const a of n)
4901
+ i.push({
4902
+ id: `project:${a.id}`,
4903
+ title: a.name,
4904
+ url: pt(a.id)
4903
4905
  });
4904
4906
  return {
4905
- textContent: JSON.stringify({ results: a }),
4906
- structuredContent: { results: a, totalCount: a.length }
4907
+ textContent: JSON.stringify({ results: i }),
4908
+ structuredContent: { results: i, totalCount: i.length }
4907
4909
  };
4908
4910
  }
4909
- }, ha = {
4911
+ }, hi = {
4910
4912
  ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to uncomplete.")
4911
- }, fa = {
4913
+ }, fi = {
4912
4914
  uncompleted: s.array(s.string()).describe("The IDs of successfully uncompleted tasks."),
4913
4915
  failures: s.array(We).describe("Failed task uncompletion with error details."),
4914
4916
  totalRequested: s.number().describe("The total number of tasks requested to uncomplete."),
4915
4917
  successCount: s.number().describe("The number of successfully uncompleted tasks."),
4916
4918
  failureCount: s.number().describe("The number of failed task uncompletions.")
4917
- }, ba = {
4919
+ }, bi = {
4918
4920
  name: f.UNCOMPLETE_TASKS,
4919
4921
  description: "Uncomplete (reopen) one or more completed tasks by their IDs.",
4920
- parameters: ha,
4921
- outputSchema: fa,
4922
+ parameters: hi,
4923
+ outputSchema: fi,
4922
4924
  annotations: { readOnlyHint: !1, destructiveHint: !1, idempotentHint: !1 },
4923
4925
  async execute(e, t) {
4924
4926
  const r = [], o = [];
4925
- for (const a of e.ids)
4927
+ for (const i of e.ids)
4926
4928
  try {
4927
- await t.reopenTask(a), r.push(a);
4928
- } catch (i) {
4929
- const c = i instanceof Error ? i.message : "Unknown error";
4929
+ await t.reopenTask(i), r.push(i);
4930
+ } catch (a) {
4931
+ const c = a instanceof Error ? a.message : "Unknown error";
4930
4932
  o.push({
4931
- item: a,
4933
+ item: i,
4932
4934
  error: c
4933
4935
  });
4934
4936
  }
4935
4937
  return {
4936
- textContent: ga({
4938
+ textContent: gi({
4937
4939
  uncompleted: r,
4938
4940
  failures: o,
4939
4941
  args: e
@@ -4948,7 +4950,7 @@ const ua = {
4948
4950
  };
4949
4951
  }
4950
4952
  };
4951
- function ga({
4953
+ function gi({
4952
4954
  uncompleted: e,
4953
4955
  failures: t,
4954
4956
  args: r
@@ -4962,54 +4964,54 @@ function ga({
4962
4964
  failures: t
4963
4965
  });
4964
4966
  }
4965
- const ya = s.object({
4967
+ const yi = s.object({
4966
4968
  id: s.string().min(1).describe("The ID of the comment to update."),
4967
4969
  content: s.string().min(1).describe("The new content for the comment.")
4968
- }), ka = {
4969
- comments: s.array(ya).min(1).describe("The comments to update.")
4970
- }, Ta = {
4970
+ }), ki = {
4971
+ comments: s.array(yi).min(1).describe("The comments to update.")
4972
+ }, Ti = {
4971
4973
  comments: s.array(be).describe("The updated comments."),
4972
4974
  totalCount: s.number().describe("The total number of comments updated."),
4973
4975
  updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
4974
4976
  appliedOperations: s.object({
4975
4977
  updateCount: s.number().describe("The number of comments updated.")
4976
4978
  }).describe("Summary of operations performed.")
4977
- }, wa = {
4979
+ }, wi = {
4978
4980
  name: f.UPDATE_COMMENTS,
4979
4981
  description: "Update multiple existing comments with new content.",
4980
- parameters: ka,
4981
- outputSchema: Ta,
4982
+ parameters: ki,
4983
+ outputSchema: Ti,
4982
4984
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
4983
4985
  async execute(e, t) {
4984
- const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), a = (await Promise.all(o)).map(me);
4986
+ const { comments: r } = e, o = r.map(async (c) => await t.updateComment(c.id, { content: c.content })), i = (await Promise.all(o)).map(me);
4985
4987
  return {
4986
- textContent: Ia({
4987
- comments: a
4988
+ textContent: Ii({
4989
+ comments: i
4988
4990
  }),
4989
4991
  structuredContent: {
4990
- comments: a,
4991
- totalCount: a.length,
4992
- updatedCommentIds: a.map((c) => c.id),
4992
+ comments: i,
4993
+ totalCount: i.length,
4994
+ updatedCommentIds: i.map((c) => c.id),
4993
4995
  appliedOperations: {
4994
- updateCount: a.length
4996
+ updateCount: i.length
4995
4997
  }
4996
4998
  }
4997
4999
  };
4998
5000
  }
4999
5001
  };
5000
- function Ia({ comments: e }) {
5001
- const t = e.filter((a) => a.taskId).length, r = e.filter((a) => a.projectId).length, o = [];
5002
+ function Ii({ comments: e }) {
5003
+ const t = e.filter((i) => i.taskId).length, r = e.filter((i) => i.projectId).length, o = [];
5002
5004
  if (t > 0) {
5003
- const a = t > 1 ? "comments" : "comment";
5004
- o.push(`${t} task ${a}`);
5005
+ const i = t > 1 ? "comments" : "comment";
5006
+ o.push(`${t} task ${i}`);
5005
5007
  }
5006
5008
  if (r > 0) {
5007
- const a = r > 1 ? "comments" : "comment";
5008
- o.push(`${r} project ${a}`);
5009
+ const i = r > 1 ? "comments" : "comment";
5010
+ o.push(`${r} project ${i}`);
5009
5011
  }
5010
5012
  return o.length > 0 ? `Updated ${o.join(" and ")}` : "No comments updated";
5011
5013
  }
5012
- const va = s.object({
5014
+ const vi = s.object({
5013
5015
  id: s.string().min(1).describe("The ID of the filter to update."),
5014
5016
  name: s.string().min(1).optional().describe("The new name of the filter."),
5015
5017
  query: s.string().min(1).optional().describe(
@@ -5017,9 +5019,9 @@ const va = s.object({
5017
5019
  ),
5018
5020
  color: le,
5019
5021
  isFavorite: s.boolean().optional().describe("Whether to mark the filter as a favorite.")
5020
- }), ja = {
5021
- filters: s.array(va).min(1).describe("The filters to update.")
5022
- }, Sa = {
5022
+ }), ji = {
5023
+ filters: s.array(vi).min(1).describe("The filters to update.")
5024
+ }, Si = {
5023
5025
  filters: s.array(Be).describe("The updated filters."),
5024
5026
  totalCount: s.number().describe("The total number of filters updated."),
5025
5027
  updatedFilterIds: s.array(s.string()).describe("The IDs of the updated filters."),
@@ -5027,36 +5029,36 @@ const va = s.object({
5027
5029
  updateCount: s.number().describe("The number of filters actually updated."),
5028
5030
  skippedCount: s.number().describe("The number of filters skipped (no changes).")
5029
5031
  }).describe("Summary of operations performed.")
5030
- }, Ca = {
5032
+ }, Ci = {
5031
5033
  name: f.UPDATE_FILTERS,
5032
5034
  description: "Update one or more existing personal filters with new values.",
5033
- parameters: ja,
5034
- outputSchema: Sa,
5035
+ parameters: ji,
5036
+ outputSchema: Si,
5035
5037
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5036
5038
  async execute(e, t) {
5037
- const { filters: r } = e, o = [], a = r.map((m) => {
5038
- const h = Da(m);
5039
+ const { filters: r } = e, o = [], i = r.map((m) => {
5040
+ const h = Di(m);
5039
5041
  return h !== null ? { kind: "skipped", reason: h } : (o.push(m), { kind: "updated", filter: m });
5040
5042
  }).filter((m) => m.kind === "skipped").length;
5041
5043
  if (o.length === 0)
5042
5044
  return {
5043
- textContent: `Updated 0 filters (${a} skipped - no changes)`,
5045
+ textContent: `Updated 0 filters (${i} skipped - no changes)`,
5044
5046
  structuredContent: {
5045
5047
  filters: [],
5046
5048
  totalCount: 0,
5047
5049
  updatedFilterIds: [],
5048
- appliedOperations: { updateCount: 0, skippedCount: a }
5050
+ appliedOperations: { updateCount: 0, skippedCount: i }
5049
5051
  }
5050
5052
  };
5051
- const i = o.map((m) => {
5052
- const { id: h, color: g, ...I } = m;
5053
+ const a = o.map((m) => {
5054
+ const { id: h, color: I, ...T } = m;
5053
5055
  return z("filter_update", {
5054
5056
  id: h,
5055
- ...I,
5056
- ...g !== void 0 ? { color: g } : {}
5057
+ ...T,
5058
+ ...I !== void 0 ? { color: I } : {}
5057
5059
  });
5058
5060
  });
5059
- await t.sync({ commands: i });
5061
+ await t.sync({ commands: a });
5060
5062
  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) => ({
5061
5063
  id: m.id,
5062
5064
  name: m.name,
@@ -5066,78 +5068,78 @@ const va = s.object({
5066
5068
  itemOrder: m.itemOrder
5067
5069
  }));
5068
5070
  return {
5069
- textContent: $a({ filters: u, skippedCount: a }),
5071
+ textContent: $i({ filters: u, skippedCount: i }),
5070
5072
  structuredContent: {
5071
5073
  filters: u,
5072
5074
  totalCount: u.length,
5073
5075
  updatedFilterIds: u.map((m) => m.id),
5074
5076
  appliedOperations: {
5075
5077
  updateCount: u.length,
5076
- skippedCount: a
5078
+ skippedCount: i
5077
5079
  }
5078
5080
  }
5079
5081
  };
5080
5082
  }
5081
5083
  };
5082
- function $a({
5084
+ function $i({
5083
5085
  filters: e,
5084
5086
  skippedCount: t
5085
5087
  }) {
5086
5088
  const r = e.length;
5087
5089
  let o = `Updated ${r} filter${r === 1 ? "" : "s"}`;
5088
5090
  if (t > 0 && (o += ` (${t} skipped - no changes)`), r > 0) {
5089
- const n = e.map((a) => `• ${a.name} (id=${a.id})`).join(`
5091
+ const n = e.map((i) => `• ${i.name} (id=${i.id})`).join(`
5090
5092
  `);
5091
5093
  o += `:
5092
5094
  ${n}`;
5093
5095
  }
5094
5096
  return o;
5095
5097
  }
5096
- function Da({ id: e, ...t }) {
5098
+ function Di({ id: e, ...t }) {
5097
5099
  return Object.values(t).every((o) => o === void 0) ? "no-fields" : null;
5098
5100
  }
5099
- const xa = s.object({
5101
+ const xi = s.object({
5100
5102
  id: s.string().min(1).describe("The ID of the project to update."),
5101
5103
  name: s.string().min(1).optional().describe("The new name of the project."),
5102
5104
  isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
5103
5105
  viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style."),
5104
5106
  color: le
5105
- }), Aa = {
5106
- projects: s.array(xa).min(1).describe("The projects to update.")
5107
- }, Ea = {
5108
- projects: s.array(ae).describe("The updated projects."),
5107
+ }), Ai = {
5108
+ projects: s.array(xi).min(1).describe("The projects to update.")
5109
+ }, Ei = {
5110
+ projects: s.array(ie).describe("The updated projects."),
5109
5111
  totalCount: s.number().describe("The total number of projects updated."),
5110
5112
  updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
5111
5113
  appliedOperations: s.object({
5112
5114
  updateCount: s.number().describe("The number of projects actually updated."),
5113
5115
  skippedCount: s.number().describe("The number of projects skipped (no changes).")
5114
5116
  }).describe("Summary of operations performed.")
5115
- }, Oa = {
5117
+ }, Oi = {
5116
5118
  name: f.UPDATE_PROJECTS,
5117
5119
  description: "Update multiple existing projects with new values.",
5118
- parameters: Aa,
5119
- outputSchema: Ea,
5120
+ parameters: Ai,
5121
+ outputSchema: Ei,
5120
5122
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5121
5123
  async execute(e, t) {
5122
5124
  const { projects: r } = e, o = await Promise.all(
5123
5125
  r.map(async (d) => {
5124
- const l = _a(d);
5126
+ const l = _i(d);
5125
5127
  if (l !== null) return { kind: "skipped", reason: l };
5126
5128
  const { id: u, ...p } = d;
5127
5129
  return { kind: "updated", project: await t.updateProject(u, p) };
5128
5130
  })
5129
5131
  ), n = o.filter(
5130
5132
  (d) => d.kind === "updated"
5131
- ).map((d) => q(d.project)), a = o.filter(
5133
+ ).map((d) => q(d.project)), i = o.filter(
5132
5134
  (d) => d.kind === "skipped" && d.reason === "no-fields"
5133
- ).length, i = o.filter(
5135
+ ).length, a = o.filter(
5134
5136
  (d) => d.kind === "skipped" && d.reason === "no-valid-values"
5135
5137
  ).length;
5136
5138
  return {
5137
- textContent: Pa({
5139
+ textContent: Pi({
5138
5140
  projects: n,
5139
- skippedNoFields: a,
5140
- skippedNoValidValues: i
5141
+ skippedNoFields: i,
5142
+ skippedNoValidValues: a
5141
5143
  }),
5142
5144
  structuredContent: {
5143
5145
  projects: n,
@@ -5145,41 +5147,41 @@ const xa = s.object({
5145
5147
  updatedProjectIds: n.map((d) => d.id),
5146
5148
  appliedOperations: {
5147
5149
  updateCount: n.length,
5148
- skippedCount: a + i
5150
+ skippedCount: i + a
5149
5151
  }
5150
5152
  }
5151
5153
  };
5152
5154
  }
5153
5155
  };
5154
- function Pa({
5156
+ function Pi({
5155
5157
  projects: e,
5156
5158
  skippedNoFields: t,
5157
5159
  skippedNoValidValues: r
5158
5160
  }) {
5159
5161
  const o = e.length, n = e.map((c) => `• ${c.name} (id=${c.id})`).join(`
5160
5162
  `);
5161
- let a = `Updated ${o} project${o === 1 ? "" : "s"}`;
5162
- const i = [];
5163
- return t > 0 && i.push(`${t} skipped - no changes`), r > 0 && i.push(`${r} skipped - no valid field values`), i.length > 0 && (a += ` (${i.join(", ")})`), o > 0 && (a += `:
5164
- ${n}`), a;
5163
+ let i = `Updated ${o} project${o === 1 ? "" : "s"}`;
5164
+ const a = [];
5165
+ return t > 0 && a.push(`${t} skipped - no changes`), r > 0 && a.push(`${r} skipped - no valid field values`), a.length > 0 && (i += ` (${a.join(", ")})`), o > 0 && (i += `:
5166
+ ${n}`), i;
5165
5167
  }
5166
- function _a({ id: e, ...t }) {
5168
+ function _i({ id: e, ...t }) {
5167
5169
  const r = Object.values(t);
5168
5170
  return r.length === 0 ? "no-fields" : r.every((o) => o === void 0) ? "no-valid-values" : null;
5169
5171
  }
5170
- const Ra = s.object({
5172
+ const Ri = s.object({
5171
5173
  type: s.literal("relative"),
5172
5174
  id: s.string().min(1).describe("The ID of the relative reminder to update."),
5173
5175
  minuteOffset: s.number().int().min(0).optional().describe("New minute offset before task due time."),
5174
5176
  service: ye.optional().describe('New delivery method: "email" or "push".'),
5175
5177
  isUrgent: ke
5176
- }), Ua = s.object({
5178
+ }), Ui = s.object({
5177
5179
  type: s.literal("absolute"),
5178
5180
  id: s.string().min(1).describe("The ID of the absolute reminder to update."),
5179
5181
  due: It.optional().describe("New due date/time for the reminder."),
5180
5182
  service: ye.optional().describe('New delivery method: "email" or "push".'),
5181
5183
  isUrgent: ke
5182
- }), Na = s.object({
5184
+ }), Ni = s.object({
5183
5185
  type: s.literal("location"),
5184
5186
  id: s.string().min(1).describe("The ID of the location reminder to update."),
5185
5187
  name: s.string().optional().describe("New location name."),
@@ -5189,23 +5191,23 @@ const Ra = s.object({
5189
5191
  'New trigger condition: "on_enter" or "on_leave".'
5190
5192
  ),
5191
5193
  radius: s.number().int().optional().describe("New radius in meters.")
5192
- }), La = s.discriminatedUnion("type", [
5193
- Ra,
5194
- Ua,
5195
- Na
5196
- ]), Ma = {
5197
- reminders: s.array(La).min(1).max(pe).describe(
5194
+ }), Li = s.discriminatedUnion("type", [
5195
+ Ri,
5196
+ Ui,
5197
+ Ni
5198
+ ]), Mi = {
5199
+ reminders: s.array(Li).min(1).max(pe).describe(
5198
5200
  `Array of reminders to update (max ${pe}). Each must include the reminder type and ID. Only include fields that need to change.`
5199
5201
  )
5200
- }, Fa = {
5202
+ }, Fi = {
5201
5203
  reminders: s.array(He).describe("The updated reminders."),
5202
5204
  totalCount: s.number().describe("Total reminders updated."),
5203
5205
  updatedReminderIds: s.array(s.string()).describe("IDs of updated reminders.")
5204
- }, Ha = {
5206
+ }, Hi = {
5205
5207
  name: f.UPDATE_REMINDERS,
5206
5208
  description: 'Update existing reminders. Each reminder must specify its type ("relative", "absolute", or "location") and ID. Only include fields that need to change.',
5207
- parameters: Ma,
5208
- outputSchema: Fa,
5209
+ parameters: Mi,
5210
+ outputSchema: Fi,
5209
5211
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !0 },
5210
5212
  async execute(e, t) {
5211
5213
  const { reminders: r } = e, o = r.map(async (d) => {
@@ -5229,37 +5231,37 @@ const Ra = s.object({
5229
5231
  return await t.updateLocationReminder(l, p);
5230
5232
  }
5231
5233
  }
5232
- }), a = (await Promise.all(o)).map(ce), i = a.length === 1 ? "reminder" : "reminders";
5234
+ }), i = (await Promise.all(o)).map(ce), a = i.length === 1 ? "reminder" : "reminders";
5233
5235
  return {
5234
- textContent: `Updated ${a.length} ${i}`,
5236
+ textContent: `Updated ${i.length} ${a}`,
5235
5237
  structuredContent: {
5236
- reminders: a,
5237
- totalCount: a.length,
5238
- updatedReminderIds: a.map((d) => d.id)
5238
+ reminders: i,
5239
+ totalCount: i.length,
5240
+ updatedReminderIds: i.map((d) => d.id)
5239
5241
  }
5240
5242
  };
5241
5243
  }
5242
- }, Wa = s.object({
5244
+ }, Wi = s.object({
5243
5245
  id: s.string().min(1).describe("The ID of the section to update."),
5244
5246
  name: s.string().min(1).describe("The new name of the section.")
5245
- }), Ba = {
5246
- sections: s.array(Wa).min(1).describe("The sections to update.")
5247
- }, za = {
5247
+ }), Bi = {
5248
+ sections: s.array(Wi).min(1).describe("The sections to update.")
5249
+ }, zi = {
5248
5250
  sections: s.array(fe).describe("The updated sections."),
5249
5251
  totalCount: s.number().describe("The total number of sections updated."),
5250
5252
  updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
5251
- }, Ya = {
5253
+ }, Yi = {
5252
5254
  name: f.UPDATE_SECTIONS,
5253
5255
  description: "Update multiple existing sections with new values.",
5254
- parameters: Ba,
5255
- outputSchema: za,
5256
+ parameters: Bi,
5257
+ outputSchema: zi,
5256
5258
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5257
5259
  async execute({ sections: e }, t) {
5258
5260
  const r = await Promise.all(
5259
5261
  e.map((n) => t.updateSection(n.id, { name: n.name }))
5260
5262
  );
5261
5263
  return {
5262
- textContent: Ga({
5264
+ textContent: Gi({
5263
5265
  sections: r
5264
5266
  }),
5265
5267
  structuredContent: {
@@ -5270,13 +5272,13 @@ const Ra = s.object({
5270
5272
  };
5271
5273
  }
5272
5274
  };
5273
- function Ga({ sections: e }) {
5275
+ function Gi({ sections: e }) {
5274
5276
  const t = e.length, r = e.map((n) => `• ${n.name} (id=${n.id}, projectId=${n.projectId})`).join(`
5275
5277
  `);
5276
5278
  return `Updated ${t} section${t === 1 ? "" : "s"}:
5277
5279
  ${r}`;
5278
5280
  }
5279
- const qa = s.object({
5281
+ const qi = s.object({
5280
5282
  id: s.string().min(1).describe("The ID of the task to update."),
5281
5283
  content: s.string().optional().describe(
5282
5284
  'The new task name/title. Should be concise and actionable (e.g., "Review PR #123", "Call dentist"). For longer content, use the description field instead. Supports Markdown.'
@@ -5315,9 +5317,9 @@ const qa = s.object({
5315
5317
  isUncompletable: s.boolean().optional().describe(
5316
5318
  "Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed."
5317
5319
  )
5318
- }), Ka = ["remove", "no date"], Va = ["remove", "no date", "no deadline"], Ja = "no date", Xa = {
5319
- tasks: s.array(qa).min(1).describe("The tasks to update.")
5320
- }, Za = {
5320
+ }), Ki = ["remove", "no date"], Vi = ["remove", "no date", "no deadline"], Ji = "no date", Xi = {
5321
+ tasks: s.array(qi).min(1).describe("The tasks to update.")
5322
+ }, Zi = {
5321
5323
  tasks: s.array(K).describe("The updated tasks."),
5322
5324
  totalCount: s.number().describe("The total number of tasks updated."),
5323
5325
  updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
@@ -5325,15 +5327,15 @@ const qa = s.object({
5325
5327
  updateCount: s.number().describe("The number of tasks actually updated."),
5326
5328
  skippedCount: s.number().describe("The number of tasks skipped (no changes).")
5327
5329
  }).describe("Summary of operations performed.")
5328
- }, Qa = {
5330
+ }, Qi = {
5329
5331
  name: f.UPDATE_TASKS,
5330
5332
  description: "Update existing tasks including content, dates, priorities, and assignments.",
5331
- parameters: Xa,
5332
- outputSchema: Za,
5333
+ parameters: Xi,
5334
+ outputSchema: Zi,
5333
5335
  annotations: { readOnlyHint: !1, destructiveHint: !0, idempotentHint: !1 },
5334
5336
  async execute(e, t) {
5335
5337
  const { tasks: r } = e, o = r.map(async (c) => {
5336
- if (!ti(c))
5338
+ if (!ta(c))
5337
5339
  return;
5338
5340
  const {
5339
5341
  id: d,
@@ -5342,32 +5344,32 @@ const qa = s.object({
5342
5344
  parentId: p,
5343
5345
  dueString: m,
5344
5346
  duration: h,
5345
- responsibleUser: g,
5346
- priority: I,
5347
- labels: D,
5347
+ responsibleUser: I,
5348
+ priority: T,
5349
+ labels: j,
5348
5350
  deadlineDate: $,
5349
- ...N
5350
- } = c, T = await G({
5351
+ ...A
5352
+ } = c, k = await G({
5351
5353
  projectId: l,
5352
5354
  client: t
5353
5355
  });
5354
5356
  let b = {
5355
- ...N,
5356
- ...D !== void 0 && { labels: D }
5357
+ ...A,
5358
+ ...j !== void 0 && { labels: j }
5357
5359
  };
5358
- I && (b.priority = bt(I));
5359
- const S = ct(
5360
+ T && (b.priority = bt(T));
5361
+ const C = ct(
5360
5362
  m,
5361
- Ka,
5362
- Ja
5363
+ Ki,
5364
+ Ji
5363
5365
  );
5364
- S !== void 0 && (b = { ...b, dueString: S });
5365
- const R = ct(
5366
+ C !== void 0 && (b = { ...b, dueString: C });
5367
+ const U = ct(
5366
5368
  $,
5367
- Va,
5369
+ Vi,
5368
5370
  null
5369
5371
  );
5370
- if (R !== void 0 && (b = { ...b, deadlineDate: R }), h)
5372
+ if (U !== void 0 && (b = { ...b, deadlineDate: U }), h)
5371
5373
  try {
5372
5374
  const { minutes: v } = ft(h);
5373
5375
  b = {
@@ -5376,16 +5378,16 @@ const qa = s.object({
5376
5378
  durationUnit: "minute"
5377
5379
  };
5378
5380
  } catch (v) {
5379
- throw v instanceof O ? new Error(`Task ${d}: ${v.message}`) : v;
5381
+ throw v instanceof P ? new Error(`Task ${d}: ${v.message}`) : v;
5380
5382
  }
5381
- if (g !== void 0)
5382
- if (g === null || g === "unassign")
5383
+ if (I !== void 0)
5384
+ if (I === null || I === "unassign")
5383
5385
  b = { ...b, assigneeId: null };
5384
5386
  else {
5385
5387
  const v = await ze.validateTaskUpdateAssignment(
5386
5388
  t,
5387
5389
  d,
5388
- g
5390
+ I
5389
5391
  );
5390
5392
  if (!v.isValid) {
5391
5393
  const x = v.error?.message || "Assignment validation failed", L = v.error?.suggestions?.join(". ") || "";
@@ -5395,42 +5397,42 @@ const qa = s.object({
5395
5397
  }
5396
5398
  b = { ...b, assigneeId: v.resolvedUser?.userId };
5397
5399
  }
5398
- if (!T && !u && !p)
5400
+ if (!k && !u && !p)
5399
5401
  return await t.updateTask(d, b);
5400
- const w = Bs(d, T, u, p), j = await t.moveTask(d, w);
5401
- return Object.keys(b).length > 0 ? await t.updateTask(d, b) : j;
5402
+ const w = Bs(d, k, u, p), S = await t.moveTask(d, w);
5403
+ return Object.keys(b).length > 0 ? await t.updateTask(d, b) : S;
5402
5404
  }), n = (await Promise.all(o)).filter(
5403
5405
  (c) => c !== void 0
5404
- ), a = n.map(_);
5406
+ ), i = n.map(R);
5405
5407
  return {
5406
- textContent: ei({
5407
- tasks: a,
5408
+ textContent: ea({
5409
+ tasks: i,
5408
5410
  args: e
5409
5411
  }),
5410
5412
  structuredContent: {
5411
- tasks: a,
5412
- totalCount: a.length,
5413
+ tasks: i,
5414
+ totalCount: i.length,
5413
5415
  updatedTaskIds: n.map((c) => c.id),
5414
5416
  appliedOperations: {
5415
- updateCount: a.length,
5416
- skippedCount: r.length - a.length
5417
+ updateCount: i.length,
5418
+ skippedCount: r.length - i.length
5417
5419
  }
5418
5420
  }
5419
5421
  };
5420
5422
  }
5421
5423
  };
5422
- function ei({
5424
+ function ea({
5423
5425
  tasks: e,
5424
5426
  args: t
5425
5427
  }) {
5426
5428
  const r = t.tasks.length, o = e.length, n = r - o;
5427
- let a = "";
5428
- return n > 0 && (a = ` (${n} skipped - no changes)`), Ye("Updated", e, {
5429
- context: a,
5429
+ let i = "";
5430
+ return n > 0 && (i = ` (${n} skipped - no changes)`), Ye("Updated", e, {
5431
+ context: i,
5430
5432
  showDetails: e.length <= 5
5431
5433
  });
5432
5434
  }
5433
- function ti({ id: e, ...t }) {
5435
+ function ta({ id: e, ...t }) {
5434
5436
  return Object.keys(t).length > 0;
5435
5437
  }
5436
5438
  function ct(e, t, r) {
@@ -5441,7 +5443,7 @@ function ct(e, t, r) {
5441
5443
  const o = e.trim().toLowerCase();
5442
5444
  return t.includes(o) ? r : e;
5443
5445
  }
5444
- const si = {}, ri = {
5446
+ const sa = {}, ra = {
5445
5447
  type: s.literal("user_info").describe("The type of the response."),
5446
5448
  userId: s.string().describe("The user ID."),
5447
5449
  fullName: s.string().describe("The full name of the user."),
@@ -5458,25 +5460,25 @@ const si = {}, ri = {
5458
5460
  email: s.string().describe("The email address of the user."),
5459
5461
  plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
5460
5462
  };
5461
- function oi(e) {
5463
+ function oa(e) {
5462
5464
  return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
5463
5465
  }
5464
- function ni(e, t) {
5466
+ function na(e, t) {
5465
5467
  const o = ((e.getDay() || 7) - t + 7) % 7, n = new Date(e);
5466
5468
  return n.setDate(e.getDate() - o), n;
5467
5469
  }
5468
- function ai(e) {
5470
+ function ia(e) {
5469
5471
  const t = new Date(e);
5470
5472
  return t.setDate(e.getDate() + 6), t;
5471
5473
  }
5472
- function ii(e) {
5474
+ function aa(e) {
5473
5475
  const t = new Date(e.getFullYear(), 0, 1), r = (e.getTime() - t.getTime()) / 864e5;
5474
5476
  return Math.ceil((r + t.getDay() + 1) / 7);
5475
5477
  }
5476
- function ci(e) {
5478
+ function ca(e) {
5477
5479
  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
5478
5480
  }
5479
- function di(e) {
5481
+ function da(e) {
5480
5482
  try {
5481
5483
  return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
5482
5484
  } catch {
@@ -5484,9 +5486,9 @@ function di(e) {
5484
5486
  }
5485
5487
  }
5486
5488
  function Rt(e) {
5487
- return di(e) ? e : "UTC";
5489
+ return da(e) ? e : "UTC";
5488
5490
  }
5489
- function li(e, t) {
5491
+ function la(e, t) {
5490
5492
  const r = Rt(t);
5491
5493
  return e.toLocaleString("en-US", {
5492
5494
  timeZone: r,
@@ -5499,18 +5501,18 @@ function li(e, t) {
5499
5501
  hour12: !1
5500
5502
  });
5501
5503
  }
5502
- async function ui(e) {
5503
- const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = Rt(r), n = /* @__PURE__ */ new Date(), a = li(n, o), i = t.startDay ?? 1, c = ci(i), d = oi(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = ni(l, i), p = ai(u), m = ii(l), g = [
5504
+ async function ua(e) {
5505
+ const t = await e.getUser(), r = t.tzInfo?.timezone ?? "UTC", o = Rt(r), n = /* @__PURE__ */ new Date(), i = la(n, o), a = t.startDay ?? 1, c = ca(a), d = oa(t), l = new Date(n.toLocaleString("en-US", { timeZone: o })), u = na(l, a), p = ia(u), m = aa(l), I = [
5504
5506
  "# User Information",
5505
5507
  "",
5506
5508
  `**User ID:** ${t.id}`,
5507
5509
  `**Full Name:** ${t.fullName}`,
5508
5510
  `**Email:** ${t.email}`,
5509
5511
  `**Timezone:** ${o}`,
5510
- `**Current Local Time:** ${a}`,
5512
+ `**Current Local Time:** ${i}`,
5511
5513
  "",
5512
5514
  "## Week Settings",
5513
- `**Week Start Day:** ${c} (${i})`,
5515
+ `**Week Start Day:** ${c} (${a})`,
5514
5516
  `**Current Week:** Week ${m}`,
5515
5517
  `**Week Start Date:** ${te(u)}`,
5516
5518
  `**Week End Date:** ${te(p)}`,
@@ -5523,13 +5525,13 @@ async function ui(e) {
5523
5525
  "## Account Info",
5524
5526
  `**Plan:** ${d}`
5525
5527
  ].join(`
5526
- `), I = {
5528
+ `), T = {
5527
5529
  type: "user_info",
5528
5530
  userId: t.id,
5529
5531
  fullName: t.fullName,
5530
5532
  timezone: o,
5531
- currentLocalTime: a,
5532
- startDay: i,
5533
+ currentLocalTime: i,
5534
+ startDay: a,
5533
5535
  startDayName: c,
5534
5536
  weekStartDate: te(u),
5535
5537
  weekEndDate: te(p),
@@ -5540,28 +5542,28 @@ async function ui(e) {
5540
5542
  email: t.email,
5541
5543
  plan: d
5542
5544
  };
5543
- return { textContent: g, structuredContent: I };
5545
+ return { textContent: I, structuredContent: T };
5544
5546
  }
5545
- const pi = {
5547
+ const pa = {
5546
5548
  name: f.USER_INFO,
5547
5549
  description: "Get comprehensive user information including user ID, full name, email, timezone with current local time, week start day preferences, current week dates, daily/weekly goal progress, and user plan (Free/Pro/Business).",
5548
- parameters: si,
5549
- outputSchema: ri,
5550
+ parameters: sa,
5551
+ outputSchema: ra,
5550
5552
  annotations: { readOnlyHint: !0, destructiveHint: !1, idempotentHint: !0 },
5551
5553
  async execute(e, t) {
5552
- const r = await ui(t);
5554
+ const r = await ua(t);
5553
5555
  return {
5554
5556
  textContent: r.textContent,
5555
5557
  structuredContent: r.structuredContent
5556
5558
  };
5557
5559
  }
5558
- }, dt = 10 * 1024 * 1024, mi = /* @__PURE__ */ new Set([
5560
+ }, dt = 10 * 1024 * 1024, ma = /* @__PURE__ */ new Set([
5559
5561
  "image/png",
5560
5562
  "image/jpeg",
5561
5563
  "image/gif",
5562
5564
  "image/webp",
5563
5565
  "image/svg+xml"
5564
- ]), hi = /* @__PURE__ */ new Set([
5566
+ ]), ha = /* @__PURE__ */ new Set([
5565
5567
  "text/plain",
5566
5568
  "text/csv",
5567
5569
  "text/html",
@@ -5569,7 +5571,7 @@ const pi = {
5569
5571
  "application/json",
5570
5572
  "application/xml",
5571
5573
  "text/xml"
5572
- ]), fi = {
5574
+ ]), fa = {
5573
5575
  ".png": "image/png",
5574
5576
  ".jpg": "image/jpeg",
5575
5577
  ".jpeg": "image/jpeg",
@@ -5584,23 +5586,23 @@ const pi = {
5584
5586
  ".xml": "application/xml",
5585
5587
  ".pdf": "application/pdf"
5586
5588
  };
5587
- function bi(e) {
5588
- return mi.has(e) ? "image" : hi.has(e) || e.startsWith("text/") ? "text" : "binary";
5589
+ function ba(e) {
5590
+ return ma.has(e) ? "image" : ha.has(e) || e.startsWith("text/") ? "text" : "binary";
5589
5591
  }
5590
- function gi(e) {
5592
+ function ga(e) {
5591
5593
  return (e.split(";")[0] ?? e).trim().toLowerCase();
5592
5594
  }
5593
- function yi(e) {
5595
+ function ya(e) {
5594
5596
  try {
5595
5597
  const t = new URL(e).pathname, r = t.lastIndexOf(".");
5596
5598
  if (r === -1) return;
5597
5599
  const o = t.slice(r).toLowerCase();
5598
- return fi[o];
5600
+ return fa[o];
5599
5601
  } catch {
5600
5602
  return;
5601
5603
  }
5602
5604
  }
5603
- function ki(e) {
5605
+ function ka(e) {
5604
5606
  try {
5605
5607
  const t = new URL(e).pathname, r = t.lastIndexOf("/");
5606
5608
  return r === -1 ? void 0 : t.slice(r + 1) || void 0;
@@ -5608,32 +5610,32 @@ function ki(e) {
5608
5610
  return;
5609
5611
  }
5610
5612
  }
5611
- const Ti = {
5613
+ const Ta = {
5612
5614
  fileUrl: s.string().url().describe(
5613
5615
  "The URL of the attachment file to view. Get this from the fileUrl field in a comment's fileAttachment."
5614
5616
  )
5615
- }, wi = {
5617
+ }, wa = {
5616
5618
  fileName: s.string().optional().describe("The name of the file."),
5617
5619
  fileType: s.string().optional().describe("The MIME type of the file."),
5618
5620
  fileSize: s.number().optional().describe("The size of the file in bytes."),
5619
5621
  contentDelivery: s.enum(["image", "text", "embedded_resource", "metadata_only"]).describe("How the content was delivered.")
5620
- }, Ii = {
5622
+ }, Ia = {
5621
5623
  name: f.VIEW_ATTACHMENT,
5622
5624
  description: "View a file attachment from a Todoist comment. Pass the fileUrl from a comment's fileAttachment field. Supports images (returned inline), text files (returned as text), and binary files like PDFs (returned as embedded resources).",
5623
- parameters: Ti,
5624
- outputSchema: wi,
5625
+ parameters: Ta,
5626
+ outputSchema: wa,
5625
5627
  annotations: {
5626
5628
  readOnlyHint: !0,
5627
5629
  destructiveHint: !1,
5628
5630
  idempotentHint: !0
5629
5631
  },
5630
5632
  async execute({ fileUrl: e }, t) {
5631
- const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, a = ki(e), i = r.headers["content-type"], c = i ? gi(i) : void 0, d = c && c !== "application/octet-stream" ? c : yi(e) ?? c ?? "application/octet-stream";
5633
+ const r = await t.viewAttachment(e), o = r.headers["content-length"], n = o ? Number.parseInt(o, 10) : void 0, i = ka(e), a = r.headers["content-type"], c = a ? ga(a) : void 0, d = c && c !== "application/octet-stream" ? c : ya(e) ?? c ?? "application/octet-stream";
5632
5634
  if (n && n > dt)
5633
5635
  return {
5634
- textContent: `Attachment "${a ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5636
+ textContent: `Attachment "${i ?? e}" is too large to display inline (${(n / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5635
5637
  structuredContent: {
5636
- fileName: a,
5638
+ fileName: i,
5637
5639
  fileType: d,
5638
5640
  fileSize: n,
5639
5641
  contentDelivery: "metadata_only"
@@ -5642,15 +5644,15 @@ const Ti = {
5642
5644
  const l = Buffer.from(await r.arrayBuffer()), u = l.byteLength;
5643
5645
  if (u > dt)
5644
5646
  return {
5645
- textContent: `Attachment "${a ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5647
+ textContent: `Attachment "${i ?? e}" is too large to display inline (${(u / 1024 / 1024).toFixed(1)}MB, limit is 10MB). File type: ${d}`,
5646
5648
  structuredContent: {
5647
- fileName: a,
5649
+ fileName: i,
5648
5650
  fileType: d,
5649
5651
  fileSize: u,
5650
5652
  contentDelivery: "metadata_only"
5651
5653
  }
5652
5654
  };
5653
- const p = bi(d), m = [];
5655
+ const p = ba(d), m = [];
5654
5656
  let h;
5655
5657
  return p === "image" ? (m.push({
5656
5658
  type: "image",
@@ -5667,9 +5669,9 @@ const Ti = {
5667
5669
  blob: l.toString("base64")
5668
5670
  }
5669
5671
  }), h = "embedded_resource"), {
5670
- textContent: `Attachment: ${a ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
5672
+ textContent: `Attachment: ${i ?? "unknown"} (${d}, ${(u / 1024).toFixed(1)}KB)`,
5671
5673
  structuredContent: {
5672
- fileName: a,
5674
+ fileName: i,
5673
5675
  fileType: d,
5674
5676
  fileSize: u,
5675
5677
  contentDelivery: h
@@ -5677,7 +5679,7 @@ const Ti = {
5677
5679
  contentItems: m
5678
5680
  };
5679
5681
  }
5680
- }, vi = `
5682
+ }, va = `
5681
5683
  ## Todoist Task and Project Management Tools
5682
5684
 
5683
5685
  You have access to comprehensive Todoist management tools for personal productivity and team collaboration. Use these tools to help users manage tasks, projects, sections, comments, and assignments effectively.
@@ -5774,7 +5776,7 @@ You have access to comprehensive Todoist management tools for personal productiv
5774
5776
 
5775
5777
  Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
5776
5778
  `;
5777
- function Ri({
5779
+ function Ra({
5778
5780
  todoistApiKey: e,
5779
5781
  baseUrl: t,
5780
5782
  features: r = []
@@ -5786,9 +5788,9 @@ function Ri({
5786
5788
  tools: { listChanged: !0 },
5787
5789
  prompts: { listChanged: !0 }
5788
5790
  },
5789
- instructions: vi
5791
+ instructions: va
5790
5792
  }
5791
- ), n = new Ft(e, { baseUrl: t }), a = {
5793
+ ), n = new Ft(e, { baseUrl: t }), i = {
5792
5794
  ...sn,
5793
5795
  _meta: {
5794
5796
  ui: {
@@ -5797,56 +5799,56 @@ function Ri({
5797
5799
  }
5798
5800
  };
5799
5801
  ts(o);
5800
- const i = { server: o, client: n, features: r };
5801
- return k({ tool: zr, ...i }), k({ tool: Qr, ...i }), k({ tool: ba, ...i }), k({ tool: Qa, ...i }), k({ tool: da, ...i }), k({ tool: ln, ...i }), k({ tool: a, ...i }), k({ tool: xo, ...i }), k({ tool: Ir, ...i }), k({ tool: Oa, ...i }), k({ tool: Bo, ...i }), k({ tool: Qn, ...i }), k({ tool: sa, ...i }), k({ tool: Rr, ...i }), k({ tool: Ya, ...i }), k({ tool: Zo, ...i }), k({ tool: tr, ...i }), k({ tool: To, ...i }), k({ tool: wa, ...i }), k({ tool: Ar, ...i }), k({ tool: qo, ...i }), k({ tool: Ha, ...i }), k({ tool: Ii, ...i }), k({ tool: hr, ...i }), k({ tool: Po, ...i }), k({ tool: nr, ...i }), k({ tool: lr, ...i }), k({ tool: Ca, ...i }), k({ tool: mo, ...i }), k({ tool: vn, ...i }), k({ tool: Rn, ...i }), k({ tool: Dn, ...i }), k({ tool: Jr, ...i }), k({ tool: Mn, ...i }), k({ tool: Tn, ...i }), k({ tool: ro, ...i }), k({ tool: ao, ...i }), k({ tool: na, ...i }), k({ tool: pi, ...i }), k({ tool: Lo, ...i }), k({ tool: Jn, ...i }), k({ tool: zn, ...i }), k({ tool: ma, ...i }), k({ tool: lo, ...i }), o.registerPrompt(
5802
- ie.name,
5802
+ const a = { server: o, client: n, features: r };
5803
+ return y({ tool: zr, ...a }), y({ tool: Qr, ...a }), y({ tool: bi, ...a }), y({ tool: Qi, ...a }), y({ tool: di, ...a }), y({ tool: ln, ...a }), y({ tool: i, ...a }), y({ tool: xo, ...a }), y({ tool: Ir, ...a }), y({ tool: Oi, ...a }), y({ tool: Bo, ...a }), y({ tool: Qn, ...a }), y({ tool: si, ...a }), y({ tool: Rr, ...a }), y({ tool: Yi, ...a }), y({ tool: Zo, ...a }), y({ tool: tr, ...a }), y({ tool: To, ...a }), y({ tool: wi, ...a }), y({ tool: Ar, ...a }), y({ tool: qo, ...a }), y({ tool: Hi, ...a }), y({ tool: Ia, ...a }), y({ tool: hr, ...a }), y({ tool: Po, ...a }), y({ tool: nr, ...a }), y({ tool: lr, ...a }), y({ tool: Ci, ...a }), y({ tool: mo, ...a }), y({ tool: vn, ...a }), y({ tool: Rn, ...a }), y({ tool: Dn, ...a }), y({ tool: Jr, ...a }), y({ tool: Mn, ...a }), y({ tool: Tn, ...a }), y({ tool: ro, ...a }), y({ tool: io, ...a }), y({ tool: ni, ...a }), y({ tool: pa, ...a }), y({ tool: Lo, ...a }), y({ tool: Jn, ...a }), y({ tool: zn, ...a }), y({ tool: mi, ...a }), y({ tool: lo, ...a }), o.registerPrompt(
5804
+ ae.name,
5803
5805
  {
5804
- title: ie.title,
5805
- description: ie.description,
5806
- argsSchema: ie.argsSchema
5806
+ title: ae.title,
5807
+ description: ae.description,
5808
+ argsSchema: ae.argsSchema
5807
5809
  },
5808
- ie.callback
5810
+ ae.callback
5809
5811
  ), o;
5810
5812
  }
5811
5813
  export {
5812
- Ya as A,
5814
+ Yi as A,
5813
5815
  Rr as B,
5814
5816
  Bo as C,
5815
- Oa as D,
5817
+ Oi as D,
5816
5818
  Ir as E,
5817
- da as F,
5819
+ di as F,
5818
5820
  xo as G,
5819
5821
  sn as H,
5820
5822
  ln as I,
5821
- Qa as J,
5822
- ba as K,
5823
+ Qi as J,
5824
+ bi as K,
5823
5825
  Qr as L,
5824
5826
  zr as M,
5825
- _i as N,
5827
+ _a as N,
5826
5828
  Lo as a,
5827
5829
  Tn as b,
5828
5830
  Mn as c,
5829
5831
  ro as d,
5830
5832
  Jr as e,
5831
5833
  lo as f,
5832
- Ri as g,
5834
+ Ra as g,
5833
5835
  Dn as h,
5834
5836
  Rn as i,
5835
5837
  vn as j,
5836
5838
  mo as k,
5837
5839
  zn as l,
5838
5840
  Jn as m,
5839
- Ca as n,
5841
+ Ci as n,
5840
5842
  lr as o,
5841
5843
  nr as p,
5842
5844
  Po as q,
5843
- na as r,
5844
- ma as s,
5845
+ ni as r,
5846
+ mi as s,
5845
5847
  hr as t,
5846
- pi as u,
5847
- Ii as v,
5848
+ pa as u,
5849
+ Ia as v,
5848
5850
  To as w,
5849
- wa as x,
5851
+ wi as x,
5850
5852
  tr as y,
5851
5853
  Zo as z
5852
5854
  };