@doist/todoist-ai 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -10
- package/dist/index.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-CkfU2tuI.js → mcp-server-CfGS_wEm.js} +405 -366
- package/dist/tool-helpers.d.ts +53 -1
- package/dist/tool-helpers.d.ts.map +1 -1
- package/dist/tools/find-activity.d.ts +2 -2
- package/dist/tools/find-comments.d.ts +2 -2
- package/dist/tools/find-completed-tasks.d.ts +2 -2
- package/dist/tools/find-projects.d.ts.map +1 -1
- package/dist/tools/find-sections.d.ts.map +1 -1
- package/dist/tools/find-tasks-by-date.d.ts +2 -2
- package/dist/tools/find-tasks.d.ts +2 -2
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +3 -1
- package/dist/utils/constants.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getTaskUrl as me, getProjectUrl as fe, TodoistApi as
|
|
2
|
-
import { McpServer as
|
|
1
|
+
import { getTaskUrl as me, getProjectUrl as fe, TodoistApi as Ae } from "@doist/todoist-api-typescript";
|
|
2
|
+
import { McpServer as Ue } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import F, { z as s } from "zod";
|
|
4
|
-
import { addDays as be, formatISO as
|
|
4
|
+
import { addDays as be, formatISO as Pe } from "date-fns";
|
|
5
5
|
function X(e) {
|
|
6
6
|
if (e == null)
|
|
7
7
|
return e;
|
|
@@ -20,13 +20,13 @@ function X(e) {
|
|
|
20
20
|
}
|
|
21
21
|
return e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Ee = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test";
|
|
24
|
+
function Oe({
|
|
25
25
|
textContent: e,
|
|
26
26
|
structuredContent: t
|
|
27
27
|
}) {
|
|
28
28
|
const o = X(t), n = {};
|
|
29
|
-
if (e && (n.content = [{ type: "text", text: e }]), t && (n.structuredContent = o), !
|
|
29
|
+
if (e && (n.content = [{ type: "text", text: e }]), t && (n.structuredContent = o), !Ee && t) {
|
|
30
30
|
const r = JSON.stringify(o);
|
|
31
31
|
n.content || (n.content = []), n.content.push({
|
|
32
32
|
type: "text",
|
|
@@ -36,7 +36,7 @@ function Pe({
|
|
|
36
36
|
}
|
|
37
37
|
return n;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function _e(e) {
|
|
40
40
|
return {
|
|
41
41
|
content: [{ type: "text", text: e }],
|
|
42
42
|
isError: !0
|
|
@@ -49,11 +49,11 @@ function I(e, t, o) {
|
|
|
49
49
|
r,
|
|
50
50
|
o
|
|
51
51
|
);
|
|
52
|
-
return
|
|
52
|
+
return Oe({ textContent: c, structuredContent: a });
|
|
53
53
|
} catch (c) {
|
|
54
54
|
console.error(`Error executing tool ${e.name}:`, { args: r, error: c });
|
|
55
55
|
const a = c instanceof Error ? c.message : "An unknown error occurred";
|
|
56
|
-
return
|
|
56
|
+
return _e(a);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
t.registerTool(
|
|
@@ -66,6 +66,35 @@ function I(e, t, o) {
|
|
|
66
66
|
n
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
+
const S = {
|
|
70
|
+
/** Default limit for task listings */
|
|
71
|
+
TASKS_DEFAULT: 10,
|
|
72
|
+
/** Maximum limit for task search and list operations */
|
|
73
|
+
TASKS_MAX: 100,
|
|
74
|
+
/** Default limit for completed tasks */
|
|
75
|
+
COMPLETED_TASKS_DEFAULT: 50,
|
|
76
|
+
/** Maximum limit for completed tasks */
|
|
77
|
+
COMPLETED_TASKS_MAX: 200,
|
|
78
|
+
/** Default limit for project listings */
|
|
79
|
+
PROJECTS_DEFAULT: 50,
|
|
80
|
+
/** Maximum limit for project listings */
|
|
81
|
+
PROJECTS_MAX: 200,
|
|
82
|
+
/** Maximum limit for section listings */
|
|
83
|
+
SECTIONS_MAX: 200,
|
|
84
|
+
/** Batch size for fetching all tasks in a project */
|
|
85
|
+
TASKS_BATCH_SIZE: 50,
|
|
86
|
+
/** Default limit for comment listings */
|
|
87
|
+
COMMENTS_DEFAULT: 10,
|
|
88
|
+
/** Maximum limit for comment search and list operations */
|
|
89
|
+
COMMENTS_MAX: 10,
|
|
90
|
+
/** Default limit for activity log listings */
|
|
91
|
+
ACTIVITY_DEFAULT: 20,
|
|
92
|
+
/** Maximum limit for activity log search and list operations */
|
|
93
|
+
ACTIVITY_MAX: 100
|
|
94
|
+
}, G = {
|
|
95
|
+
/** Maximum number of failures to show in detailed error messages */
|
|
96
|
+
MAX_FAILURES_SHOWN: 3
|
|
97
|
+
};
|
|
69
98
|
class U extends Error {
|
|
70
99
|
constructor(t, o) {
|
|
71
100
|
super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
|
|
@@ -105,22 +134,22 @@ function ge(e) {
|
|
|
105
134
|
throw new U(e, "Duration cannot exceed 24 hours (1440 minutes)");
|
|
106
135
|
return { minutes: n };
|
|
107
136
|
}
|
|
108
|
-
function
|
|
137
|
+
function Ne(e) {
|
|
109
138
|
if (e <= 0) return "0m";
|
|
110
139
|
const t = Math.floor(e / 60), o = e % 60;
|
|
111
140
|
return t === 0 ? `${o}m` : o === 0 ? `${t}h` : `${t}h${o}m`;
|
|
112
141
|
}
|
|
113
|
-
const
|
|
142
|
+
const Me = ["p1", "p2", "p3", "p4"], Q = s.enum(Me, {
|
|
114
143
|
description: "Task priority: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)"
|
|
115
144
|
});
|
|
116
145
|
function Te(e) {
|
|
117
146
|
return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
|
|
118
147
|
}
|
|
119
|
-
function
|
|
148
|
+
function Fe(e) {
|
|
120
149
|
return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
|
|
121
150
|
}
|
|
122
|
-
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(),
|
|
123
|
-
class
|
|
151
|
+
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), q = 300 * 1e3;
|
|
152
|
+
class Re {
|
|
124
153
|
/**
|
|
125
154
|
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
126
155
|
* Supports exact name matches, partial matches, and email matches.
|
|
@@ -129,7 +158,7 @@ class Me {
|
|
|
129
158
|
if (!o || o.trim().length === 0)
|
|
130
159
|
return null;
|
|
131
160
|
const n = o.trim(), r = A.get(n);
|
|
132
|
-
if (r && Date.now() - r.timestamp <
|
|
161
|
+
if (r && Date.now() - r.timestamp < q)
|
|
133
162
|
return r.result;
|
|
134
163
|
if (/^[0-9]+$/.test(n) || /^[a-f0-9-]{8,}$/i.test(n) && n.includes("-") || /^[a-z0-9_]{6,}$/i.test(n) && !/^[a-z]+[\s-]/.test(n) && /[0-9_]/.test(n)) {
|
|
135
164
|
const i = { userId: n, displayName: n, email: n };
|
|
@@ -178,7 +207,7 @@ class Me {
|
|
|
178
207
|
*/
|
|
179
208
|
async getProjectCollaborators(t, o) {
|
|
180
209
|
const n = `project_${o}`, r = R.get(n);
|
|
181
|
-
if (r && Date.now() - r.timestamp <
|
|
210
|
+
if (r && Date.now() - r.timestamp < q)
|
|
182
211
|
return r.result;
|
|
183
212
|
try {
|
|
184
213
|
const i = await t.getProjectCollaborators(o), a = (Array.isArray(i) ? i : i.results || []).filter((d) => d?.id && d.name && d.email);
|
|
@@ -195,7 +224,7 @@ class Me {
|
|
|
195
224
|
*/
|
|
196
225
|
async getAllCollaborators(t) {
|
|
197
226
|
const o = "all_collaborators", n = R.get(o);
|
|
198
|
-
if (n && Date.now() - n.timestamp <
|
|
227
|
+
if (n && Date.now() - n.timestamp < q)
|
|
199
228
|
return n.result;
|
|
200
229
|
try {
|
|
201
230
|
const { results: r } = await t.getProjects({}), i = r.filter((u) => u.isShared);
|
|
@@ -225,15 +254,15 @@ class Me {
|
|
|
225
254
|
A.clear(), R.clear();
|
|
226
255
|
}
|
|
227
256
|
}
|
|
228
|
-
const _ = new
|
|
229
|
-
async function
|
|
257
|
+
const _ = new Re();
|
|
258
|
+
async function Le(e, t) {
|
|
230
259
|
return _.resolveUser(e, t);
|
|
231
260
|
}
|
|
232
261
|
const ye = ["assigned", "unassignedOrMe", "all"];
|
|
233
262
|
async function ee(e, t) {
|
|
234
263
|
if (!t)
|
|
235
264
|
return;
|
|
236
|
-
const o = await
|
|
265
|
+
const o = await Le(e, t);
|
|
237
266
|
if (!o)
|
|
238
267
|
throw new Error(
|
|
239
268
|
`Could not find user: "${t}". Make sure the user is a collaborator on a shared project.`
|
|
@@ -243,7 +272,7 @@ async function ee(e, t) {
|
|
|
243
272
|
function K(e, t) {
|
|
244
273
|
return t.length === 0 ? e : e.length === 0 ? t : `${e} & ${t}`;
|
|
245
274
|
}
|
|
246
|
-
function
|
|
275
|
+
function Be({
|
|
247
276
|
resolvedAssigneeId: e,
|
|
248
277
|
assigneeEmail: t,
|
|
249
278
|
responsibleUserFiltering: o = "unassignedOrMe"
|
|
@@ -261,7 +290,33 @@ function de({
|
|
|
261
290
|
function B(e) {
|
|
262
291
|
return "inboxProject" in e;
|
|
263
292
|
}
|
|
264
|
-
function
|
|
293
|
+
async function Ie(e) {
|
|
294
|
+
const { apiMethod: t, args: o, limit: n = 100 } = e, r = [];
|
|
295
|
+
let i = null;
|
|
296
|
+
do {
|
|
297
|
+
const c = await t({
|
|
298
|
+
...o,
|
|
299
|
+
cursor: i,
|
|
300
|
+
limit: n
|
|
301
|
+
});
|
|
302
|
+
r.push(...c.results), i = c.nextCursor ?? null;
|
|
303
|
+
} while (i !== null);
|
|
304
|
+
return r;
|
|
305
|
+
}
|
|
306
|
+
async function ke(e) {
|
|
307
|
+
return Ie({
|
|
308
|
+
apiMethod: (t) => e.getProjects(t),
|
|
309
|
+
limit: S.PROJECTS_MAX
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
async function We(e, t) {
|
|
313
|
+
return Ie({
|
|
314
|
+
apiMethod: (o) => e.getSections(o),
|
|
315
|
+
args: t ? { projectId: t } : {},
|
|
316
|
+
limit: S.SECTIONS_MAX
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function Ye(e, t, o, n) {
|
|
265
320
|
const r = [t, o, n].filter(Boolean);
|
|
266
321
|
if (r.length > 1)
|
|
267
322
|
throw new Error(
|
|
@@ -284,19 +339,19 @@ function O(e) {
|
|
|
284
339
|
dueDate: e.due?.date,
|
|
285
340
|
recurring: e.due?.isRecurring && e.due.string ? e.due.string : !1,
|
|
286
341
|
deadlineDate: e.deadline?.date,
|
|
287
|
-
priority:
|
|
342
|
+
priority: Fe(e.priority) ?? "p4",
|
|
288
343
|
projectId: e.projectId,
|
|
289
344
|
sectionId: e.sectionId ?? void 0,
|
|
290
345
|
parentId: e.parentId ?? void 0,
|
|
291
346
|
labels: e.labels,
|
|
292
|
-
duration: e.duration ?
|
|
347
|
+
duration: e.duration ? Ne(e.duration.amount) : void 0,
|
|
293
348
|
responsibleUid: e.responsibleUid ?? void 0,
|
|
294
349
|
assignedByUid: e.assignedByUid ?? void 0,
|
|
295
350
|
checked: e.checked,
|
|
296
351
|
completedAt: e.completedAt ?? void 0
|
|
297
352
|
};
|
|
298
353
|
}
|
|
299
|
-
function
|
|
354
|
+
function we(e) {
|
|
300
355
|
return {
|
|
301
356
|
id: e.id,
|
|
302
357
|
name: e.name,
|
|
@@ -332,7 +387,7 @@ function te(e) {
|
|
|
332
387
|
} : void 0
|
|
333
388
|
};
|
|
334
389
|
}
|
|
335
|
-
function
|
|
390
|
+
function ze(e) {
|
|
336
391
|
return {
|
|
337
392
|
id: e.id ?? void 0,
|
|
338
393
|
objectType: e.objectType,
|
|
@@ -345,7 +400,7 @@ function Be(e) {
|
|
|
345
400
|
extraData: e.extraData ?? void 0
|
|
346
401
|
};
|
|
347
402
|
}
|
|
348
|
-
const
|
|
403
|
+
const Ke = F.object({
|
|
349
404
|
httpStatusCode: F.number(),
|
|
350
405
|
responseData: F.object({
|
|
351
406
|
error: F.string(),
|
|
@@ -363,7 +418,7 @@ async function se({
|
|
|
363
418
|
const { results: r, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: n, limit: o });
|
|
364
419
|
return { tasks: r.map(O), nextCursor: i };
|
|
365
420
|
} catch (r) {
|
|
366
|
-
const i =
|
|
421
|
+
const i = Ke.safeParse(r);
|
|
367
422
|
if (!i.success)
|
|
368
423
|
throw r;
|
|
369
424
|
const { responseData: c } = i.data;
|
|
@@ -403,7 +458,7 @@ const W = s.object({
|
|
|
403
458
|
}), ne = s.object({
|
|
404
459
|
id: s.string().describe("The unique ID of the section."),
|
|
405
460
|
name: s.string().describe("The name of the section.")
|
|
406
|
-
}),
|
|
461
|
+
}), He = s.object({
|
|
407
462
|
resourceType: s.string().describe("The type of resource (file, url, image, etc)."),
|
|
408
463
|
fileName: s.string().optional().describe("The name of the file."),
|
|
409
464
|
fileSize: s.number().optional().describe("The size of the file in bytes."),
|
|
@@ -423,8 +478,8 @@ const W = s.object({
|
|
|
423
478
|
content: s.string().describe("The content of the comment."),
|
|
424
479
|
postedAt: s.string().describe("When the comment was posted (ISO 8601 format)."),
|
|
425
480
|
postedUid: s.string().optional().describe("The UID of the user who posted this comment."),
|
|
426
|
-
fileAttachment:
|
|
427
|
-
}),
|
|
481
|
+
fileAttachment: He.optional().describe("File attachment information, if any.")
|
|
482
|
+
}), Ve = s.object({
|
|
428
483
|
id: s.string().optional().describe("The unique ID of the activity event."),
|
|
429
484
|
objectType: s.string().describe("The type of object this event relates to (task, project, etc)."),
|
|
430
485
|
objectId: s.string().describe("The ID of the object this event relates to."),
|
|
@@ -434,11 +489,11 @@ const W = s.object({
|
|
|
434
489
|
parentItemId: s.string().optional().describe("The ID of the parent item."),
|
|
435
490
|
initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
|
|
436
491
|
extraData: s.record(s.unknown()).optional().describe("Additional event data.")
|
|
437
|
-
}),
|
|
492
|
+
}), Ge = s.object({
|
|
438
493
|
id: s.string().describe("The unique ID of the user."),
|
|
439
494
|
name: s.string().describe("The full name of the user."),
|
|
440
495
|
email: s.string().describe("The email address of the user.")
|
|
441
|
-
}),
|
|
496
|
+
}), qe = s.object({
|
|
442
497
|
item: s.string().describe("The item that failed (usually an ID or identifier)."),
|
|
443
498
|
error: s.string().describe("The error message."),
|
|
444
499
|
code: s.string().optional().describe("The error code, if available.")
|
|
@@ -474,23 +529,23 @@ const W = s.object({
|
|
|
474
529
|
// OpenAI MCP tools
|
|
475
530
|
SEARCH: "search",
|
|
476
531
|
FETCH: "fetch"
|
|
477
|
-
},
|
|
532
|
+
}, Je = s.object({
|
|
478
533
|
taskId: s.string().optional().describe("The ID of the task to comment on."),
|
|
479
534
|
projectId: s.string().optional().describe(
|
|
480
535
|
'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
481
536
|
),
|
|
482
537
|
content: s.string().min(1).describe("The content of the comment.")
|
|
483
|
-
}),
|
|
484
|
-
comments: s.array(
|
|
485
|
-
},
|
|
538
|
+
}), Xe = {
|
|
539
|
+
comments: s.array(Je).min(1).describe("The array of comments to add.")
|
|
540
|
+
}, Ze = {
|
|
486
541
|
comments: s.array(re).describe("The created comments."),
|
|
487
542
|
totalCount: s.number().describe("The total number of comments created."),
|
|
488
543
|
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
489
|
-
},
|
|
544
|
+
}, Qe = {
|
|
490
545
|
name: g.ADD_COMMENTS,
|
|
491
546
|
description: "Add multiple comments to tasks or projects. Each comment must specify either taskId or projectId.",
|
|
492
|
-
parameters:
|
|
493
|
-
outputSchema:
|
|
547
|
+
parameters: Xe,
|
|
548
|
+
outputSchema: Ze,
|
|
494
549
|
async execute(e, t) {
|
|
495
550
|
const { comments: o } = e;
|
|
496
551
|
for (const [l, u] of o.entries()) {
|
|
@@ -511,7 +566,7 @@ const W = s.object({
|
|
|
511
566
|
});
|
|
512
567
|
}), a = (await Promise.all(i)).map(te);
|
|
513
568
|
return {
|
|
514
|
-
textContent:
|
|
569
|
+
textContent: et({ comments: a }),
|
|
515
570
|
structuredContent: {
|
|
516
571
|
comments: a,
|
|
517
572
|
totalCount: a.length,
|
|
@@ -520,7 +575,7 @@ const W = s.object({
|
|
|
520
575
|
};
|
|
521
576
|
}
|
|
522
577
|
};
|
|
523
|
-
function
|
|
578
|
+
function et({ comments: e }) {
|
|
524
579
|
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
525
580
|
if (t > 0) {
|
|
526
581
|
const i = t > 1 ? "comments" : "comment";
|
|
@@ -532,23 +587,23 @@ function Xe({ comments: e }) {
|
|
|
532
587
|
}
|
|
533
588
|
return n.length > 0 ? `Added ${n.join(" and ")}` : "No comments added";
|
|
534
589
|
}
|
|
535
|
-
const
|
|
590
|
+
const tt = s.object({
|
|
536
591
|
name: s.string().min(1).describe("The name of the project."),
|
|
537
592
|
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
538
593
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
539
594
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe('The project view style. Defaults to "list".')
|
|
540
|
-
}),
|
|
541
|
-
projects: s.array(
|
|
542
|
-
},
|
|
595
|
+
}), st = {
|
|
596
|
+
projects: s.array(tt).min(1).describe("The array of projects to add.")
|
|
597
|
+
}, ot = {
|
|
543
598
|
projects: s.array(oe).describe("The created projects."),
|
|
544
599
|
totalCount: s.number().describe("The total number of projects created.")
|
|
545
|
-
},
|
|
600
|
+
}, nt = {
|
|
546
601
|
name: g.ADD_PROJECTS,
|
|
547
602
|
description: "Add one or more new projects.",
|
|
548
|
-
parameters:
|
|
549
|
-
outputSchema:
|
|
603
|
+
parameters: st,
|
|
604
|
+
outputSchema: ot,
|
|
550
605
|
async execute({ projects: e }, t) {
|
|
551
|
-
const o = await Promise.all(e.map((i) => t.addProject(i))), n =
|
|
606
|
+
const o = await Promise.all(e.map((i) => t.addProject(i))), n = rt({ projects: o }), r = o.map((i) => ({
|
|
552
607
|
...i,
|
|
553
608
|
parentId: "parentId" in i ? i.parentId ?? void 0 : void 0,
|
|
554
609
|
inboxProject: "inboxProject" in i ? i.inboxProject : !1
|
|
@@ -562,27 +617,27 @@ const Ze = s.object({
|
|
|
562
617
|
};
|
|
563
618
|
}
|
|
564
619
|
};
|
|
565
|
-
function
|
|
620
|
+
function rt({ projects: e }) {
|
|
566
621
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id})`).join(`
|
|
567
622
|
`);
|
|
568
623
|
return `Added ${t} project${t === 1 ? "" : "s"}:
|
|
569
624
|
${o}`;
|
|
570
625
|
}
|
|
571
|
-
const
|
|
626
|
+
const it = s.object({
|
|
572
627
|
name: s.string().min(1).describe("The name of the section."),
|
|
573
628
|
projectId: s.string().min(1).describe(
|
|
574
629
|
'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
575
630
|
)
|
|
576
|
-
}),
|
|
577
|
-
sections: s.array(
|
|
578
|
-
},
|
|
631
|
+
}), at = {
|
|
632
|
+
sections: s.array(it).min(1).describe("The array of sections to add.")
|
|
633
|
+
}, ct = {
|
|
579
634
|
sections: s.array(ne).describe("The created sections."),
|
|
580
635
|
totalCount: s.number().describe("The total number of sections created.")
|
|
581
|
-
},
|
|
636
|
+
}, dt = {
|
|
582
637
|
name: g.ADD_SECTIONS,
|
|
583
638
|
description: "Add one or more new sections to projects.",
|
|
584
|
-
parameters:
|
|
585
|
-
outputSchema:
|
|
639
|
+
parameters: at,
|
|
640
|
+
outputSchema: ct,
|
|
586
641
|
async execute({ sections: e }, t) {
|
|
587
642
|
const n = e.some((a) => a.projectId === "inbox") ? await t.getUser() : null, r = e.map((a) => ({
|
|
588
643
|
...a,
|
|
@@ -591,7 +646,7 @@ const ot = s.object({
|
|
|
591
646
|
r.map((a) => t.addSection(a))
|
|
592
647
|
);
|
|
593
648
|
return {
|
|
594
|
-
textContent:
|
|
649
|
+
textContent: lt({ sections: i }),
|
|
595
650
|
structuredContent: {
|
|
596
651
|
sections: i,
|
|
597
652
|
totalCount: i.length
|
|
@@ -599,7 +654,7 @@ const ot = s.object({
|
|
|
599
654
|
};
|
|
600
655
|
}
|
|
601
656
|
};
|
|
602
|
-
function
|
|
657
|
+
function lt({ sections: e }) {
|
|
603
658
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
604
659
|
`);
|
|
605
660
|
return `Added ${t} section${t === 1 ? "" : "s"}:
|
|
@@ -614,7 +669,7 @@ const L = {
|
|
|
614
669
|
PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
|
|
615
670
|
TASK_NOT_FOUND: "TASK_NOT_FOUND"
|
|
616
671
|
};
|
|
617
|
-
class
|
|
672
|
+
class ut {
|
|
618
673
|
/**
|
|
619
674
|
* Validate a single assignment operation
|
|
620
675
|
*/
|
|
@@ -823,37 +878,11 @@ class ct {
|
|
|
823
878
|
};
|
|
824
879
|
}
|
|
825
880
|
}
|
|
826
|
-
const ie = new
|
|
827
|
-
|
|
828
|
-
TASKS_DEFAULT: 10,
|
|
829
|
-
/** Maximum limit for task search and list operations */
|
|
830
|
-
TASKS_MAX: 100,
|
|
831
|
-
/** Default limit for completed tasks */
|
|
832
|
-
COMPLETED_TASKS_DEFAULT: 50,
|
|
833
|
-
/** Maximum limit for completed tasks */
|
|
834
|
-
COMPLETED_TASKS_MAX: 200,
|
|
835
|
-
/** Default limit for project listings */
|
|
836
|
-
PROJECTS_DEFAULT: 50,
|
|
837
|
-
/** Maximum limit for project listings */
|
|
838
|
-
PROJECTS_MAX: 100,
|
|
839
|
-
/** Batch size for fetching all tasks in a project */
|
|
840
|
-
TASKS_BATCH_SIZE: 50,
|
|
841
|
-
/** Default limit for comment listings */
|
|
842
|
-
COMMENTS_DEFAULT: 10,
|
|
843
|
-
/** Maximum limit for comment search and list operations */
|
|
844
|
-
COMMENTS_MAX: 10,
|
|
845
|
-
/** Default limit for activity log listings */
|
|
846
|
-
ACTIVITY_DEFAULT: 20,
|
|
847
|
-
/** Maximum limit for activity log search and list operations */
|
|
848
|
-
ACTIVITY_MAX: 100
|
|
849
|
-
}, q = {
|
|
850
|
-
/** Maximum number of failures to show in detailed error messages */
|
|
851
|
-
MAX_FAILURES_SHOWN: 3
|
|
852
|
-
};
|
|
853
|
-
function dt(e = /* @__PURE__ */ new Date()) {
|
|
881
|
+
const ie = new ut();
|
|
882
|
+
function pt(e = /* @__PURE__ */ new Date()) {
|
|
854
883
|
return e.toISOString().split("T")[0] ?? "";
|
|
855
884
|
}
|
|
856
|
-
function
|
|
885
|
+
function je(e, t, o = {}) {
|
|
857
886
|
const { context: n, showDetails: r = !1 } = o, i = t.length, c = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${n ? ` ${n}` : ""}.`;
|
|
858
887
|
c.push(d);
|
|
859
888
|
const l = 5;
|
|
@@ -868,31 +897,31 @@ ${u}${p}.`);
|
|
|
868
897
|
return c.join(`
|
|
869
898
|
`);
|
|
870
899
|
}
|
|
871
|
-
function
|
|
900
|
+
function ht(e) {
|
|
872
901
|
const { action: t, success: o, total: n, successItems: r, failures: i } = e, c = [], a = `${t}: ${o}/${n} successful.`;
|
|
873
902
|
if (c.push(a), r?.length && r.length <= 5 && c.push(`Completed:
|
|
874
903
|
${r.map((d) => ` ${d}`).join(`
|
|
875
904
|
`)}.`), i?.length) {
|
|
876
905
|
const d = i.length, l = `Failed (${d}):
|
|
877
|
-
${i.slice(0,
|
|
906
|
+
${i.slice(0, G.MAX_FAILURES_SHOWN).map((u) => ` ${u.item} (Error: ${u.error}${u.code ? ` [${u.code}]` : ""})`).join(
|
|
878
907
|
`
|
|
879
908
|
`
|
|
880
|
-
)}${d >
|
|
909
|
+
)}${d > G.MAX_FAILURES_SHOWN ? `, +${d - G.MAX_FAILURES_SHOWN} more` : ""}.`;
|
|
881
910
|
c.push(l);
|
|
882
911
|
}
|
|
883
912
|
return c.join(`
|
|
884
913
|
`);
|
|
885
914
|
}
|
|
886
|
-
function
|
|
915
|
+
function mt(e) {
|
|
887
916
|
const t = e.content || e.title || "Untitled", o = e.dueDate ? ` • due ${e.dueDate}` : "", n = e.priority ? ` • ${e.priority.toUpperCase()}` : "", r = e.projectName ? ` • ${e.projectName}` : "", i = e.id ? ` • id=${e.id}` : "";
|
|
888
917
|
return ` ${t}${o}${n}${r}${i}`;
|
|
889
918
|
}
|
|
890
|
-
function
|
|
919
|
+
function ft(e) {
|
|
891
920
|
const t = e.inboxProject ? " • Inbox" : "", o = e.isFavorite ? " • ⭐" : "", n = e.isShared ? " • Shared" : "", r = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
|
|
892
921
|
return ` ${e.name}${t}${o}${n}${r}${i}`;
|
|
893
922
|
}
|
|
894
923
|
function H(e, t = 5) {
|
|
895
|
-
const n = e.slice(0, t).map(
|
|
924
|
+
const n = e.slice(0, t).map(mt).join(`
|
|
896
925
|
`);
|
|
897
926
|
if (e.length > t) {
|
|
898
927
|
const r = e.length - t;
|
|
@@ -913,16 +942,16 @@ function N({
|
|
|
913
942
|
}) {
|
|
914
943
|
const d = [], l = `${e}: ${t}${typeof o == "number" ? ` (limit ${o})` : ""}${n ? ", more available" : ""}.`;
|
|
915
944
|
return d.push(l), r?.length && d.push(`Filter: ${r.join("; ")}.`), i?.length && d.push(`Preview:
|
|
916
|
-
${i}`), !t && c?.length && d.push(`No results. ${c.join("; ")}.`), (a?.length || n) && d.push(
|
|
945
|
+
${i}`), !t && c?.length && d.push(`No results. ${c.join("; ")}.`), (a?.length || n) && d.push(ve(a || [], n)), d.join(`
|
|
917
946
|
`);
|
|
918
947
|
}
|
|
919
|
-
function
|
|
948
|
+
function ve(e, t) {
|
|
920
949
|
const o = [...e];
|
|
921
950
|
return t && o.push(`Pass cursor '${t}' to fetch more results.`), `${o.length === 1 ? "Possible suggested next step:" : "Possible suggested next steps:"}
|
|
922
951
|
${o.map((r) => `- ${r}`).join(`
|
|
923
952
|
`)}`;
|
|
924
953
|
}
|
|
925
|
-
const
|
|
954
|
+
const bt = s.object({
|
|
926
955
|
content: s.string().min(1).describe(
|
|
927
956
|
'The task name/title. Should be concise and actionable (e.g., "Review PR #123", "Call dentist"). For longer content, use the description field instead. Supports Markdown.'
|
|
928
957
|
),
|
|
@@ -948,20 +977,20 @@ const ht = s.object({
|
|
|
948
977
|
responsibleUser: s.string().optional().describe(
|
|
949
978
|
"Assign task to this user. Can be a user ID, name, or email address. User must be a collaborator on the target project."
|
|
950
979
|
)
|
|
951
|
-
}),
|
|
952
|
-
tasks: s.array(
|
|
953
|
-
},
|
|
980
|
+
}), gt = {
|
|
981
|
+
tasks: s.array(bt).min(1).describe("The array of tasks to add.")
|
|
982
|
+
}, Tt = {
|
|
954
983
|
tasks: s.array(W).describe("The created tasks."),
|
|
955
984
|
totalCount: s.number().describe("The total number of tasks created.")
|
|
956
|
-
},
|
|
985
|
+
}, yt = {
|
|
957
986
|
name: g.ADD_TASKS,
|
|
958
987
|
description: "Add one or more tasks to a project, section, or parent. Supports assignment to project collaborators.",
|
|
959
|
-
parameters:
|
|
960
|
-
outputSchema:
|
|
988
|
+
parameters: gt,
|
|
989
|
+
outputSchema: Tt,
|
|
961
990
|
async execute({ tasks: e }, t) {
|
|
962
|
-
const o = e.map((c) =>
|
|
991
|
+
const o = e.map((c) => It(c, t)), r = (await Promise.all(o)).map(O);
|
|
963
992
|
return {
|
|
964
|
-
textContent:
|
|
993
|
+
textContent: kt({
|
|
965
994
|
tasks: r,
|
|
966
995
|
args: { tasks: e }
|
|
967
996
|
}),
|
|
@@ -972,7 +1001,7 @@ const ht = s.object({
|
|
|
972
1001
|
};
|
|
973
1002
|
}
|
|
974
1003
|
};
|
|
975
|
-
async function
|
|
1004
|
+
async function It(e, t) {
|
|
976
1005
|
const {
|
|
977
1006
|
duration: o,
|
|
978
1007
|
projectId: n,
|
|
@@ -1040,7 +1069,7 @@ async function gt(e, t) {
|
|
|
1040
1069
|
}
|
|
1041
1070
|
return await t.addTask(b);
|
|
1042
1071
|
}
|
|
1043
|
-
function
|
|
1072
|
+
function kt({
|
|
1044
1073
|
tasks: e,
|
|
1045
1074
|
args: t
|
|
1046
1075
|
}) {
|
|
@@ -1052,24 +1081,24 @@ function Tt({
|
|
|
1052
1081
|
const r = Array.from(o)[0];
|
|
1053
1082
|
n = r === "inbox" ? "" : `to ${r}`;
|
|
1054
1083
|
} else o.size > 1 && (n = "to multiple contexts");
|
|
1055
|
-
return
|
|
1084
|
+
return je("Added", e, {
|
|
1056
1085
|
context: n,
|
|
1057
1086
|
showDetails: !0
|
|
1058
1087
|
});
|
|
1059
1088
|
}
|
|
1060
|
-
const
|
|
1089
|
+
const wt = {
|
|
1061
1090
|
ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to complete.")
|
|
1062
|
-
},
|
|
1091
|
+
}, jt = {
|
|
1063
1092
|
completed: s.array(s.string()).describe("The IDs of successfully completed tasks."),
|
|
1064
|
-
failures: s.array(
|
|
1093
|
+
failures: s.array(qe).describe("Failed task completions with error details."),
|
|
1065
1094
|
totalRequested: s.number().describe("The total number of tasks requested to complete."),
|
|
1066
1095
|
successCount: s.number().describe("The number of successfully completed tasks."),
|
|
1067
1096
|
failureCount: s.number().describe("The number of failed task completions.")
|
|
1068
|
-
},
|
|
1097
|
+
}, vt = {
|
|
1069
1098
|
name: g.COMPLETE_TASKS,
|
|
1070
1099
|
description: "Complete one or more tasks by their IDs.",
|
|
1071
|
-
parameters:
|
|
1072
|
-
outputSchema:
|
|
1100
|
+
parameters: wt,
|
|
1101
|
+
outputSchema: jt,
|
|
1073
1102
|
async execute(e, t) {
|
|
1074
1103
|
const o = [], n = [];
|
|
1075
1104
|
for (const i of e.ids)
|
|
@@ -1083,7 +1112,7 @@ const yt = {
|
|
|
1083
1112
|
});
|
|
1084
1113
|
}
|
|
1085
1114
|
return {
|
|
1086
|
-
textContent:
|
|
1115
|
+
textContent: Ct({
|
|
1087
1116
|
completed: o,
|
|
1088
1117
|
failures: n,
|
|
1089
1118
|
args: e
|
|
@@ -1098,12 +1127,12 @@ const yt = {
|
|
|
1098
1127
|
};
|
|
1099
1128
|
}
|
|
1100
1129
|
};
|
|
1101
|
-
function
|
|
1130
|
+
function Ct({
|
|
1102
1131
|
completed: e,
|
|
1103
1132
|
failures: t,
|
|
1104
1133
|
args: o
|
|
1105
1134
|
}) {
|
|
1106
|
-
return
|
|
1135
|
+
return ht({
|
|
1107
1136
|
action: "Completed tasks",
|
|
1108
1137
|
success: e.length,
|
|
1109
1138
|
total: o.ids.length,
|
|
@@ -1111,20 +1140,20 @@ function wt({
|
|
|
1111
1140
|
failures: t
|
|
1112
1141
|
});
|
|
1113
1142
|
}
|
|
1114
|
-
const
|
|
1143
|
+
const St = {
|
|
1115
1144
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of entity to delete."),
|
|
1116
1145
|
id: s.string().min(1).describe("The ID of the entity to delete.")
|
|
1117
|
-
},
|
|
1146
|
+
}, $t = {
|
|
1118
1147
|
deletedEntity: s.object({
|
|
1119
1148
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of deleted entity."),
|
|
1120
1149
|
id: s.string().describe("The ID of the deleted entity.")
|
|
1121
1150
|
}).describe("Information about the deleted entity."),
|
|
1122
1151
|
success: s.boolean().describe("Whether the deletion was successful.")
|
|
1123
|
-
},
|
|
1152
|
+
}, Dt = {
|
|
1124
1153
|
name: g.DELETE_OBJECT,
|
|
1125
1154
|
description: "Delete a project, section, task, or comment by its ID.",
|
|
1126
|
-
parameters:
|
|
1127
|
-
outputSchema:
|
|
1155
|
+
parameters: St,
|
|
1156
|
+
outputSchema: $t,
|
|
1128
1157
|
async execute(e, t) {
|
|
1129
1158
|
switch (e.type) {
|
|
1130
1159
|
case "project":
|
|
@@ -1148,21 +1177,21 @@ const jt = {
|
|
|
1148
1177
|
}
|
|
1149
1178
|
};
|
|
1150
1179
|
}
|
|
1151
|
-
},
|
|
1180
|
+
}, xt = {
|
|
1152
1181
|
id: s.string().min(1).describe(
|
|
1153
1182
|
'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
|
|
1154
1183
|
)
|
|
1155
|
-
},
|
|
1184
|
+
}, At = {
|
|
1156
1185
|
id: s.string().describe("The ID of the fetched document."),
|
|
1157
1186
|
title: s.string().describe("The title of the document."),
|
|
1158
1187
|
text: s.string().describe("The text content of the document."),
|
|
1159
1188
|
url: s.string().describe("The URL of the document."),
|
|
1160
1189
|
metadata: s.record(s.unknown()).optional().describe("Additional metadata about the document.")
|
|
1161
|
-
},
|
|
1190
|
+
}, Ut = {
|
|
1162
1191
|
name: g.FETCH,
|
|
1163
1192
|
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}".',
|
|
1164
|
-
parameters:
|
|
1165
|
-
outputSchema:
|
|
1193
|
+
parameters: xt,
|
|
1194
|
+
outputSchema: At,
|
|
1166
1195
|
async execute(e, t) {
|
|
1167
1196
|
const { id: o } = e, [n, r] = o.split(":", 2);
|
|
1168
1197
|
if (!r || n !== "task" && n !== "project")
|
|
@@ -1195,7 +1224,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1195
1224
|
}
|
|
1196
1225
|
};
|
|
1197
1226
|
} else {
|
|
1198
|
-
const c = await t.getProject(r), a =
|
|
1227
|
+
const c = await t.getProject(r), a = we(c), d = [a.name];
|
|
1199
1228
|
a.isShared && d.push(`
|
|
1200
1229
|
|
|
1201
1230
|
Shared project`), a.isFavorite && d.push(`
|
|
@@ -1216,7 +1245,7 @@ Favorite: Yes`), i = {
|
|
|
1216
1245
|
}
|
|
1217
1246
|
return { textContent: JSON.stringify(i) };
|
|
1218
1247
|
}
|
|
1219
|
-
},
|
|
1248
|
+
}, Pt = {
|
|
1220
1249
|
objectType: s.enum(["task", "project", "comment"]).optional().describe("Type of object to filter by."),
|
|
1221
1250
|
objectId: s.string().optional().describe("Filter by specific object ID (task, project, or comment)."),
|
|
1222
1251
|
eventType: s.enum([
|
|
@@ -1233,28 +1262,28 @@ Favorite: Yes`), i = {
|
|
|
1233
1262
|
projectId: s.string().optional().describe("Filter events by parent project ID."),
|
|
1234
1263
|
taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
|
|
1235
1264
|
initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
|
|
1236
|
-
limit: s.number().int().min(1).max(
|
|
1265
|
+
limit: s.number().int().min(1).max(S.ACTIVITY_MAX).default(S.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
1237
1266
|
cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
1238
|
-
},
|
|
1239
|
-
events: s.array(
|
|
1267
|
+
}, Et = {
|
|
1268
|
+
events: s.array(Ve).describe("The activity events."),
|
|
1240
1269
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1241
1270
|
totalCount: s.number().describe("The total number of events in this page."),
|
|
1242
1271
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1243
1272
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1244
|
-
},
|
|
1273
|
+
}, Ot = {
|
|
1245
1274
|
name: g.FIND_ACTIVITY,
|
|
1246
1275
|
description: "Retrieve recent activity logs to monitor and audit changes in Todoist. Shows events from all users by default (use initiatorId to filter by specific user). Track task completions, updates, deletions, project changes, and more with flexible filtering. Note: Date-based filtering is not supported by the Todoist API.",
|
|
1247
|
-
parameters:
|
|
1248
|
-
outputSchema:
|
|
1276
|
+
parameters: Pt,
|
|
1277
|
+
outputSchema: Et,
|
|
1249
1278
|
async execute(e, t) {
|
|
1250
1279
|
const { objectType: o, objectId: n, eventType: r, projectId: i, taskId: c, initiatorId: a, limit: d, cursor: l } = e, u = {
|
|
1251
1280
|
limit: d,
|
|
1252
1281
|
cursor: l ?? null
|
|
1253
1282
|
};
|
|
1254
1283
|
o && (u.objectType = o), n && n !== "remove" && (u.objectId = n), r && (u.eventType = r), i && (u.parentProjectId = i), c && (u.parentItemId = c), a && (u.initiatorId = a);
|
|
1255
|
-
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(
|
|
1284
|
+
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(ze);
|
|
1256
1285
|
return {
|
|
1257
|
-
textContent:
|
|
1286
|
+
textContent: _t({ events: m, args: e, nextCursor: b }),
|
|
1258
1287
|
structuredContent: {
|
|
1259
1288
|
events: m,
|
|
1260
1289
|
nextCursor: b ?? void 0,
|
|
@@ -1265,7 +1294,7 @@ Favorite: Yes`), i = {
|
|
|
1265
1294
|
};
|
|
1266
1295
|
}
|
|
1267
1296
|
};
|
|
1268
|
-
function
|
|
1297
|
+
function _t({
|
|
1269
1298
|
events: e,
|
|
1270
1299
|
args: t,
|
|
1271
1300
|
nextCursor: o
|
|
@@ -1286,12 +1315,12 @@ function Pt({
|
|
|
1286
1315
|
limit: t.limit,
|
|
1287
1316
|
nextCursor: o ?? void 0,
|
|
1288
1317
|
filterHints: i,
|
|
1289
|
-
previewLines:
|
|
1318
|
+
previewLines: Nt(e, Math.min(e.length, t.limit)),
|
|
1290
1319
|
zeroReasonHints: c
|
|
1291
1320
|
});
|
|
1292
1321
|
}
|
|
1293
|
-
function
|
|
1294
|
-
const n = e.slice(0, t).map(
|
|
1322
|
+
function Nt(e, t = 10) {
|
|
1323
|
+
const n = e.slice(0, t).map(Mt).join(`
|
|
1295
1324
|
`);
|
|
1296
1325
|
if (e.length > t) {
|
|
1297
1326
|
const r = e.length - t;
|
|
@@ -1300,8 +1329,8 @@ function Et(e, t = 10) {
|
|
|
1300
1329
|
}
|
|
1301
1330
|
return n;
|
|
1302
1331
|
}
|
|
1303
|
-
function
|
|
1304
|
-
const t =
|
|
1332
|
+
function Mt(e) {
|
|
1333
|
+
const t = Ft(e.eventDate), o = `${e.eventType} ${e.objectType}`;
|
|
1305
1334
|
let n = "";
|
|
1306
1335
|
if (e.extraData) {
|
|
1307
1336
|
const a = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
@@ -1310,7 +1339,7 @@ function Ot(e) {
|
|
|
1310
1339
|
const r = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
1311
1340
|
return ` [${t}] ${o}${n}${r}${i}${c}`;
|
|
1312
1341
|
}
|
|
1313
|
-
function
|
|
1342
|
+
function Ft(e) {
|
|
1314
1343
|
try {
|
|
1315
1344
|
const t = new Date(e), o = t.toLocaleDateString("en-US", { month: "short", timeZone: "UTC" }), n = t.toLocaleDateString("en-US", { day: "numeric", timeZone: "UTC" }), r = t.toLocaleTimeString("en-US", {
|
|
1316
1345
|
hour: "2-digit",
|
|
@@ -1323,23 +1352,23 @@ function _t(e) {
|
|
|
1323
1352
|
return e;
|
|
1324
1353
|
}
|
|
1325
1354
|
}
|
|
1326
|
-
const
|
|
1355
|
+
const Rt = {
|
|
1327
1356
|
taskId: s.string().optional().describe("Find comments for a specific task."),
|
|
1328
1357
|
projectId: s.string().optional().describe(
|
|
1329
1358
|
'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
1330
1359
|
),
|
|
1331
1360
|
commentId: s.string().optional().describe("Get a specific comment by ID."),
|
|
1332
1361
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
1333
|
-
limit: s.number().int().min(1).max(
|
|
1334
|
-
},
|
|
1362
|
+
limit: s.number().int().min(1).max(S.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
1363
|
+
}, Lt = {
|
|
1335
1364
|
comments: s.array(re).describe("The found comments."),
|
|
1336
1365
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1337
1366
|
totalCount: s.number().describe("The total number of comments in this page.")
|
|
1338
|
-
},
|
|
1367
|
+
}, Bt = {
|
|
1339
1368
|
name: g.FIND_COMMENTS,
|
|
1340
1369
|
description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
|
|
1341
|
-
parameters:
|
|
1342
|
-
outputSchema:
|
|
1370
|
+
parameters: Rt,
|
|
1371
|
+
outputSchema: Lt,
|
|
1343
1372
|
async execute(e, t) {
|
|
1344
1373
|
const o = [e.taskId, e.projectId, e.commentId].filter(Boolean);
|
|
1345
1374
|
if (o.length === 0)
|
|
@@ -1356,21 +1385,21 @@ const Nt = {
|
|
|
1356
1385
|
const l = await t.getComments({
|
|
1357
1386
|
taskId: e.taskId,
|
|
1358
1387
|
cursor: e.cursor || null,
|
|
1359
|
-
limit: e.limit ||
|
|
1388
|
+
limit: e.limit || S.COMMENTS_DEFAULT
|
|
1360
1389
|
});
|
|
1361
1390
|
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1362
1391
|
} else if (n) {
|
|
1363
1392
|
const l = await t.getComments({
|
|
1364
1393
|
projectId: n,
|
|
1365
1394
|
cursor: e.cursor || null,
|
|
1366
|
-
limit: e.limit ||
|
|
1395
|
+
limit: e.limit || S.COMMENTS_DEFAULT
|
|
1367
1396
|
});
|
|
1368
1397
|
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1369
1398
|
} else
|
|
1370
1399
|
throw new Error("Invalid state: no search parameter provided");
|
|
1371
1400
|
const a = c.map(te);
|
|
1372
1401
|
return {
|
|
1373
|
-
textContent:
|
|
1402
|
+
textContent: Wt({
|
|
1374
1403
|
comments: a,
|
|
1375
1404
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
1376
1405
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
@@ -1388,7 +1417,7 @@ const Nt = {
|
|
|
1388
1417
|
};
|
|
1389
1418
|
}
|
|
1390
1419
|
};
|
|
1391
|
-
function
|
|
1420
|
+
function Wt({
|
|
1392
1421
|
comments: e,
|
|
1393
1422
|
searchType: t,
|
|
1394
1423
|
searchId: o,
|
|
@@ -1408,15 +1437,15 @@ function Rt({
|
|
|
1408
1437
|
i = `Found ${e.length} ${d} for ${t} ${o}${a}`, n && (i += " • More available");
|
|
1409
1438
|
}
|
|
1410
1439
|
if (r) {
|
|
1411
|
-
const c =
|
|
1440
|
+
const c = ve([], r);
|
|
1412
1441
|
return `${i}
|
|
1413
1442
|
${c}`;
|
|
1414
1443
|
}
|
|
1415
1444
|
return i;
|
|
1416
1445
|
}
|
|
1417
|
-
const
|
|
1446
|
+
const Yt = ["and", "or"], ae = {
|
|
1418
1447
|
labels: s.string().array().optional().describe("The labels to filter the tasks by"),
|
|
1419
|
-
labelsOperator: s.enum(
|
|
1448
|
+
labelsOperator: s.enum(Yt).optional().describe(
|
|
1420
1449
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
1421
1450
|
)
|
|
1422
1451
|
};
|
|
@@ -1425,7 +1454,7 @@ function ce(e = [], t = "or") {
|
|
|
1425
1454
|
const o = t === "and" ? " & " : " | ";
|
|
1426
1455
|
return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${o} `)})`;
|
|
1427
1456
|
}
|
|
1428
|
-
const
|
|
1457
|
+
const zt = {
|
|
1429
1458
|
getBy: s.enum(["completion", "due"]).default("completion").describe(
|
|
1430
1459
|
'The method to use to get the tasks: "completion" to get tasks by completion date (ie, when the task was actually completed), "due" to get tasks by due date (ie, when the task was due to be completed by).'
|
|
1431
1460
|
),
|
|
@@ -1440,22 +1469,22 @@ const Bt = {
|
|
|
1440
1469
|
responsibleUser: s.string().optional().describe(
|
|
1441
1470
|
"Find tasks assigned to this user. Can be a user ID, name, or email address. Defaults to all collaborators when omitted."
|
|
1442
1471
|
),
|
|
1443
|
-
limit: s.number().int().min(1).max(
|
|
1472
|
+
limit: s.number().int().min(1).max(S.COMPLETED_TASKS_MAX).default(S.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1444
1473
|
cursor: s.string().optional().describe(
|
|
1445
1474
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1446
1475
|
),
|
|
1447
1476
|
...ae
|
|
1448
|
-
},
|
|
1477
|
+
}, Kt = {
|
|
1449
1478
|
tasks: s.array(W).describe("The found completed tasks."),
|
|
1450
1479
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1451
1480
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1452
1481
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1453
1482
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1454
|
-
},
|
|
1483
|
+
}, Ht = {
|
|
1455
1484
|
name: g.FIND_COMPLETED_TASKS,
|
|
1456
1485
|
description: "Get completed tasks (includes all collaborators by default—use responsibleUser to narrow).",
|
|
1457
|
-
parameters:
|
|
1458
|
-
outputSchema:
|
|
1486
|
+
parameters: zt,
|
|
1487
|
+
outputSchema: Kt,
|
|
1459
1488
|
async execute(e, t) {
|
|
1460
1489
|
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await ee(t, a), p = u?.email;
|
|
1461
1490
|
let m = ce(n, r);
|
|
@@ -1474,7 +1503,7 @@ const Bt = {
|
|
|
1474
1503
|
...m ? { filterQuery: m, filterLang: "en" } : {}
|
|
1475
1504
|
}), f = C.map(O);
|
|
1476
1505
|
return {
|
|
1477
|
-
textContent:
|
|
1506
|
+
textContent: Vt({
|
|
1478
1507
|
tasks: f,
|
|
1479
1508
|
args: e,
|
|
1480
1509
|
nextCursor: v,
|
|
@@ -1490,7 +1519,7 @@ const Bt = {
|
|
|
1490
1519
|
};
|
|
1491
1520
|
}
|
|
1492
1521
|
};
|
|
1493
|
-
function
|
|
1522
|
+
function Vt({
|
|
1494
1523
|
tasks: e,
|
|
1495
1524
|
args: t,
|
|
1496
1525
|
nextCursor: o,
|
|
@@ -1516,13 +1545,13 @@ function zt({
|
|
|
1516
1545
|
zeroReasonHints: a
|
|
1517
1546
|
});
|
|
1518
1547
|
}
|
|
1519
|
-
const { FIND_PROJECTS:
|
|
1548
|
+
const { FIND_PROJECTS: Gt, ADD_TASKS: Ce, UPDATE_TASKS: Se } = g, qt = {
|
|
1520
1549
|
projectId: s.string().min(1).describe("The ID of the project to search for collaborators in."),
|
|
1521
1550
|
searchTerm: s.string().optional().describe(
|
|
1522
1551
|
"Search for a collaborator by name or email (partial and case insensitive match). If omitted, all collaborators in the project are returned."
|
|
1523
1552
|
)
|
|
1524
|
-
},
|
|
1525
|
-
collaborators: s.array(
|
|
1553
|
+
}, Jt = {
|
|
1554
|
+
collaborators: s.array(Ge).describe("The found collaborators."),
|
|
1526
1555
|
projectInfo: s.object({
|
|
1527
1556
|
id: s.string().describe("The project ID."),
|
|
1528
1557
|
name: s.string().describe("The project name."),
|
|
@@ -1531,11 +1560,11 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
|
1531
1560
|
totalCount: s.number().describe("The total number of collaborators found."),
|
|
1532
1561
|
totalAvailable: s.number().optional().describe("The total number of available collaborators in the project."),
|
|
1533
1562
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1534
|
-
},
|
|
1563
|
+
}, Xt = {
|
|
1535
1564
|
name: g.FIND_PROJECT_COLLABORATORS,
|
|
1536
1565
|
description: "Search for collaborators by name or other criteria in a project.",
|
|
1537
|
-
parameters:
|
|
1538
|
-
outputSchema:
|
|
1566
|
+
parameters: qt,
|
|
1567
|
+
outputSchema: Jt,
|
|
1539
1568
|
async execute(e, t) {
|
|
1540
1569
|
const { projectId: o, searchTerm: n } = e;
|
|
1541
1570
|
let r = o, i;
|
|
@@ -1548,7 +1577,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
|
1548
1577
|
|
|
1549
1578
|
**Next steps:**
|
|
1550
1579
|
• Share the project to enable collaboration
|
|
1551
|
-
• Use ${
|
|
1580
|
+
• Use ${Ce} and ${Se} for assignment features once shared`,
|
|
1552
1581
|
structuredContent: {
|
|
1553
1582
|
collaborators: [],
|
|
1554
1583
|
projectInfo: {
|
|
@@ -1593,7 +1622,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
|
1593
1622
|
);
|
|
1594
1623
|
}
|
|
1595
1624
|
return {
|
|
1596
|
-
textContent:
|
|
1625
|
+
textContent: Zt({
|
|
1597
1626
|
collaborators: a,
|
|
1598
1627
|
projectName: r,
|
|
1599
1628
|
searchTerm: n,
|
|
@@ -1613,7 +1642,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
|
1613
1642
|
};
|
|
1614
1643
|
}
|
|
1615
1644
|
};
|
|
1616
|
-
function
|
|
1645
|
+
function Zt({
|
|
1617
1646
|
collaborators: e,
|
|
1618
1647
|
projectName: t,
|
|
1619
1648
|
searchTerm: o,
|
|
@@ -1629,7 +1658,7 @@ function qt({
|
|
|
1629
1658
|
const a = [];
|
|
1630
1659
|
e.length === 0 && (o ? (a.push(`No collaborators match "${o}"`), a.push("Try a broader search term or check spelling"), n > 0 && a.push(`${n} collaborators available without filter`)) : (a.push("Project has no collaborators"), a.push("Share the project to add collaborators")));
|
|
1631
1660
|
const d = [];
|
|
1632
|
-
return e.length > 0 ? (d.push(`Use ${
|
|
1661
|
+
return e.length > 0 ? (d.push(`Use ${Ce} with responsibleUser to assign new tasks`), d.push(`Use ${Se} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${Gt} to find other projects`), o && n > 0 && d.push("Try searching without filters to see all collaborators")), N({
|
|
1633
1662
|
subject: r,
|
|
1634
1663
|
count: e.length,
|
|
1635
1664
|
filterHints: i,
|
|
@@ -1639,32 +1668,39 @@ function qt({
|
|
|
1639
1668
|
nextSteps: d
|
|
1640
1669
|
});
|
|
1641
1670
|
}
|
|
1642
|
-
const { ADD_PROJECTS:
|
|
1671
|
+
const { ADD_PROJECTS: Qt } = g, es = {
|
|
1643
1672
|
search: s.string().optional().describe(
|
|
1644
1673
|
"Search for a project by name (partial and case insensitive match). If omitted, all projects are returned."
|
|
1645
1674
|
),
|
|
1646
|
-
limit: s.number().int().min(1).max(
|
|
1675
|
+
limit: s.number().int().min(1).max(S.PROJECTS_MAX).default(S.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
|
|
1647
1676
|
cursor: s.string().optional().describe(
|
|
1648
1677
|
"The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1649
1678
|
)
|
|
1650
|
-
},
|
|
1679
|
+
}, ts = {
|
|
1651
1680
|
projects: s.array(oe).describe("The found projects."),
|
|
1652
1681
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1653
1682
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
1654
1683
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1655
1684
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1656
|
-
},
|
|
1685
|
+
}, ss = {
|
|
1657
1686
|
name: g.FIND_PROJECTS,
|
|
1658
|
-
description: "List all projects or search for projects by name.
|
|
1659
|
-
parameters:
|
|
1660
|
-
outputSchema:
|
|
1687
|
+
description: "List all projects or search for projects by name. When searching, all matching projects are returned (pagination is ignored). When not searching, projects are returned with pagination.",
|
|
1688
|
+
parameters: es,
|
|
1689
|
+
outputSchema: ts,
|
|
1661
1690
|
async execute(e, t) {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1691
|
+
let o, n = null;
|
|
1692
|
+
if (e.search)
|
|
1693
|
+
o = await ke(t), n = null;
|
|
1694
|
+
else {
|
|
1695
|
+
const a = await t.getProjects({
|
|
1696
|
+
limit: e.limit,
|
|
1697
|
+
cursor: e.cursor ?? null
|
|
1698
|
+
});
|
|
1699
|
+
o = a.results, n = a.nextCursor;
|
|
1700
|
+
}
|
|
1701
|
+
const r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(we);
|
|
1666
1702
|
return {
|
|
1667
|
-
textContent:
|
|
1703
|
+
textContent: os({ projects: c, args: e, nextCursor: n }),
|
|
1668
1704
|
structuredContent: {
|
|
1669
1705
|
projects: c,
|
|
1670
1706
|
nextCursor: n ?? void 0,
|
|
@@ -1675,17 +1711,17 @@ const { ADD_PROJECTS: Jt } = g, Xt = {
|
|
|
1675
1711
|
};
|
|
1676
1712
|
}
|
|
1677
1713
|
};
|
|
1678
|
-
function
|
|
1714
|
+
function os({
|
|
1679
1715
|
projects: e,
|
|
1680
1716
|
args: t,
|
|
1681
1717
|
nextCursor: o
|
|
1682
1718
|
}) {
|
|
1683
|
-
const n = t.search ? `
|
|
1719
|
+
const n = t.search ? `All projects matching "${t.search}"` : "Projects", r = [];
|
|
1684
1720
|
t.search && r.push(`search: "${t.search}"`);
|
|
1685
|
-
const i = 10, a = e.slice(0, i).map(
|
|
1721
|
+
const i = 10, a = e.slice(0, i).map(ft).join(`
|
|
1686
1722
|
`), d = e.length - i, l = d > 0 ? `${a}
|
|
1687
1723
|
…and ${d} more` : a, u = [];
|
|
1688
|
-
return e.length === 0 && (t.search ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove search to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${
|
|
1724
|
+
return e.length === 0 && (t.search ? (u.push("Try broader search terms"), u.push("Check spelling"), u.push("Remove search to see all projects")) : (u.push("No projects created yet"), u.push(`Use ${Qt} to create a project`))), N({
|
|
1689
1725
|
subject: n,
|
|
1690
1726
|
count: e.length,
|
|
1691
1727
|
limit: t.limit,
|
|
@@ -1695,28 +1731,31 @@ function es({
|
|
|
1695
1731
|
zeroReasonHints: u
|
|
1696
1732
|
});
|
|
1697
1733
|
}
|
|
1698
|
-
const { ADD_SECTIONS:
|
|
1734
|
+
const { ADD_SECTIONS: ns } = g, rs = {
|
|
1699
1735
|
projectId: s.string().min(1).describe(
|
|
1700
1736
|
'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
1701
1737
|
),
|
|
1702
1738
|
search: s.string().optional().describe(
|
|
1703
1739
|
"Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."
|
|
1704
1740
|
)
|
|
1705
|
-
},
|
|
1741
|
+
}, is = {
|
|
1706
1742
|
sections: s.array(ne).describe("The found sections."),
|
|
1707
1743
|
totalCount: s.number().describe("The total number of sections found."),
|
|
1708
1744
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1709
|
-
},
|
|
1745
|
+
}, as = {
|
|
1710
1746
|
name: g.FIND_SECTIONS,
|
|
1711
|
-
description: "Search for sections by name or other criteria in a project.",
|
|
1712
|
-
parameters:
|
|
1713
|
-
outputSchema:
|
|
1747
|
+
description: "Search for sections by name or other criteria in a project. When searching, all sections in the project are fetched to ensure complete results.",
|
|
1748
|
+
parameters: rs,
|
|
1749
|
+
outputSchema: is,
|
|
1714
1750
|
async execute(e, t) {
|
|
1715
|
-
const o = e.projectId === "inbox" ? (await t.getUser()).inboxProjectId : e.projectId
|
|
1751
|
+
const o = e.projectId === "inbox" ? (await t.getUser()).inboxProjectId : e.projectId;
|
|
1752
|
+
let n;
|
|
1753
|
+
e.search ? n = await We(t, o) : n = (await t.getSections({
|
|
1716
1754
|
projectId: o
|
|
1717
|
-
})
|
|
1755
|
+
})).results;
|
|
1756
|
+
const r = e.search ? e.search.toLowerCase() : void 0, c = (r ? n.filter((d) => d.name.toLowerCase().includes(r)) : n).map(({ id: d, name: l }) => ({ id: d, name: l }));
|
|
1718
1757
|
return {
|
|
1719
|
-
textContent:
|
|
1758
|
+
textContent: cs({
|
|
1720
1759
|
sections: c,
|
|
1721
1760
|
projectId: e.projectId,
|
|
1722
1761
|
search: e.search
|
|
@@ -1729,13 +1768,13 @@ const { ADD_SECTIONS: ts } = g, ss = {
|
|
|
1729
1768
|
};
|
|
1730
1769
|
}
|
|
1731
1770
|
};
|
|
1732
|
-
function
|
|
1771
|
+
function cs({
|
|
1733
1772
|
sections: e,
|
|
1734
1773
|
projectId: t,
|
|
1735
1774
|
search: o
|
|
1736
1775
|
}) {
|
|
1737
1776
|
const n = [];
|
|
1738
|
-
o ? (n.push("Try broader search terms"), n.push("Check spelling"), n.push("Remove search to see all sections")) : (n.push("Project has no sections yet"), n.push(`Use ${
|
|
1777
|
+
o ? (n.push("Try broader search terms"), n.push("Check spelling"), n.push("Remove search to see all sections")) : (n.push("Project has no sections yet"), n.push(`Use ${ns} to create sections`));
|
|
1739
1778
|
const r = o ? `Sections in project ${t} matching "${o}"` : `Sections in project ${t}`, i = e.length > 0 ? e.map((c) => ` ${c.name} • id=${c.id}`).join(`
|
|
1740
1779
|
`) : void 0;
|
|
1741
1780
|
return N({
|
|
@@ -1745,7 +1784,7 @@ function rs({
|
|
|
1745
1784
|
zeroReasonHints: n
|
|
1746
1785
|
});
|
|
1747
1786
|
}
|
|
1748
|
-
const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g,
|
|
1787
|
+
const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, ds = {
|
|
1749
1788
|
searchText: s.string().optional().describe("The text to search for in tasks."),
|
|
1750
1789
|
projectId: s.string().optional().describe(
|
|
1751
1790
|
'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -1756,22 +1795,22 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
|
1756
1795
|
responsibleUserFiltering: s.enum(ye).optional().describe(
|
|
1757
1796
|
'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`.'
|
|
1758
1797
|
),
|
|
1759
|
-
limit: s.number().int().min(1).max(
|
|
1798
|
+
limit: s.number().int().min(1).max(S.TASKS_MAX).default(S.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1760
1799
|
cursor: s.string().optional().describe(
|
|
1761
1800
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1762
1801
|
),
|
|
1763
1802
|
...ae
|
|
1764
|
-
},
|
|
1803
|
+
}, ls = {
|
|
1765
1804
|
tasks: s.array(W).describe("The found tasks."),
|
|
1766
1805
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1767
1806
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1768
1807
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1769
1808
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1770
|
-
},
|
|
1809
|
+
}, us = {
|
|
1771
1810
|
name: g.FIND_TASKS,
|
|
1772
1811
|
description: "Find tasks by text search, or by project/section/parent container/responsible user. At least one filter must be provided.",
|
|
1773
|
-
parameters:
|
|
1774
|
-
outputSchema:
|
|
1812
|
+
parameters: ds,
|
|
1813
|
+
outputSchema: ls,
|
|
1775
1814
|
async execute(e, t) {
|
|
1776
1815
|
const {
|
|
1777
1816
|
searchText: o,
|
|
@@ -1796,7 +1835,7 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
|
1796
1835
|
cursor: l ?? null
|
|
1797
1836
|
};
|
|
1798
1837
|
n && (f.projectId = n === "inbox" ? b.inboxProjectId : n), r && (f.sectionId = r), i && (f.parentId = i);
|
|
1799
|
-
const { results: j, nextCursor:
|
|
1838
|
+
const { results: j, nextCursor: $ } = await t.getTasks(f), x = j.map(O);
|
|
1800
1839
|
let E = o ? x.filter(
|
|
1801
1840
|
(M) => M.content.toLowerCase().includes(o.toLowerCase()) || M.description?.toLowerCase().includes(o.toLowerCase())
|
|
1802
1841
|
) : x;
|
|
@@ -1813,15 +1852,15 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
|
1813
1852
|
textContent: J({
|
|
1814
1853
|
tasks: E,
|
|
1815
1854
|
args: e,
|
|
1816
|
-
nextCursor:
|
|
1855
|
+
nextCursor: $,
|
|
1817
1856
|
isContainerSearch: !0,
|
|
1818
1857
|
assigneeEmail: w
|
|
1819
1858
|
}),
|
|
1820
1859
|
structuredContent: {
|
|
1821
1860
|
tasks: E,
|
|
1822
|
-
nextCursor:
|
|
1861
|
+
nextCursor: $ ?? void 0,
|
|
1823
1862
|
totalCount: E.length,
|
|
1824
|
-
hasMore:
|
|
1863
|
+
hasMore: !!$,
|
|
1825
1864
|
appliedFilters: e
|
|
1826
1865
|
}
|
|
1827
1866
|
};
|
|
@@ -1832,19 +1871,19 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
|
1832
1871
|
lang: "en",
|
|
1833
1872
|
limit: d,
|
|
1834
1873
|
cursor: l ?? null
|
|
1835
|
-
}),
|
|
1874
|
+
}), $ = f.map(O);
|
|
1836
1875
|
return {
|
|
1837
1876
|
textContent: J({
|
|
1838
|
-
tasks:
|
|
1877
|
+
tasks: $,
|
|
1839
1878
|
args: e,
|
|
1840
1879
|
nextCursor: j,
|
|
1841
1880
|
isContainerSearch: !1,
|
|
1842
1881
|
assigneeEmail: w
|
|
1843
1882
|
}),
|
|
1844
1883
|
structuredContent: {
|
|
1845
|
-
tasks:
|
|
1884
|
+
tasks: $,
|
|
1846
1885
|
nextCursor: j ?? void 0,
|
|
1847
|
-
totalCount:
|
|
1886
|
+
totalCount: $.length,
|
|
1848
1887
|
hasMore: !!j,
|
|
1849
1888
|
appliedFilters: e
|
|
1850
1889
|
}
|
|
@@ -1883,7 +1922,7 @@ const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
|
1883
1922
|
};
|
|
1884
1923
|
}
|
|
1885
1924
|
};
|
|
1886
|
-
function
|
|
1925
|
+
function ps(e) {
|
|
1887
1926
|
if (e.projectId) {
|
|
1888
1927
|
const t = [
|
|
1889
1928
|
e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
|
|
@@ -1918,7 +1957,7 @@ function J({
|
|
|
1918
1957
|
const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
1919
1958
|
c.push(`labels: ${d}`);
|
|
1920
1959
|
}
|
|
1921
|
-
e.length === 0 && a.push(...
|
|
1960
|
+
e.length === 0 && a.push(...ps(t));
|
|
1922
1961
|
} else {
|
|
1923
1962
|
const d = r || t.responsibleUser, l = [];
|
|
1924
1963
|
if (t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
@@ -1947,7 +1986,7 @@ function J({
|
|
|
1947
1986
|
zeroReasonHints: a
|
|
1948
1987
|
});
|
|
1949
1988
|
}
|
|
1950
|
-
const
|
|
1989
|
+
const hs = {
|
|
1951
1990
|
startDate: s.string().regex(/^(\d{4}-\d{2}-\d{2}|today)$/).optional().describe("The start date to get the tasks for. Format: YYYY-MM-DD or 'today'."),
|
|
1952
1991
|
overdueOption: s.enum(["overdue-only", "include-overdue", "exclude-overdue"]).optional().describe(
|
|
1953
1992
|
"How to handle overdue tasks. 'overdue-only' to get only overdue tasks, 'include-overdue' to include overdue tasks along with tasks for the specified date(s), and 'exclude-overdue' to exclude overdue tasks. Default is 'include-overdue'."
|
|
@@ -1955,7 +1994,7 @@ const ls = {
|
|
|
1955
1994
|
daysCount: s.number().int().min(1).max(30).default(1).describe(
|
|
1956
1995
|
"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."
|
|
1957
1996
|
),
|
|
1958
|
-
limit: s.number().int().min(1).max(
|
|
1997
|
+
limit: s.number().int().min(1).max(S.TASKS_MAX).default(S.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1959
1998
|
cursor: s.string().optional().describe(
|
|
1960
1999
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1961
2000
|
),
|
|
@@ -1964,17 +2003,17 @@ const ls = {
|
|
|
1964
2003
|
'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 is "unassignedOrMe".'
|
|
1965
2004
|
),
|
|
1966
2005
|
...ae
|
|
1967
|
-
},
|
|
2006
|
+
}, ms = {
|
|
1968
2007
|
tasks: s.array(W).describe("The found tasks."),
|
|
1969
2008
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1970
2009
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1971
2010
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1972
2011
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1973
|
-
},
|
|
2012
|
+
}, fs = {
|
|
1974
2013
|
name: g.FIND_TASKS_BY_DATE,
|
|
1975
2014
|
description: "Get tasks by date range. Use startDate 'today' to get today's tasks including overdue items, or provide a specific date/date range.",
|
|
1976
|
-
parameters:
|
|
1977
|
-
outputSchema:
|
|
2015
|
+
parameters: hs,
|
|
2016
|
+
outputSchema: ms,
|
|
1978
2017
|
async execute(e, t) {
|
|
1979
2018
|
if (!e.startDate && e.overdueOption !== "overdue-only")
|
|
1980
2019
|
throw new Error(
|
|
@@ -1987,12 +2026,12 @@ const ls = {
|
|
|
1987
2026
|
else if (e.startDate === "today")
|
|
1988
2027
|
i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
1989
2028
|
else if (e.startDate) {
|
|
1990
|
-
const p = e.startDate, b = be(p, e.daysCount), m =
|
|
2029
|
+
const p = e.startDate, b = be(p, e.daysCount), m = Pe(b, { representation: "date" });
|
|
1991
2030
|
i = `(due after: ${p} | due: ${p}) & due before: ${m}`;
|
|
1992
2031
|
}
|
|
1993
2032
|
const c = ce(e.labels, e.labelsOperator);
|
|
1994
2033
|
c.length > 0 && (i = K(i, `(${c})`));
|
|
1995
|
-
const a =
|
|
2034
|
+
const a = Be({
|
|
1996
2035
|
resolvedAssigneeId: n,
|
|
1997
2036
|
assigneeEmail: r,
|
|
1998
2037
|
responsibleUserFiltering: e.responsibleUserFiltering
|
|
@@ -2005,7 +2044,7 @@ const ls = {
|
|
|
2005
2044
|
limit: e.limit
|
|
2006
2045
|
});
|
|
2007
2046
|
return {
|
|
2008
|
-
textContent:
|
|
2047
|
+
textContent: bs({ tasks: d, args: e, nextCursor: l, assigneeEmail: r }),
|
|
2009
2048
|
structuredContent: {
|
|
2010
2049
|
tasks: d,
|
|
2011
2050
|
nextCursor: l ?? void 0,
|
|
@@ -2016,7 +2055,7 @@ const ls = {
|
|
|
2016
2055
|
};
|
|
2017
2056
|
}
|
|
2018
2057
|
};
|
|
2019
|
-
function
|
|
2058
|
+
function bs({
|
|
2020
2059
|
tasks: e,
|
|
2021
2060
|
args: t,
|
|
2022
2061
|
nextCursor: o,
|
|
@@ -2031,7 +2070,7 @@ function hs({
|
|
|
2031
2070
|
`today${a}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
2032
2071
|
);
|
|
2033
2072
|
} else if (t.startDate) {
|
|
2034
|
-
const a = t.daysCount > 1 ? ` to ${
|
|
2073
|
+
const a = t.daysCount > 1 ? ` to ${pt(be(t.startDate, t.daysCount))}` : "";
|
|
2035
2074
|
r.push(`${t.startDate}${a}`);
|
|
2036
2075
|
}
|
|
2037
2076
|
if (t.labels && t.labels.length > 0) {
|
|
@@ -2066,11 +2105,11 @@ function hs({
|
|
|
2066
2105
|
zeroReasonHints: c
|
|
2067
2106
|
});
|
|
2068
2107
|
}
|
|
2069
|
-
const
|
|
2108
|
+
const gs = {
|
|
2070
2109
|
projectId: s.string().min(1).optional().describe(
|
|
2071
2110
|
"Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
|
|
2072
2111
|
)
|
|
2073
|
-
},
|
|
2112
|
+
}, Ts = {
|
|
2074
2113
|
type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
2075
2114
|
totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
|
|
2076
2115
|
totalTasks: s.number().optional().describe("Total number of tasks."),
|
|
@@ -2091,7 +2130,7 @@ const ms = {
|
|
|
2091
2130
|
tasks: s.array(s.any()).optional().describe("List of tasks (project overview only)."),
|
|
2092
2131
|
stats: s.any().optional().describe("Statistics object (project overview only).")
|
|
2093
2132
|
};
|
|
2094
|
-
function
|
|
2133
|
+
function ys(e) {
|
|
2095
2134
|
const t = {};
|
|
2096
2135
|
for (const r of e)
|
|
2097
2136
|
t[r.id] = {
|
|
@@ -2116,7 +2155,7 @@ function bs(e) {
|
|
|
2116
2155
|
}
|
|
2117
2156
|
return n(o), o;
|
|
2118
2157
|
}
|
|
2119
|
-
async function
|
|
2158
|
+
async function Is(e, t) {
|
|
2120
2159
|
const o = {};
|
|
2121
2160
|
return await Promise.all(
|
|
2122
2161
|
t.map(async (n) => {
|
|
@@ -2125,14 +2164,14 @@ async function gs(e, t) {
|
|
|
2125
2164
|
})
|
|
2126
2165
|
), o;
|
|
2127
2166
|
}
|
|
2128
|
-
function
|
|
2167
|
+
function $e(e, t, o = "") {
|
|
2129
2168
|
const n = [];
|
|
2130
2169
|
n.push(`${o}- Project: ${e.name} (id=${e.id})`);
|
|
2131
2170
|
const r = t[e.id] || [];
|
|
2132
2171
|
for (const i of r)
|
|
2133
2172
|
n.push(`${o} - Section: ${i.name} (id=${i.id})`);
|
|
2134
2173
|
for (const i of e.children)
|
|
2135
|
-
n.push(
|
|
2174
|
+
n.push(...$e(i, t, `${o} `));
|
|
2136
2175
|
return n;
|
|
2137
2176
|
}
|
|
2138
2177
|
function pe(e) {
|
|
@@ -2160,33 +2199,33 @@ function Z(e, t = "") {
|
|
|
2160
2199
|
}
|
|
2161
2200
|
return o;
|
|
2162
2201
|
}
|
|
2163
|
-
function
|
|
2202
|
+
function De(e, t) {
|
|
2164
2203
|
return {
|
|
2165
2204
|
id: e.id,
|
|
2166
2205
|
name: e.name,
|
|
2167
2206
|
parentId: B(e) ? e.parentId ?? null : null,
|
|
2168
2207
|
sections: t[e.id] || [],
|
|
2169
|
-
children: e.children.map((o) =>
|
|
2208
|
+
children: e.children.map((o) => De(o, t))
|
|
2170
2209
|
};
|
|
2171
2210
|
}
|
|
2172
|
-
async function
|
|
2211
|
+
async function ks(e, t) {
|
|
2173
2212
|
let o = [], n;
|
|
2174
2213
|
do {
|
|
2175
2214
|
const { results: r, nextCursor: i } = await e.getTasks({
|
|
2176
2215
|
projectId: t,
|
|
2177
|
-
limit:
|
|
2216
|
+
limit: S.TASKS_BATCH_SIZE,
|
|
2178
2217
|
cursor: n ?? void 0
|
|
2179
2218
|
});
|
|
2180
2219
|
o = o.concat(r.map(O)), n = i ?? void 0;
|
|
2181
2220
|
} while (n);
|
|
2182
2221
|
return o;
|
|
2183
2222
|
}
|
|
2184
|
-
async function
|
|
2223
|
+
async function ws(e, t) {
|
|
2185
2224
|
const { results: o } = await e.getSections({ projectId: t });
|
|
2186
2225
|
return o;
|
|
2187
2226
|
}
|
|
2188
|
-
async function
|
|
2189
|
-
const { results: t } = await e.getProjects({}), o = t.find((p) => B(p) && p.inboxProject === !0), n = t.filter((p) => !B(p) || p.inboxProject !== !0), r =
|
|
2227
|
+
async function js(e) {
|
|
2228
|
+
const { results: t } = await e.getProjects({}), o = t.find((p) => B(p) && p.inboxProject === !0), n = t.filter((p) => !B(p) || p.inboxProject !== !0), r = ys(n), i = t.map((p) => p.id), c = await Is(e, i), a = ["# Personal Projects", ""];
|
|
2190
2229
|
if (o) {
|
|
2191
2230
|
a.push(`- Inbox Project: ${o.name} (id=${o.id})`);
|
|
2192
2231
|
for (const p of c[o.id] || [])
|
|
@@ -2194,7 +2233,7 @@ async function Is(e) {
|
|
|
2194
2233
|
}
|
|
2195
2234
|
if (r.length)
|
|
2196
2235
|
for (const p of r)
|
|
2197
|
-
a.push(
|
|
2236
|
+
a.push(...$e(p, c));
|
|
2198
2237
|
else
|
|
2199
2238
|
a.push("_No projects found._");
|
|
2200
2239
|
a.push("");
|
|
@@ -2212,7 +2251,7 @@ async function Is(e) {
|
|
|
2212
2251
|
sections: c[o.id] || []
|
|
2213
2252
|
} : null,
|
|
2214
2253
|
projects: r.map(
|
|
2215
|
-
(p) =>
|
|
2254
|
+
(p) => De(p, c)
|
|
2216
2255
|
),
|
|
2217
2256
|
totalProjects: t.length,
|
|
2218
2257
|
totalSections: i.reduce(
|
|
@@ -2223,8 +2262,8 @@ async function Is(e) {
|
|
|
2223
2262
|
};
|
|
2224
2263
|
return { textContent: l, structuredContent: u };
|
|
2225
2264
|
}
|
|
2226
|
-
async function
|
|
2227
|
-
const o = await e.getProject(t), n = await
|
|
2265
|
+
async function vs(e, t) {
|
|
2266
|
+
const o = await e.getProject(t), n = await ws(e, t), r = await ks(e, t), i = {};
|
|
2228
2267
|
for (const u of n)
|
|
2229
2268
|
i[u.id] = [];
|
|
2230
2269
|
const c = [];
|
|
@@ -2265,21 +2304,21 @@ async function ks(e, t) {
|
|
|
2265
2304
|
};
|
|
2266
2305
|
return { textContent: d, structuredContent: l };
|
|
2267
2306
|
}
|
|
2268
|
-
const
|
|
2307
|
+
const Cs = {
|
|
2269
2308
|
name: g.GET_OVERVIEW,
|
|
2270
2309
|
description: "Get a Markdown overview. If no projectId is provided, shows all projects with hierarchy and sections (useful for navigation). If projectId is provided, shows detailed overview of that specific project including all tasks grouped by sections.",
|
|
2271
|
-
parameters:
|
|
2272
|
-
outputSchema:
|
|
2310
|
+
parameters: gs,
|
|
2311
|
+
outputSchema: Ts,
|
|
2273
2312
|
async execute(e, t) {
|
|
2274
|
-
const o = e.projectId ? await
|
|
2313
|
+
const o = e.projectId ? await vs(t, e.projectId) : await js(t);
|
|
2275
2314
|
return {
|
|
2276
2315
|
textContent: o.textContent,
|
|
2277
2316
|
structuredContent: o.structuredContent
|
|
2278
2317
|
};
|
|
2279
2318
|
}
|
|
2280
|
-
}, { FIND_TASKS:
|
|
2319
|
+
}, { FIND_TASKS: Ss, FIND_PROJECT_COLLABORATORS: he, UPDATE_TASKS: $s } = g, Ds = 50, xs = {
|
|
2281
2320
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
2282
|
-
taskIds: s.array(s.string()).min(1).max(
|
|
2321
|
+
taskIds: s.array(s.string()).min(1).max(Ds).describe("The IDs of the tasks to operate on (max 50)."),
|
|
2283
2322
|
responsibleUser: s.string().optional().describe(
|
|
2284
2323
|
"The user to assign tasks to. Can be user ID, name, or email. Required for assign and reassign operations."
|
|
2285
2324
|
),
|
|
@@ -2287,7 +2326,7 @@ const ws = {
|
|
|
2287
2326
|
"For reassign operations: the current assignee to reassign from. Can be user ID, name, or email. Optional - if not provided, reassigns from any current assignee."
|
|
2288
2327
|
),
|
|
2289
2328
|
dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
|
|
2290
|
-
},
|
|
2329
|
+
}, As = {
|
|
2291
2330
|
results: s.array(
|
|
2292
2331
|
s.object({
|
|
2293
2332
|
taskId: s.string().describe("The ID of the task."),
|
|
@@ -2303,11 +2342,11 @@ const ws = {
|
|
|
2303
2342
|
failed: s.number().describe("Number of failed operations."),
|
|
2304
2343
|
dryRun: s.boolean().describe("Whether this was a dry run.")
|
|
2305
2344
|
}).optional().describe("Summary of the operation.")
|
|
2306
|
-
},
|
|
2345
|
+
}, Us = {
|
|
2307
2346
|
name: g.MANAGE_ASSIGNMENTS,
|
|
2308
2347
|
description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
|
|
2309
|
-
parameters:
|
|
2310
|
-
outputSchema:
|
|
2348
|
+
parameters: xs,
|
|
2349
|
+
outputSchema: As,
|
|
2311
2350
|
async execute(e, t) {
|
|
2312
2351
|
const { operation: o, taskIds: n, responsibleUser: r, fromAssigneeUser: i, dryRun: c } = e;
|
|
2313
2352
|
if ((o === "assign" || o === "reassign") && !r)
|
|
@@ -2361,10 +2400,10 @@ const ws = {
|
|
|
2361
2400
|
});
|
|
2362
2401
|
if (o === "unassign") {
|
|
2363
2402
|
if (c) {
|
|
2364
|
-
const f = d.map((
|
|
2365
|
-
taskId:
|
|
2403
|
+
const f = d.map(($) => ({
|
|
2404
|
+
taskId: $.id,
|
|
2366
2405
|
success: !0,
|
|
2367
|
-
originalAssigneeId:
|
|
2406
|
+
originalAssigneeId: $.responsibleUid ?? void 0,
|
|
2368
2407
|
newAssigneeId: void 0
|
|
2369
2408
|
}));
|
|
2370
2409
|
return {
|
|
@@ -2434,7 +2473,7 @@ const ws = {
|
|
|
2434
2473
|
);
|
|
2435
2474
|
if (!T)
|
|
2436
2475
|
return C.map(({ assignment: f, validation: j }) => {
|
|
2437
|
-
const
|
|
2476
|
+
const $ = d.find((x) => x.id === f.taskId);
|
|
2438
2477
|
if (!f.taskId || !j.resolvedUser?.userId)
|
|
2439
2478
|
throw new Error(
|
|
2440
2479
|
"Invalid assignment or validation data - this should not happen"
|
|
@@ -2442,19 +2481,19 @@ const ws = {
|
|
|
2442
2481
|
return {
|
|
2443
2482
|
taskId: f.taskId,
|
|
2444
2483
|
success: !0,
|
|
2445
|
-
originalAssigneeId:
|
|
2484
|
+
originalAssigneeId: $?.responsibleUid ?? void 0,
|
|
2446
2485
|
newAssigneeId: j.resolvedUser.userId
|
|
2447
2486
|
};
|
|
2448
2487
|
});
|
|
2449
2488
|
const v = C.map(
|
|
2450
2489
|
async ({ assignment: f, validation: j }) => {
|
|
2451
|
-
const
|
|
2490
|
+
const $ = d.find((x) => x.id === f.taskId);
|
|
2452
2491
|
if (!f.taskId || !j.resolvedUser?.userId)
|
|
2453
2492
|
return {
|
|
2454
2493
|
taskId: f.taskId || "unknown-task",
|
|
2455
2494
|
success: !1,
|
|
2456
2495
|
error: "Invalid assignment data - missing task ID or resolved user",
|
|
2457
|
-
originalAssigneeId:
|
|
2496
|
+
originalAssigneeId: $?.responsibleUid ?? void 0
|
|
2458
2497
|
};
|
|
2459
2498
|
try {
|
|
2460
2499
|
return await t.updateTask(f.taskId, {
|
|
@@ -2462,7 +2501,7 @@ const ws = {
|
|
|
2462
2501
|
}), {
|
|
2463
2502
|
taskId: f.taskId,
|
|
2464
2503
|
success: !0,
|
|
2465
|
-
originalAssigneeId:
|
|
2504
|
+
originalAssigneeId: $?.responsibleUid ?? void 0,
|
|
2466
2505
|
newAssigneeId: j.resolvedUser.userId
|
|
2467
2506
|
};
|
|
2468
2507
|
} catch (x) {
|
|
@@ -2470,7 +2509,7 @@ const ws = {
|
|
|
2470
2509
|
taskId: f.taskId,
|
|
2471
2510
|
success: !1,
|
|
2472
2511
|
error: x instanceof Error ? x.message : "Update failed",
|
|
2473
|
-
originalAssigneeId:
|
|
2512
|
+
originalAssigneeId: $?.responsibleUid ?? void 0
|
|
2474
2513
|
};
|
|
2475
2514
|
}
|
|
2476
2515
|
}
|
|
@@ -2533,8 +2572,8 @@ function Y({
|
|
|
2533
2572
|
`;
|
|
2534
2573
|
}
|
|
2535
2574
|
return !o && n.length > 0 ? (a += `**Next steps:**
|
|
2536
|
-
`, a += `• Use ${
|
|
2537
|
-
`, a += `• Use ${
|
|
2575
|
+
`, a += `• Use ${Ss} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
|
|
2576
|
+
`, a += `• Use ${$s} for individual assignment changes
|
|
2538
2577
|
`, r.length > 0 && (a += `• Check failed tasks and use ${he} to verify collaborator access
|
|
2539
2578
|
`)) : o ? (a += `**To execute:**
|
|
2540
2579
|
`, a += `• Remove dryRun parameter and run again to execute changes
|
|
@@ -2546,9 +2585,9 @@ function Y({
|
|
|
2546
2585
|
`, a += `• Use dryRun=true to validate before executing
|
|
2547
2586
|
`), a;
|
|
2548
2587
|
}
|
|
2549
|
-
const
|
|
2588
|
+
const Ps = {
|
|
2550
2589
|
query: s.string().min(1).describe("The search query string to find tasks and projects.")
|
|
2551
|
-
},
|
|
2590
|
+
}, Es = {
|
|
2552
2591
|
results: s.array(
|
|
2553
2592
|
s.object({
|
|
2554
2593
|
id: s.string().describe("The ID of the result."),
|
|
@@ -2557,21 +2596,21 @@ const xs = {
|
|
|
2557
2596
|
})
|
|
2558
2597
|
).describe("The search results."),
|
|
2559
2598
|
totalCount: s.number().describe("Total number of results found.")
|
|
2560
|
-
},
|
|
2599
|
+
}, Os = {
|
|
2561
2600
|
name: g.SEARCH,
|
|
2562
2601
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
2563
|
-
parameters:
|
|
2564
|
-
outputSchema:
|
|
2602
|
+
parameters: Ps,
|
|
2603
|
+
outputSchema: Es,
|
|
2565
2604
|
async execute(e, t) {
|
|
2566
2605
|
const { query: o } = e, [n, r] = await Promise.all([
|
|
2567
2606
|
se({
|
|
2568
2607
|
client: t,
|
|
2569
2608
|
query: `search: ${o}`,
|
|
2570
|
-
limit:
|
|
2609
|
+
limit: S.TASKS_MAX,
|
|
2571
2610
|
cursor: void 0
|
|
2572
2611
|
}),
|
|
2573
|
-
t
|
|
2574
|
-
]), i = o.toLowerCase(), c = r.
|
|
2612
|
+
ke(t)
|
|
2613
|
+
]), i = o.toLowerCase(), c = r.filter(
|
|
2575
2614
|
(d) => d.name.toLowerCase().includes(i)
|
|
2576
2615
|
), a = [];
|
|
2577
2616
|
for (const d of n.tasks)
|
|
@@ -2591,27 +2630,27 @@ const xs = {
|
|
|
2591
2630
|
structuredContent: { results: a, totalCount: a.length }
|
|
2592
2631
|
};
|
|
2593
2632
|
}
|
|
2594
|
-
},
|
|
2633
|
+
}, _s = s.object({
|
|
2595
2634
|
id: s.string().min(1).describe("The ID of the comment to update."),
|
|
2596
2635
|
content: s.string().min(1).describe("The new content for the comment.")
|
|
2597
|
-
}),
|
|
2598
|
-
comments: s.array(
|
|
2599
|
-
},
|
|
2636
|
+
}), Ns = {
|
|
2637
|
+
comments: s.array(_s).min(1).describe("The comments to update.")
|
|
2638
|
+
}, Ms = {
|
|
2600
2639
|
comments: s.array(re).describe("The updated comments."),
|
|
2601
2640
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
2602
2641
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
2603
2642
|
appliedOperations: s.object({
|
|
2604
2643
|
updateCount: s.number().describe("The number of comments updated.")
|
|
2605
2644
|
}).describe("Summary of operations performed.")
|
|
2606
|
-
},
|
|
2645
|
+
}, Fs = {
|
|
2607
2646
|
name: g.UPDATE_COMMENTS,
|
|
2608
2647
|
description: "Update multiple existing comments with new content.",
|
|
2609
|
-
parameters:
|
|
2610
|
-
outputSchema:
|
|
2648
|
+
parameters: Ns,
|
|
2649
|
+
outputSchema: Ms,
|
|
2611
2650
|
async execute(e, t) {
|
|
2612
2651
|
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(te);
|
|
2613
2652
|
return {
|
|
2614
|
-
textContent:
|
|
2653
|
+
textContent: Rs({
|
|
2615
2654
|
comments: i
|
|
2616
2655
|
}),
|
|
2617
2656
|
structuredContent: {
|
|
@@ -2625,7 +2664,7 @@ const xs = {
|
|
|
2625
2664
|
};
|
|
2626
2665
|
}
|
|
2627
2666
|
};
|
|
2628
|
-
function
|
|
2667
|
+
function Rs({ comments: e }) {
|
|
2629
2668
|
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
2630
2669
|
if (t > 0) {
|
|
2631
2670
|
const i = t > 1 ? "comments" : "comment";
|
|
@@ -2637,14 +2676,14 @@ function Ns({ comments: e }) {
|
|
|
2637
2676
|
}
|
|
2638
2677
|
return n.length > 0 ? `Updated ${n.join(" and ")}` : "No comments updated";
|
|
2639
2678
|
}
|
|
2640
|
-
const
|
|
2679
|
+
const Ls = s.object({
|
|
2641
2680
|
id: s.string().min(1).describe("The ID of the project to update."),
|
|
2642
2681
|
name: s.string().min(1).optional().describe("The new name of the project."),
|
|
2643
2682
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
|
|
2644
2683
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style.")
|
|
2645
|
-
}),
|
|
2646
|
-
projects: s.array(
|
|
2647
|
-
},
|
|
2684
|
+
}), Bs = {
|
|
2685
|
+
projects: s.array(Ls).min(1).describe("The projects to update.")
|
|
2686
|
+
}, Ws = {
|
|
2648
2687
|
projects: s.array(oe).describe("The updated projects."),
|
|
2649
2688
|
totalCount: s.number().describe("The total number of projects updated."),
|
|
2650
2689
|
updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
|
|
@@ -2652,14 +2691,14 @@ const Ms = s.object({
|
|
|
2652
2691
|
updateCount: s.number().describe("The number of projects actually updated."),
|
|
2653
2692
|
skippedCount: s.number().describe("The number of projects skipped (no changes).")
|
|
2654
2693
|
}).describe("Summary of operations performed.")
|
|
2655
|
-
},
|
|
2694
|
+
}, Ys = {
|
|
2656
2695
|
name: g.UPDATE_PROJECTS,
|
|
2657
2696
|
description: "Update multiple existing projects with new values.",
|
|
2658
|
-
parameters:
|
|
2659
|
-
outputSchema:
|
|
2697
|
+
parameters: Bs,
|
|
2698
|
+
outputSchema: Ws,
|
|
2660
2699
|
async execute(e, t) {
|
|
2661
2700
|
const { projects: o } = e, n = o.map(async (c) => {
|
|
2662
|
-
if (!
|
|
2701
|
+
if (!Ks(c))
|
|
2663
2702
|
return;
|
|
2664
2703
|
const { id: a, ...d } = c;
|
|
2665
2704
|
return await t.updateProject(a, d);
|
|
@@ -2671,7 +2710,7 @@ const Ms = s.object({
|
|
|
2671
2710
|
inboxProject: "inboxProject" in c ? c.inboxProject : !1
|
|
2672
2711
|
}));
|
|
2673
2712
|
return {
|
|
2674
|
-
textContent:
|
|
2713
|
+
textContent: zs({
|
|
2675
2714
|
projects: r,
|
|
2676
2715
|
args: e
|
|
2677
2716
|
}),
|
|
@@ -2687,7 +2726,7 @@ const Ms = s.object({
|
|
|
2687
2726
|
};
|
|
2688
2727
|
}
|
|
2689
2728
|
};
|
|
2690
|
-
function
|
|
2729
|
+
function zs({
|
|
2691
2730
|
projects: e,
|
|
2692
2731
|
args: t
|
|
2693
2732
|
}) {
|
|
@@ -2697,29 +2736,29 @@ function Bs({
|
|
|
2697
2736
|
return r > 0 && (a += ` (${r} skipped - no changes)`), i > 0 && (a += `:
|
|
2698
2737
|
${c}`), a;
|
|
2699
2738
|
}
|
|
2700
|
-
function
|
|
2739
|
+
function Ks({ id: e, ...t }) {
|
|
2701
2740
|
return Object.keys(t).length > 0;
|
|
2702
2741
|
}
|
|
2703
|
-
const
|
|
2742
|
+
const Hs = s.object({
|
|
2704
2743
|
id: s.string().min(1).describe("The ID of the section to update."),
|
|
2705
2744
|
name: s.string().min(1).describe("The new name of the section.")
|
|
2706
|
-
}),
|
|
2707
|
-
sections: s.array(
|
|
2708
|
-
},
|
|
2745
|
+
}), Vs = {
|
|
2746
|
+
sections: s.array(Hs).min(1).describe("The sections to update.")
|
|
2747
|
+
}, Gs = {
|
|
2709
2748
|
sections: s.array(ne).describe("The updated sections."),
|
|
2710
2749
|
totalCount: s.number().describe("The total number of sections updated."),
|
|
2711
2750
|
updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
|
|
2712
|
-
},
|
|
2751
|
+
}, qs = {
|
|
2713
2752
|
name: g.UPDATE_SECTIONS,
|
|
2714
2753
|
description: "Update multiple existing sections with new values.",
|
|
2715
|
-
parameters:
|
|
2716
|
-
outputSchema:
|
|
2754
|
+
parameters: Vs,
|
|
2755
|
+
outputSchema: Gs,
|
|
2717
2756
|
async execute({ sections: e }, t) {
|
|
2718
2757
|
const o = await Promise.all(
|
|
2719
2758
|
e.map((r) => t.updateSection(r.id, { name: r.name }))
|
|
2720
2759
|
);
|
|
2721
2760
|
return {
|
|
2722
|
-
textContent:
|
|
2761
|
+
textContent: Js({
|
|
2723
2762
|
sections: o
|
|
2724
2763
|
}),
|
|
2725
2764
|
structuredContent: {
|
|
@@ -2730,13 +2769,13 @@ const Ys = s.object({
|
|
|
2730
2769
|
};
|
|
2731
2770
|
}
|
|
2732
2771
|
};
|
|
2733
|
-
function
|
|
2772
|
+
function Js({ sections: e }) {
|
|
2734
2773
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
2735
2774
|
`);
|
|
2736
2775
|
return `Updated ${t} section${t === 1 ? "" : "s"}:
|
|
2737
2776
|
${o}`;
|
|
2738
2777
|
}
|
|
2739
|
-
const
|
|
2778
|
+
const Xs = s.object({
|
|
2740
2779
|
id: s.string().min(1).describe("The ID of the task to update."),
|
|
2741
2780
|
content: s.string().optional().describe(
|
|
2742
2781
|
'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.'
|
|
@@ -2764,9 +2803,9 @@ const Gs = s.object({
|
|
|
2764
2803
|
'Change task assignment. Use "unassign" to remove assignment. Can be user ID, name, or email. User must be a project collaborator.'
|
|
2765
2804
|
),
|
|
2766
2805
|
labels: s.array(s.string()).optional().describe("The new labels for the task. Replaces all existing labels.")
|
|
2767
|
-
}),
|
|
2768
|
-
tasks: s.array(
|
|
2769
|
-
},
|
|
2806
|
+
}), Zs = {
|
|
2807
|
+
tasks: s.array(Xs).min(1).describe("The tasks to update.")
|
|
2808
|
+
}, Qs = {
|
|
2770
2809
|
tasks: s.array(W).describe("The updated tasks."),
|
|
2771
2810
|
totalCount: s.number().describe("The total number of tasks updated."),
|
|
2772
2811
|
updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
|
|
@@ -2774,14 +2813,14 @@ const Gs = s.object({
|
|
|
2774
2813
|
updateCount: s.number().describe("The number of tasks actually updated."),
|
|
2775
2814
|
skippedCount: s.number().describe("The number of tasks skipped (no changes).")
|
|
2776
2815
|
}).describe("Summary of operations performed.")
|
|
2777
|
-
},
|
|
2816
|
+
}, eo = {
|
|
2778
2817
|
name: g.UPDATE_TASKS,
|
|
2779
2818
|
description: "Update existing tasks including content, dates, priorities, and assignments.",
|
|
2780
|
-
parameters:
|
|
2781
|
-
outputSchema:
|
|
2819
|
+
parameters: Zs,
|
|
2820
|
+
outputSchema: Qs,
|
|
2782
2821
|
async execute(e, t) {
|
|
2783
2822
|
const { tasks: o } = e, n = o.map(async (a) => {
|
|
2784
|
-
if (!
|
|
2823
|
+
if (!so(a))
|
|
2785
2824
|
return;
|
|
2786
2825
|
const {
|
|
2787
2826
|
id: d,
|
|
@@ -2831,13 +2870,13 @@ const Gs = s.object({
|
|
|
2831
2870
|
}
|
|
2832
2871
|
if (!P && !u && !p)
|
|
2833
2872
|
return await t.updateTask(d, h);
|
|
2834
|
-
const T =
|
|
2873
|
+
const T = Ye(d, P, u, p), C = await t.moveTask(d, T);
|
|
2835
2874
|
return Object.keys(h).length > 0 ? await t.updateTask(d, h) : C;
|
|
2836
2875
|
}), r = (await Promise.all(n)).filter(
|
|
2837
2876
|
(a) => a !== void 0
|
|
2838
2877
|
), i = r.map(O);
|
|
2839
2878
|
return {
|
|
2840
|
-
textContent:
|
|
2879
|
+
textContent: to({
|
|
2841
2880
|
tasks: i,
|
|
2842
2881
|
args: e
|
|
2843
2882
|
}),
|
|
@@ -2853,21 +2892,21 @@ const Gs = s.object({
|
|
|
2853
2892
|
};
|
|
2854
2893
|
}
|
|
2855
2894
|
};
|
|
2856
|
-
function
|
|
2895
|
+
function to({
|
|
2857
2896
|
tasks: e,
|
|
2858
2897
|
args: t
|
|
2859
2898
|
}) {
|
|
2860
2899
|
const o = t.tasks.length, n = e.length, r = o - n;
|
|
2861
2900
|
let i = "";
|
|
2862
|
-
return r > 0 && (i = ` (${r} skipped - no changes)`),
|
|
2901
|
+
return r > 0 && (i = ` (${r} skipped - no changes)`), je("Updated", e, {
|
|
2863
2902
|
context: i,
|
|
2864
2903
|
showDetails: e.length <= 5
|
|
2865
2904
|
});
|
|
2866
2905
|
}
|
|
2867
|
-
function
|
|
2906
|
+
function so({ id: e, ...t }) {
|
|
2868
2907
|
return Object.keys(t).length > 0;
|
|
2869
2908
|
}
|
|
2870
|
-
const
|
|
2909
|
+
const oo = {}, no = {
|
|
2871
2910
|
type: s.literal("user_info").describe("The type of the response."),
|
|
2872
2911
|
userId: s.string().describe("The user ID."),
|
|
2873
2912
|
fullName: s.string().describe("The full name of the user."),
|
|
@@ -2884,39 +2923,39 @@ const eo = {}, to = {
|
|
|
2884
2923
|
email: s.string().describe("The email address of the user."),
|
|
2885
2924
|
plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
|
|
2886
2925
|
};
|
|
2887
|
-
function
|
|
2926
|
+
function ro(e) {
|
|
2888
2927
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
2889
2928
|
}
|
|
2890
|
-
function
|
|
2929
|
+
function io(e, t) {
|
|
2891
2930
|
const n = ((e.getDay() || 7) - t + 7) % 7, r = new Date(e);
|
|
2892
2931
|
return r.setDate(e.getDate() - n), r;
|
|
2893
2932
|
}
|
|
2894
|
-
function
|
|
2933
|
+
function ao(e) {
|
|
2895
2934
|
const t = new Date(e);
|
|
2896
2935
|
return t.setDate(e.getDate() + 6), t;
|
|
2897
2936
|
}
|
|
2898
|
-
function
|
|
2937
|
+
function co(e) {
|
|
2899
2938
|
const t = new Date(e.getFullYear(), 0, 1), o = (e.getTime() - t.getTime()) / 864e5;
|
|
2900
2939
|
return Math.ceil((o + t.getDay() + 1) / 7);
|
|
2901
2940
|
}
|
|
2902
|
-
function
|
|
2941
|
+
function lo(e) {
|
|
2903
2942
|
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
|
|
2904
2943
|
}
|
|
2905
2944
|
function z(e) {
|
|
2906
2945
|
return e.toISOString().split("T")[0] ?? "";
|
|
2907
2946
|
}
|
|
2908
|
-
function
|
|
2947
|
+
function uo(e) {
|
|
2909
2948
|
try {
|
|
2910
2949
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
2911
2950
|
} catch {
|
|
2912
2951
|
return !1;
|
|
2913
2952
|
}
|
|
2914
2953
|
}
|
|
2915
|
-
function
|
|
2916
|
-
return
|
|
2954
|
+
function xe(e) {
|
|
2955
|
+
return uo(e) ? e : "UTC";
|
|
2917
2956
|
}
|
|
2918
|
-
function
|
|
2919
|
-
const o =
|
|
2957
|
+
function po(e, t) {
|
|
2958
|
+
const o = xe(t);
|
|
2920
2959
|
return e.toLocaleString("en-US", {
|
|
2921
2960
|
timeZone: o,
|
|
2922
2961
|
year: "numeric",
|
|
@@ -2928,8 +2967,8 @@ function co(e, t) {
|
|
|
2928
2967
|
hour12: !1
|
|
2929
2968
|
});
|
|
2930
2969
|
}
|
|
2931
|
-
async function
|
|
2932
|
-
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", n =
|
|
2970
|
+
async function ho(e) {
|
|
2971
|
+
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", n = xe(o), r = /* @__PURE__ */ new Date(), i = po(r, n), c = t.startDay ?? 1, a = lo(c), d = ro(t), l = new Date(r.toLocaleString("en-US", { timeZone: n })), u = io(l, c), p = ao(u), b = co(l), y = [
|
|
2933
2972
|
"# User Information",
|
|
2934
2973
|
"",
|
|
2935
2974
|
`**User ID:** ${t.id}`,
|
|
@@ -2971,19 +3010,19 @@ async function lo(e) {
|
|
|
2971
3010
|
};
|
|
2972
3011
|
return { textContent: y, structuredContent: k };
|
|
2973
3012
|
}
|
|
2974
|
-
const
|
|
3013
|
+
const mo = {
|
|
2975
3014
|
name: g.USER_INFO,
|
|
2976
3015
|
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).",
|
|
2977
|
-
parameters:
|
|
2978
|
-
outputSchema:
|
|
3016
|
+
parameters: oo,
|
|
3017
|
+
outputSchema: no,
|
|
2979
3018
|
async execute(e, t) {
|
|
2980
|
-
const o = await
|
|
3019
|
+
const o = await ho(t);
|
|
2981
3020
|
return {
|
|
2982
3021
|
textContent: o.textContent,
|
|
2983
3022
|
structuredContent: o.structuredContent
|
|
2984
3023
|
};
|
|
2985
3024
|
}
|
|
2986
|
-
},
|
|
3025
|
+
}, fo = `
|
|
2987
3026
|
## Todoist Task and Project Management Tools
|
|
2988
3027
|
|
|
2989
3028
|
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.
|
|
@@ -3051,41 +3090,41 @@ You have access to comprehensive Todoist management tools for personal productiv
|
|
|
3051
3090
|
|
|
3052
3091
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
3053
3092
|
`;
|
|
3054
|
-
function
|
|
3055
|
-
const o = new
|
|
3093
|
+
function ko({ todoistApiKey: e, baseUrl: t }) {
|
|
3094
|
+
const o = new Ue(
|
|
3056
3095
|
{ name: "todoist-mcp-server", version: "0.1.0" },
|
|
3057
3096
|
{
|
|
3058
3097
|
capabilities: {
|
|
3059
3098
|
tools: { listChanged: !0 }
|
|
3060
3099
|
},
|
|
3061
|
-
instructions:
|
|
3100
|
+
instructions: fo
|
|
3062
3101
|
}
|
|
3063
|
-
), n = new
|
|
3064
|
-
return I(
|
|
3102
|
+
), n = new Ae(e, { baseUrl: t });
|
|
3103
|
+
return I(yt, o, n), I(vt, o, n), I(eo, o, n), I(us, o, n), I(fs, o, n), I(Ht, o, n), I(nt, o, n), I(Ys, o, n), I(ss, o, n), I(dt, o, n), I(qs, o, n), I(as, o, n), I(Qe, o, n), I(Bt, o, n), I(Fs, o, n), I(Ot, o, n), I(Cs, o, n), I(Dt, o, n), I(mo, o, n), I(Xt, o, n), I(Us, o, n), I(Os, o, n), I(Ut, o, n), o;
|
|
3065
3104
|
}
|
|
3066
3105
|
export {
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3106
|
+
Xt as a,
|
|
3107
|
+
Cs as b,
|
|
3108
|
+
Ot as c,
|
|
3109
|
+
Dt as d,
|
|
3110
|
+
Bt as e,
|
|
3111
|
+
Ut as f,
|
|
3112
|
+
ko as g,
|
|
3113
|
+
Fs as h,
|
|
3114
|
+
Qe as i,
|
|
3115
|
+
as as j,
|
|
3116
|
+
qs as k,
|
|
3117
|
+
dt as l,
|
|
3118
|
+
Us as m,
|
|
3119
|
+
ss as n,
|
|
3120
|
+
Ys as o,
|
|
3121
|
+
nt as p,
|
|
3122
|
+
Ht as q,
|
|
3123
|
+
fs as r,
|
|
3124
|
+
Os as s,
|
|
3125
|
+
us as t,
|
|
3126
|
+
mo as u,
|
|
3127
|
+
eo as v,
|
|
3128
|
+
vt as w,
|
|
3129
|
+
yt as x
|
|
3091
3130
|
};
|