@doist/todoist-ai 4.17.4 → 5.0.0
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 +20 -20
- package/dist/index.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-Dmes0pXt.js → mcp-server-CLyVslzE.js} +327 -328
- package/dist/tool-helpers.d.ts +2 -2
- package/dist/tools/add-tasks.d.ts +4 -4
- package/dist/tools/find-completed-tasks.d.ts +4 -4
- package/dist/tools/find-tasks-by-date.d.ts +4 -4
- package/dist/tools/find-tasks.d.ts +4 -4
- package/dist/tools/update-tasks.d.ts +4 -4
- package/dist/utils/output-schemas.d.ts +3 -3
- package/dist/utils/output-schemas.d.ts.map +1 -1
- package/dist/utils/priorities.d.ts +0 -2
- package/dist/utils/priorities.d.ts.map +1 -1
- package/dist/utils/response-builders.d.ts +2 -1
- package/dist/utils/response-builders.d.ts.map +1 -1
- package/dist/utils/test-helpers.d.ts +6 -1
- package/dist/utils/test-helpers.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getTaskUrl as
|
|
1
|
+
import { getTaskUrl as me, getProjectUrl as fe, TodoistApi as De } from "@doist/todoist-api-typescript";
|
|
2
2
|
import { McpServer as xe } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import F, { z as s } from "zod";
|
|
4
|
-
import { addDays as
|
|
4
|
+
import { addDays as be, formatISO as Ae } from "date-fns";
|
|
5
5
|
function X(e) {
|
|
6
6
|
if (e == null)
|
|
7
7
|
return e;
|
|
@@ -71,7 +71,7 @@ class U extends Error {
|
|
|
71
71
|
super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function ge(e) {
|
|
75
75
|
if (!e || typeof e != "string")
|
|
76
76
|
throw new U(e, "Duration must be a non-empty string");
|
|
77
77
|
const t = e.trim().toLowerCase().replace(/\s+/g, "");
|
|
@@ -110,20 +110,17 @@ function Oe(e) {
|
|
|
110
110
|
const t = Math.floor(e / 60), o = e % 60;
|
|
111
111
|
return t === 0 ? `${o}m` : o === 0 ? `${t}h` : `${t}h${o}m`;
|
|
112
112
|
}
|
|
113
|
-
const _e = ["p1", "p2", "p3", "p4"],
|
|
113
|
+
const _e = ["p1", "p2", "p3", "p4"], Q = s.enum(_e, {
|
|
114
114
|
description: "Task priority: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)"
|
|
115
115
|
});
|
|
116
116
|
function Te(e) {
|
|
117
117
|
return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
|
|
118
118
|
}
|
|
119
119
|
function Ne(e) {
|
|
120
|
-
return {
|
|
121
|
-
}
|
|
122
|
-
function Me(e) {
|
|
123
|
-
return { 4: 1, 3: 2, 2: 3, 1: 4 }[e] || e;
|
|
120
|
+
return { 4: "p1", 3: "p2", 2: "p3", 1: "p4" }[e];
|
|
124
121
|
}
|
|
125
122
|
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), G = 300 * 1e3;
|
|
126
|
-
class
|
|
123
|
+
class Me {
|
|
127
124
|
/**
|
|
128
125
|
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
129
126
|
* Supports exact name matches, partial matches, and email matches.
|
|
@@ -228,15 +225,15 @@ class Fe {
|
|
|
228
225
|
A.clear(), R.clear();
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
|
-
const _ = new
|
|
232
|
-
async function
|
|
228
|
+
const _ = new Me();
|
|
229
|
+
async function Fe(e, t) {
|
|
233
230
|
return _.resolveUser(e, t);
|
|
234
231
|
}
|
|
235
232
|
const ye = ["assigned", "unassignedOrMe", "all"];
|
|
236
|
-
async function
|
|
233
|
+
async function ee(e, t) {
|
|
237
234
|
if (!t)
|
|
238
235
|
return;
|
|
239
|
-
const o = await
|
|
236
|
+
const o = await Fe(e, t);
|
|
240
237
|
if (!o)
|
|
241
238
|
throw new Error(
|
|
242
239
|
`Could not find user: "${t}". Make sure the user is a collaborator on a shared project.`
|
|
@@ -246,14 +243,14 @@ async function Q(e, t) {
|
|
|
246
243
|
function K(e, t) {
|
|
247
244
|
return t.length === 0 ? e : e.length === 0 ? t : `${e} & ${t}`;
|
|
248
245
|
}
|
|
249
|
-
function
|
|
246
|
+
function Re({
|
|
250
247
|
resolvedAssigneeId: e,
|
|
251
248
|
assigneeEmail: t,
|
|
252
249
|
responsibleUserFiltering: o = "unassignedOrMe"
|
|
253
250
|
}) {
|
|
254
251
|
return e && t ? `assigned to: ${t}` : o === "unassignedOrMe" ? "!assigned to: others" : o === "assigned" ? "assigned to: others" : "";
|
|
255
252
|
}
|
|
256
|
-
function
|
|
253
|
+
function de({
|
|
257
254
|
tasks: e,
|
|
258
255
|
resolvedAssigneeId: t,
|
|
259
256
|
currentUserId: o,
|
|
@@ -264,7 +261,7 @@ function ce({
|
|
|
264
261
|
function B(e) {
|
|
265
262
|
return "inboxProject" in e;
|
|
266
263
|
}
|
|
267
|
-
function
|
|
264
|
+
function Le(e, t, o, n) {
|
|
268
265
|
const r = [t, o, n].filter(Boolean);
|
|
269
266
|
if (r.length > 1)
|
|
270
267
|
throw new Error(
|
|
@@ -287,7 +284,7 @@ function O(e) {
|
|
|
287
284
|
dueDate: e.due?.date,
|
|
288
285
|
recurring: e.due?.isRecurring && e.due.string ? e.due.string : !1,
|
|
289
286
|
deadlineDate: e.deadline?.date,
|
|
290
|
-
priority:
|
|
287
|
+
priority: Ne(e.priority) ?? "p4",
|
|
291
288
|
projectId: e.projectId,
|
|
292
289
|
sectionId: e.sectionId ?? void 0,
|
|
293
290
|
parentId: e.parentId ?? void 0,
|
|
@@ -311,7 +308,7 @@ function Ie(e) {
|
|
|
311
308
|
viewStyle: e.viewStyle
|
|
312
309
|
};
|
|
313
310
|
}
|
|
314
|
-
function
|
|
311
|
+
function te(e) {
|
|
315
312
|
return {
|
|
316
313
|
id: e.id,
|
|
317
314
|
taskId: e.taskId ?? void 0,
|
|
@@ -335,7 +332,7 @@ function ee(e) {
|
|
|
335
332
|
} : void 0
|
|
336
333
|
};
|
|
337
334
|
}
|
|
338
|
-
function
|
|
335
|
+
function Be(e) {
|
|
339
336
|
return {
|
|
340
337
|
id: e.id ?? void 0,
|
|
341
338
|
objectType: e.objectType,
|
|
@@ -348,7 +345,7 @@ function We(e) {
|
|
|
348
345
|
extraData: e.extraData ?? void 0
|
|
349
346
|
};
|
|
350
347
|
}
|
|
351
|
-
const
|
|
348
|
+
const We = F.object({
|
|
352
349
|
httpStatusCode: F.number(),
|
|
353
350
|
responseData: F.object({
|
|
354
351
|
error: F.string(),
|
|
@@ -356,7 +353,7 @@ const Ye = F.object({
|
|
|
356
353
|
errorTag: F.string()
|
|
357
354
|
})
|
|
358
355
|
});
|
|
359
|
-
async function
|
|
356
|
+
async function se({
|
|
360
357
|
client: e,
|
|
361
358
|
query: t,
|
|
362
359
|
limit: o,
|
|
@@ -366,7 +363,7 @@ async function te({
|
|
|
366
363
|
const { results: r, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: n, limit: o });
|
|
367
364
|
return { tasks: r.map(O), nextCursor: i };
|
|
368
365
|
} catch (r) {
|
|
369
|
-
const i =
|
|
366
|
+
const i = We.safeParse(r);
|
|
370
367
|
if (!i.success)
|
|
371
368
|
throw r;
|
|
372
369
|
const { responseData: c } = i.data;
|
|
@@ -382,7 +379,9 @@ const W = s.object({
|
|
|
382
379
|
dueDate: s.string().optional().describe("The due date of the task (ISO 8601 format)."),
|
|
383
380
|
recurring: s.union([s.boolean(), s.string()]).describe("Whether the task is recurring, or the recurrence string."),
|
|
384
381
|
deadlineDate: s.string().optional().describe("The deadline date of the task (ISO 8601 format)."),
|
|
385
|
-
priority:
|
|
382
|
+
priority: Q.describe(
|
|
383
|
+
"The priority level: p1 (highest), p2 (high), p3 (medium), p4 (lowest)."
|
|
384
|
+
),
|
|
386
385
|
projectId: s.string().describe("The ID of the project this task belongs to."),
|
|
387
386
|
sectionId: s.string().optional().describe("The ID of the section this task belongs to."),
|
|
388
387
|
parentId: s.string().optional().describe("The ID of the parent task (for subtasks)."),
|
|
@@ -392,7 +391,7 @@ const W = s.object({
|
|
|
392
391
|
assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
|
|
393
392
|
checked: s.boolean().describe("Whether the task is checked/completed."),
|
|
394
393
|
completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
|
|
395
|
-
}),
|
|
394
|
+
}), oe = s.object({
|
|
396
395
|
id: s.string().describe("The unique ID of the project."),
|
|
397
396
|
name: s.string().describe("The name of the project."),
|
|
398
397
|
color: s.string().describe("The color of the project."),
|
|
@@ -401,10 +400,10 @@ const W = s.object({
|
|
|
401
400
|
parentId: s.string().optional().describe("The ID of the parent project (for sub-projects)."),
|
|
402
401
|
inboxProject: s.boolean().describe("Whether this is the inbox project."),
|
|
403
402
|
viewStyle: s.string().describe("The view style of the project (list, board, calendar).")
|
|
404
|
-
}),
|
|
403
|
+
}), ne = s.object({
|
|
405
404
|
id: s.string().describe("The unique ID of the section."),
|
|
406
405
|
name: s.string().describe("The name of the section.")
|
|
407
|
-
}),
|
|
406
|
+
}), Ye = s.object({
|
|
408
407
|
resourceType: s.string().describe("The type of resource (file, url, image, etc)."),
|
|
409
408
|
fileName: s.string().optional().describe("The name of the file."),
|
|
410
409
|
fileSize: s.number().optional().describe("The size of the file in bytes."),
|
|
@@ -417,15 +416,15 @@ const W = s.object({
|
|
|
417
416
|
image: s.string().optional().describe("The image URL for image resource types."),
|
|
418
417
|
imageWidth: s.number().optional().describe("The width of the image in pixels."),
|
|
419
418
|
imageHeight: s.number().optional().describe("The height of the image in pixels.")
|
|
420
|
-
}),
|
|
419
|
+
}), re = s.object({
|
|
421
420
|
id: s.string().describe("The unique ID of the comment."),
|
|
422
421
|
taskId: s.string().optional().describe("The ID of the task this comment belongs to."),
|
|
423
422
|
projectId: s.string().optional().describe("The ID of the project this comment belongs to."),
|
|
424
423
|
content: s.string().describe("The content of the comment."),
|
|
425
424
|
postedAt: s.string().describe("When the comment was posted (ISO 8601 format)."),
|
|
426
425
|
postedUid: s.string().optional().describe("The UID of the user who posted this comment."),
|
|
427
|
-
fileAttachment:
|
|
428
|
-
}),
|
|
426
|
+
fileAttachment: Ye.optional().describe("File attachment information, if any.")
|
|
427
|
+
}), ze = s.object({
|
|
429
428
|
id: s.string().optional().describe("The unique ID of the activity event."),
|
|
430
429
|
objectType: s.string().describe("The type of object this event relates to (task, project, etc)."),
|
|
431
430
|
objectId: s.string().describe("The ID of the object this event relates to."),
|
|
@@ -435,11 +434,11 @@ const W = s.object({
|
|
|
435
434
|
parentItemId: s.string().optional().describe("The ID of the parent item."),
|
|
436
435
|
initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
|
|
437
436
|
extraData: s.record(s.unknown()).optional().describe("Additional event data.")
|
|
438
|
-
}),
|
|
437
|
+
}), Ke = s.object({
|
|
439
438
|
id: s.string().describe("The unique ID of the user."),
|
|
440
439
|
name: s.string().describe("The full name of the user."),
|
|
441
440
|
email: s.string().describe("The email address of the user.")
|
|
442
|
-
}),
|
|
441
|
+
}), He = s.object({
|
|
443
442
|
item: s.string().describe("The item that failed (usually an ID or identifier)."),
|
|
444
443
|
error: s.string().describe("The error message."),
|
|
445
444
|
code: s.string().optional().describe("The error code, if available.")
|
|
@@ -475,23 +474,23 @@ const W = s.object({
|
|
|
475
474
|
// OpenAI MCP tools
|
|
476
475
|
SEARCH: "search",
|
|
477
476
|
FETCH: "fetch"
|
|
478
|
-
},
|
|
477
|
+
}, Ve = s.object({
|
|
479
478
|
taskId: s.string().optional().describe("The ID of the task to comment on."),
|
|
480
479
|
projectId: s.string().optional().describe(
|
|
481
480
|
'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
482
481
|
),
|
|
483
482
|
content: s.string().min(1).describe("The content of the comment.")
|
|
484
|
-
}),
|
|
485
|
-
comments: s.array(
|
|
486
|
-
},
|
|
487
|
-
comments: s.array(
|
|
483
|
+
}), Ge = {
|
|
484
|
+
comments: s.array(Ve).min(1).describe("The array of comments to add.")
|
|
485
|
+
}, qe = {
|
|
486
|
+
comments: s.array(re).describe("The created comments."),
|
|
488
487
|
totalCount: s.number().describe("The total number of comments created."),
|
|
489
488
|
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
490
|
-
},
|
|
489
|
+
}, Je = {
|
|
491
490
|
name: g.ADD_COMMENTS,
|
|
492
491
|
description: "Add multiple comments to tasks or projects. Each comment must specify either taskId or projectId.",
|
|
493
|
-
parameters:
|
|
494
|
-
outputSchema:
|
|
492
|
+
parameters: Ge,
|
|
493
|
+
outputSchema: qe,
|
|
495
494
|
async execute(e, t) {
|
|
496
495
|
const { comments: o } = e;
|
|
497
496
|
for (const [l, u] of o.entries()) {
|
|
@@ -510,9 +509,9 @@ const W = s.object({
|
|
|
510
509
|
content: l,
|
|
511
510
|
...u ? { taskId: u } : { projectId: b }
|
|
512
511
|
});
|
|
513
|
-
}), a = (await Promise.all(i)).map(
|
|
512
|
+
}), a = (await Promise.all(i)).map(te);
|
|
514
513
|
return {
|
|
515
|
-
textContent:
|
|
514
|
+
textContent: Xe({ comments: a }),
|
|
516
515
|
structuredContent: {
|
|
517
516
|
comments: a,
|
|
518
517
|
totalCount: a.length,
|
|
@@ -521,7 +520,7 @@ const W = s.object({
|
|
|
521
520
|
};
|
|
522
521
|
}
|
|
523
522
|
};
|
|
524
|
-
function
|
|
523
|
+
function Xe({ comments: e }) {
|
|
525
524
|
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
526
525
|
if (t > 0) {
|
|
527
526
|
const i = t > 1 ? "comments" : "comment";
|
|
@@ -533,23 +532,23 @@ function Ze({ comments: e }) {
|
|
|
533
532
|
}
|
|
534
533
|
return n.length > 0 ? `Added ${n.join(" and ")}` : "No comments added";
|
|
535
534
|
}
|
|
536
|
-
const
|
|
535
|
+
const Ze = s.object({
|
|
537
536
|
name: s.string().min(1).describe("The name of the project."),
|
|
538
537
|
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
539
538
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
540
539
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe('The project view style. Defaults to "list".')
|
|
541
|
-
}),
|
|
542
|
-
projects: s.array(
|
|
543
|
-
},
|
|
544
|
-
projects: s.array(
|
|
540
|
+
}), Qe = {
|
|
541
|
+
projects: s.array(Ze).min(1).describe("The array of projects to add.")
|
|
542
|
+
}, et = {
|
|
543
|
+
projects: s.array(oe).describe("The created projects."),
|
|
545
544
|
totalCount: s.number().describe("The total number of projects created.")
|
|
546
|
-
},
|
|
545
|
+
}, tt = {
|
|
547
546
|
name: g.ADD_PROJECTS,
|
|
548
547
|
description: "Add one or more new projects.",
|
|
549
|
-
parameters:
|
|
550
|
-
outputSchema:
|
|
548
|
+
parameters: Qe,
|
|
549
|
+
outputSchema: et,
|
|
551
550
|
async execute({ projects: e }, t) {
|
|
552
|
-
const o = await Promise.all(e.map((i) => t.addProject(i))), n =
|
|
551
|
+
const o = await Promise.all(e.map((i) => t.addProject(i))), n = st({ projects: o }), r = o.map((i) => ({
|
|
553
552
|
...i,
|
|
554
553
|
parentId: "parentId" in i ? i.parentId ?? void 0 : void 0,
|
|
555
554
|
inboxProject: "inboxProject" in i ? i.inboxProject : !1
|
|
@@ -563,27 +562,27 @@ const Qe = s.object({
|
|
|
563
562
|
};
|
|
564
563
|
}
|
|
565
564
|
};
|
|
566
|
-
function
|
|
565
|
+
function st({ projects: e }) {
|
|
567
566
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id})`).join(`
|
|
568
567
|
`);
|
|
569
568
|
return `Added ${t} project${t === 1 ? "" : "s"}:
|
|
570
569
|
${o}`;
|
|
571
570
|
}
|
|
572
|
-
const
|
|
571
|
+
const ot = s.object({
|
|
573
572
|
name: s.string().min(1).describe("The name of the section."),
|
|
574
573
|
projectId: s.string().min(1).describe(
|
|
575
574
|
'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
576
575
|
)
|
|
577
|
-
}),
|
|
578
|
-
sections: s.array(
|
|
579
|
-
},
|
|
580
|
-
sections: s.array(
|
|
576
|
+
}), nt = {
|
|
577
|
+
sections: s.array(ot).min(1).describe("The array of sections to add.")
|
|
578
|
+
}, rt = {
|
|
579
|
+
sections: s.array(ne).describe("The created sections."),
|
|
581
580
|
totalCount: s.number().describe("The total number of sections created.")
|
|
582
|
-
},
|
|
581
|
+
}, it = {
|
|
583
582
|
name: g.ADD_SECTIONS,
|
|
584
583
|
description: "Add one or more new sections to projects.",
|
|
585
|
-
parameters:
|
|
586
|
-
outputSchema:
|
|
584
|
+
parameters: nt,
|
|
585
|
+
outputSchema: rt,
|
|
587
586
|
async execute({ sections: e }, t) {
|
|
588
587
|
const n = e.some((a) => a.projectId === "inbox") ? await t.getUser() : null, r = e.map((a) => ({
|
|
589
588
|
...a,
|
|
@@ -592,7 +591,7 @@ const nt = s.object({
|
|
|
592
591
|
r.map((a) => t.addSection(a))
|
|
593
592
|
);
|
|
594
593
|
return {
|
|
595
|
-
textContent:
|
|
594
|
+
textContent: at({ sections: i }),
|
|
596
595
|
structuredContent: {
|
|
597
596
|
sections: i,
|
|
598
597
|
totalCount: i.length
|
|
@@ -600,7 +599,7 @@ const nt = s.object({
|
|
|
600
599
|
};
|
|
601
600
|
}
|
|
602
601
|
};
|
|
603
|
-
function
|
|
602
|
+
function at({ sections: e }) {
|
|
604
603
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
605
604
|
`);
|
|
606
605
|
return `Added ${t} section${t === 1 ? "" : "s"}:
|
|
@@ -615,7 +614,7 @@ const L = {
|
|
|
615
614
|
PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
|
|
616
615
|
TASK_NOT_FOUND: "TASK_NOT_FOUND"
|
|
617
616
|
};
|
|
618
|
-
class
|
|
617
|
+
class ct {
|
|
619
618
|
/**
|
|
620
619
|
* Validate a single assignment operation
|
|
621
620
|
*/
|
|
@@ -824,7 +823,7 @@ class dt {
|
|
|
824
823
|
};
|
|
825
824
|
}
|
|
826
825
|
}
|
|
827
|
-
const
|
|
826
|
+
const ie = new ct(), $ = {
|
|
828
827
|
/** Default limit for task listings */
|
|
829
828
|
TASKS_DEFAULT: 10,
|
|
830
829
|
/** Maximum limit for task search and list operations */
|
|
@@ -851,7 +850,7 @@ const re = new dt(), $ = {
|
|
|
851
850
|
/** Maximum number of failures to show in detailed error messages */
|
|
852
851
|
MAX_FAILURES_SHOWN: 3
|
|
853
852
|
};
|
|
854
|
-
function
|
|
853
|
+
function dt(e = /* @__PURE__ */ new Date()) {
|
|
855
854
|
return e.toISOString().split("T")[0] ?? "";
|
|
856
855
|
}
|
|
857
856
|
function ke(e, t, o = {}) {
|
|
@@ -869,7 +868,7 @@ ${u}${p}.`);
|
|
|
869
868
|
return c.join(`
|
|
870
869
|
`);
|
|
871
870
|
}
|
|
872
|
-
function
|
|
871
|
+
function lt(e) {
|
|
873
872
|
const { action: t, success: o, total: n, successItems: r, failures: i } = e, c = [], a = `${t}: ${o}/${n} successful.`;
|
|
874
873
|
if (c.push(a), r?.length && r.length <= 5 && c.push(`Completed:
|
|
875
874
|
${r.map((d) => ` ${d}`).join(`
|
|
@@ -884,16 +883,16 @@ ${i.slice(0, q.MAX_FAILURES_SHOWN).map((u) => ` ${u.item} (Error: ${u.error}$
|
|
|
884
883
|
return c.join(`
|
|
885
884
|
`);
|
|
886
885
|
}
|
|
887
|
-
function
|
|
888
|
-
const t = e.content || e.title || "Untitled", o = e.dueDate ? ` • due ${e.dueDate}` : "", n = e.priority ? ` • ${
|
|
886
|
+
function ut(e) {
|
|
887
|
+
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}` : "";
|
|
889
888
|
return ` ${t}${o}${n}${r}${i}`;
|
|
890
889
|
}
|
|
891
|
-
function
|
|
890
|
+
function pt(e) {
|
|
892
891
|
const t = e.inboxProject ? " • Inbox" : "", o = e.isFavorite ? " • ⭐" : "", n = e.isShared ? " • Shared" : "", r = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
|
|
893
892
|
return ` ${e.name}${t}${o}${n}${r}${i}`;
|
|
894
893
|
}
|
|
895
894
|
function H(e, t = 5) {
|
|
896
|
-
const n = e.slice(0, t).map(
|
|
895
|
+
const n = e.slice(0, t).map(ut).join(`
|
|
897
896
|
`);
|
|
898
897
|
if (e.length > t) {
|
|
899
898
|
const r = e.length - t;
|
|
@@ -923,14 +922,14 @@ function we(e, t) {
|
|
|
923
922
|
${o.map((r) => `- ${r}`).join(`
|
|
924
923
|
`)}`;
|
|
925
924
|
}
|
|
926
|
-
const
|
|
925
|
+
const ht = s.object({
|
|
927
926
|
content: s.string().min(1).describe(
|
|
928
927
|
'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.'
|
|
929
928
|
),
|
|
930
929
|
description: s.string().optional().describe(
|
|
931
930
|
"Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."
|
|
932
931
|
),
|
|
933
|
-
priority:
|
|
932
|
+
priority: Q.optional().describe(
|
|
934
933
|
"The priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
935
934
|
),
|
|
936
935
|
dueString: s.string().optional().describe("The due date for the task, in natural language."),
|
|
@@ -949,20 +948,20 @@ const mt = s.object({
|
|
|
949
948
|
responsibleUser: s.string().optional().describe(
|
|
950
949
|
"Assign task to this user. Can be a user ID, name, or email address. User must be a collaborator on the target project."
|
|
951
950
|
)
|
|
952
|
-
}),
|
|
953
|
-
tasks: s.array(
|
|
954
|
-
},
|
|
951
|
+
}), mt = {
|
|
952
|
+
tasks: s.array(ht).min(1).describe("The array of tasks to add.")
|
|
953
|
+
}, ft = {
|
|
955
954
|
tasks: s.array(W).describe("The created tasks."),
|
|
956
955
|
totalCount: s.number().describe("The total number of tasks created.")
|
|
957
|
-
},
|
|
956
|
+
}, bt = {
|
|
958
957
|
name: g.ADD_TASKS,
|
|
959
958
|
description: "Add one or more tasks to a project, section, or parent. Supports assignment to project collaborators.",
|
|
960
|
-
parameters:
|
|
961
|
-
outputSchema:
|
|
959
|
+
parameters: mt,
|
|
960
|
+
outputSchema: ft,
|
|
962
961
|
async execute({ tasks: e }, t) {
|
|
963
|
-
const o = e.map((c) =>
|
|
962
|
+
const o = e.map((c) => gt(c, t)), r = (await Promise.all(o)).map(O);
|
|
964
963
|
return {
|
|
965
|
-
textContent:
|
|
964
|
+
textContent: Tt({
|
|
966
965
|
tasks: r,
|
|
967
966
|
args: { tasks: e }
|
|
968
967
|
}),
|
|
@@ -973,7 +972,7 @@ const mt = s.object({
|
|
|
973
972
|
};
|
|
974
973
|
}
|
|
975
974
|
};
|
|
976
|
-
async function
|
|
975
|
+
async function gt(e, t) {
|
|
977
976
|
const {
|
|
978
977
|
duration: o,
|
|
979
978
|
projectId: n,
|
|
@@ -1001,7 +1000,7 @@ async function Tt(e, t) {
|
|
|
1001
1000
|
);
|
|
1002
1001
|
if (o)
|
|
1003
1002
|
try {
|
|
1004
|
-
const { minutes: m } =
|
|
1003
|
+
const { minutes: m } = ge(o);
|
|
1005
1004
|
b = {
|
|
1006
1005
|
...b,
|
|
1007
1006
|
duration: m,
|
|
@@ -1026,7 +1025,7 @@ async function Tt(e, t) {
|
|
|
1026
1025
|
throw new Error(
|
|
1027
1026
|
`Task "${e.content}": Cannot determine target project for assignment validation`
|
|
1028
1027
|
);
|
|
1029
|
-
const y = await
|
|
1028
|
+
const y = await ie.validateTaskCreationAssignment(
|
|
1030
1029
|
t,
|
|
1031
1030
|
m,
|
|
1032
1031
|
c
|
|
@@ -1041,7 +1040,7 @@ async function Tt(e, t) {
|
|
|
1041
1040
|
}
|
|
1042
1041
|
return await t.addTask(b);
|
|
1043
1042
|
}
|
|
1044
|
-
function
|
|
1043
|
+
function Tt({
|
|
1045
1044
|
tasks: e,
|
|
1046
1045
|
args: t
|
|
1047
1046
|
}) {
|
|
@@ -1058,19 +1057,19 @@ function yt({
|
|
|
1058
1057
|
showDetails: !0
|
|
1059
1058
|
});
|
|
1060
1059
|
}
|
|
1061
|
-
const
|
|
1060
|
+
const yt = {
|
|
1062
1061
|
ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to complete.")
|
|
1063
|
-
},
|
|
1062
|
+
}, It = {
|
|
1064
1063
|
completed: s.array(s.string()).describe("The IDs of successfully completed tasks."),
|
|
1065
|
-
failures: s.array(
|
|
1064
|
+
failures: s.array(He).describe("Failed task completions with error details."),
|
|
1066
1065
|
totalRequested: s.number().describe("The total number of tasks requested to complete."),
|
|
1067
1066
|
successCount: s.number().describe("The number of successfully completed tasks."),
|
|
1068
1067
|
failureCount: s.number().describe("The number of failed task completions.")
|
|
1069
|
-
},
|
|
1068
|
+
}, kt = {
|
|
1070
1069
|
name: g.COMPLETE_TASKS,
|
|
1071
1070
|
description: "Complete one or more tasks by their IDs.",
|
|
1072
|
-
parameters:
|
|
1073
|
-
outputSchema:
|
|
1071
|
+
parameters: yt,
|
|
1072
|
+
outputSchema: It,
|
|
1074
1073
|
async execute(e, t) {
|
|
1075
1074
|
const o = [], n = [];
|
|
1076
1075
|
for (const i of e.ids)
|
|
@@ -1084,7 +1083,7 @@ const It = {
|
|
|
1084
1083
|
});
|
|
1085
1084
|
}
|
|
1086
1085
|
return {
|
|
1087
|
-
textContent:
|
|
1086
|
+
textContent: wt({
|
|
1088
1087
|
completed: o,
|
|
1089
1088
|
failures: n,
|
|
1090
1089
|
args: e
|
|
@@ -1099,12 +1098,12 @@ const It = {
|
|
|
1099
1098
|
};
|
|
1100
1099
|
}
|
|
1101
1100
|
};
|
|
1102
|
-
function
|
|
1101
|
+
function wt({
|
|
1103
1102
|
completed: e,
|
|
1104
1103
|
failures: t,
|
|
1105
1104
|
args: o
|
|
1106
1105
|
}) {
|
|
1107
|
-
return
|
|
1106
|
+
return lt({
|
|
1108
1107
|
action: "Completed tasks",
|
|
1109
1108
|
success: e.length,
|
|
1110
1109
|
total: o.ids.length,
|
|
@@ -1112,20 +1111,20 @@ function jt({
|
|
|
1112
1111
|
failures: t
|
|
1113
1112
|
});
|
|
1114
1113
|
}
|
|
1115
|
-
const
|
|
1114
|
+
const jt = {
|
|
1116
1115
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of entity to delete."),
|
|
1117
1116
|
id: s.string().min(1).describe("The ID of the entity to delete.")
|
|
1118
|
-
},
|
|
1117
|
+
}, vt = {
|
|
1119
1118
|
deletedEntity: s.object({
|
|
1120
1119
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of deleted entity."),
|
|
1121
1120
|
id: s.string().describe("The ID of the deleted entity.")
|
|
1122
1121
|
}).describe("Information about the deleted entity."),
|
|
1123
1122
|
success: s.boolean().describe("Whether the deletion was successful.")
|
|
1124
|
-
},
|
|
1123
|
+
}, Ct = {
|
|
1125
1124
|
name: g.DELETE_OBJECT,
|
|
1126
1125
|
description: "Delete a project, section, task, or comment by its ID.",
|
|
1127
|
-
parameters:
|
|
1128
|
-
outputSchema:
|
|
1126
|
+
parameters: jt,
|
|
1127
|
+
outputSchema: vt,
|
|
1129
1128
|
async execute(e, t) {
|
|
1130
1129
|
switch (e.type) {
|
|
1131
1130
|
case "project":
|
|
@@ -1149,21 +1148,21 @@ const vt = {
|
|
|
1149
1148
|
}
|
|
1150
1149
|
};
|
|
1151
1150
|
}
|
|
1152
|
-
},
|
|
1151
|
+
}, St = {
|
|
1153
1152
|
id: s.string().min(1).describe(
|
|
1154
1153
|
'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
|
|
1155
1154
|
)
|
|
1156
|
-
},
|
|
1155
|
+
}, $t = {
|
|
1157
1156
|
id: s.string().describe("The ID of the fetched document."),
|
|
1158
1157
|
title: s.string().describe("The title of the document."),
|
|
1159
1158
|
text: s.string().describe("The text content of the document."),
|
|
1160
1159
|
url: s.string().describe("The URL of the document."),
|
|
1161
1160
|
metadata: s.record(s.unknown()).optional().describe("Additional metadata about the document.")
|
|
1162
|
-
},
|
|
1161
|
+
}, Dt = {
|
|
1163
1162
|
name: g.FETCH,
|
|
1164
1163
|
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}".',
|
|
1165
|
-
parameters:
|
|
1166
|
-
outputSchema:
|
|
1164
|
+
parameters: St,
|
|
1165
|
+
outputSchema: $t,
|
|
1167
1166
|
async execute(e, t) {
|
|
1168
1167
|
const { id: o } = e, [n, r] = o.split(":", 2);
|
|
1169
1168
|
if (!r || n !== "task" && n !== "project")
|
|
@@ -1181,7 +1180,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1181
1180
|
id: `task:${a.id}`,
|
|
1182
1181
|
title: a.content,
|
|
1183
1182
|
text: d.join(""),
|
|
1184
|
-
url:
|
|
1183
|
+
url: me(a.id),
|
|
1185
1184
|
metadata: {
|
|
1186
1185
|
priority: a.priority,
|
|
1187
1186
|
projectId: a.projectId,
|
|
@@ -1204,7 +1203,7 @@ Favorite: Yes`), i = {
|
|
|
1204
1203
|
id: `project:${a.id}`,
|
|
1205
1204
|
title: a.name,
|
|
1206
1205
|
text: d.join(""),
|
|
1207
|
-
url:
|
|
1206
|
+
url: fe(a.id),
|
|
1208
1207
|
metadata: {
|
|
1209
1208
|
color: a.color,
|
|
1210
1209
|
isFavorite: a.isFavorite,
|
|
@@ -1217,7 +1216,7 @@ Favorite: Yes`), i = {
|
|
|
1217
1216
|
}
|
|
1218
1217
|
return { textContent: JSON.stringify(i) };
|
|
1219
1218
|
}
|
|
1220
|
-
},
|
|
1219
|
+
}, xt = {
|
|
1221
1220
|
objectType: s.enum(["task", "project", "comment"]).optional().describe("Type of object to filter by."),
|
|
1222
1221
|
objectId: s.string().optional().describe("Filter by specific object ID (task, project, or comment)."),
|
|
1223
1222
|
eventType: s.enum([
|
|
@@ -1236,26 +1235,26 @@ Favorite: Yes`), i = {
|
|
|
1236
1235
|
initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
|
|
1237
1236
|
limit: s.number().int().min(1).max($.ACTIVITY_MAX).default($.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
1238
1237
|
cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
1239
|
-
},
|
|
1240
|
-
events: s.array(
|
|
1238
|
+
}, At = {
|
|
1239
|
+
events: s.array(ze).describe("The activity events."),
|
|
1241
1240
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1242
1241
|
totalCount: s.number().describe("The total number of events in this page."),
|
|
1243
1242
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1244
1243
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1245
|
-
},
|
|
1244
|
+
}, Ut = {
|
|
1246
1245
|
name: g.FIND_ACTIVITY,
|
|
1247
1246
|
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.",
|
|
1248
|
-
parameters:
|
|
1249
|
-
outputSchema:
|
|
1247
|
+
parameters: xt,
|
|
1248
|
+
outputSchema: At,
|
|
1250
1249
|
async execute(e, t) {
|
|
1251
1250
|
const { objectType: o, objectId: n, eventType: r, projectId: i, taskId: c, initiatorId: a, limit: d, cursor: l } = e, u = {
|
|
1252
1251
|
limit: d,
|
|
1253
1252
|
cursor: l ?? null
|
|
1254
1253
|
};
|
|
1255
1254
|
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);
|
|
1256
|
-
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(
|
|
1255
|
+
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(Be);
|
|
1257
1256
|
return {
|
|
1258
|
-
textContent:
|
|
1257
|
+
textContent: Pt({ events: m, args: e, nextCursor: b }),
|
|
1259
1258
|
structuredContent: {
|
|
1260
1259
|
events: m,
|
|
1261
1260
|
nextCursor: b ?? void 0,
|
|
@@ -1266,7 +1265,7 @@ Favorite: Yes`), i = {
|
|
|
1266
1265
|
};
|
|
1267
1266
|
}
|
|
1268
1267
|
};
|
|
1269
|
-
function
|
|
1268
|
+
function Pt({
|
|
1270
1269
|
events: e,
|
|
1271
1270
|
args: t,
|
|
1272
1271
|
nextCursor: o
|
|
@@ -1287,12 +1286,12 @@ function Et({
|
|
|
1287
1286
|
limit: t.limit,
|
|
1288
1287
|
nextCursor: o ?? void 0,
|
|
1289
1288
|
filterHints: i,
|
|
1290
|
-
previewLines:
|
|
1289
|
+
previewLines: Et(e, Math.min(e.length, t.limit)),
|
|
1291
1290
|
zeroReasonHints: c
|
|
1292
1291
|
});
|
|
1293
1292
|
}
|
|
1294
|
-
function
|
|
1295
|
-
const n = e.slice(0, t).map(
|
|
1293
|
+
function Et(e, t = 10) {
|
|
1294
|
+
const n = e.slice(0, t).map(Ot).join(`
|
|
1296
1295
|
`);
|
|
1297
1296
|
if (e.length > t) {
|
|
1298
1297
|
const r = e.length - t;
|
|
@@ -1301,8 +1300,8 @@ function Ot(e, t = 10) {
|
|
|
1301
1300
|
}
|
|
1302
1301
|
return n;
|
|
1303
1302
|
}
|
|
1304
|
-
function
|
|
1305
|
-
const t =
|
|
1303
|
+
function Ot(e) {
|
|
1304
|
+
const t = _t(e.eventDate), o = `${e.eventType} ${e.objectType}`;
|
|
1306
1305
|
let n = "";
|
|
1307
1306
|
if (e.extraData) {
|
|
1308
1307
|
const a = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
@@ -1311,7 +1310,7 @@ function _t(e) {
|
|
|
1311
1310
|
const r = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
1312
1311
|
return ` [${t}] ${o}${n}${r}${i}${c}`;
|
|
1313
1312
|
}
|
|
1314
|
-
function
|
|
1313
|
+
function _t(e) {
|
|
1315
1314
|
try {
|
|
1316
1315
|
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", {
|
|
1317
1316
|
hour: "2-digit",
|
|
@@ -1324,7 +1323,7 @@ function Nt(e) {
|
|
|
1324
1323
|
return e;
|
|
1325
1324
|
}
|
|
1326
1325
|
}
|
|
1327
|
-
const
|
|
1326
|
+
const Nt = {
|
|
1328
1327
|
taskId: s.string().optional().describe("Find comments for a specific task."),
|
|
1329
1328
|
projectId: s.string().optional().describe(
|
|
1330
1329
|
'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -1332,15 +1331,15 @@ const Mt = {
|
|
|
1332
1331
|
commentId: s.string().optional().describe("Get a specific comment by ID."),
|
|
1333
1332
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
1334
1333
|
limit: s.number().int().min(1).max($.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
1335
|
-
},
|
|
1336
|
-
comments: s.array(
|
|
1334
|
+
}, Mt = {
|
|
1335
|
+
comments: s.array(re).describe("The found comments."),
|
|
1337
1336
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1338
1337
|
totalCount: s.number().describe("The total number of comments in this page.")
|
|
1339
|
-
},
|
|
1338
|
+
}, Ft = {
|
|
1340
1339
|
name: g.FIND_COMMENTS,
|
|
1341
1340
|
description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
|
|
1342
|
-
parameters:
|
|
1343
|
-
outputSchema:
|
|
1341
|
+
parameters: Nt,
|
|
1342
|
+
outputSchema: Mt,
|
|
1344
1343
|
async execute(e, t) {
|
|
1345
1344
|
const o = [e.taskId, e.projectId, e.commentId].filter(Boolean);
|
|
1346
1345
|
if (o.length === 0)
|
|
@@ -1369,9 +1368,9 @@ const Mt = {
|
|
|
1369
1368
|
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1370
1369
|
} else
|
|
1371
1370
|
throw new Error("Invalid state: no search parameter provided");
|
|
1372
|
-
const a = c.map(
|
|
1371
|
+
const a = c.map(te);
|
|
1373
1372
|
return {
|
|
1374
|
-
textContent:
|
|
1373
|
+
textContent: Rt({
|
|
1375
1374
|
comments: a,
|
|
1376
1375
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
1377
1376
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
@@ -1389,7 +1388,7 @@ const Mt = {
|
|
|
1389
1388
|
};
|
|
1390
1389
|
}
|
|
1391
1390
|
};
|
|
1392
|
-
function
|
|
1391
|
+
function Rt({
|
|
1393
1392
|
comments: e,
|
|
1394
1393
|
searchType: t,
|
|
1395
1394
|
searchId: o,
|
|
@@ -1415,18 +1414,18 @@ ${c}`;
|
|
|
1415
1414
|
}
|
|
1416
1415
|
return i;
|
|
1417
1416
|
}
|
|
1418
|
-
const
|
|
1417
|
+
const Lt = ["and", "or"], ae = {
|
|
1419
1418
|
labels: s.string().array().optional().describe("The labels to filter the tasks by"),
|
|
1420
|
-
labelsOperator: s.enum(
|
|
1419
|
+
labelsOperator: s.enum(Lt).optional().describe(
|
|
1421
1420
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
1422
1421
|
)
|
|
1423
1422
|
};
|
|
1424
|
-
function
|
|
1423
|
+
function ce(e = [], t = "or") {
|
|
1425
1424
|
if (e.length === 0) return "";
|
|
1426
1425
|
const o = t === "and" ? " & " : " | ";
|
|
1427
1426
|
return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${o} `)})`;
|
|
1428
1427
|
}
|
|
1429
|
-
const
|
|
1428
|
+
const Bt = {
|
|
1430
1429
|
getBy: s.enum(["completion", "due"]).default("completion").describe(
|
|
1431
1430
|
'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).'
|
|
1432
1431
|
),
|
|
@@ -1445,21 +1444,21 @@ const Wt = {
|
|
|
1445
1444
|
cursor: s.string().optional().describe(
|
|
1446
1445
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1447
1446
|
),
|
|
1448
|
-
...
|
|
1449
|
-
},
|
|
1447
|
+
...ae
|
|
1448
|
+
}, Wt = {
|
|
1450
1449
|
tasks: s.array(W).describe("The found completed tasks."),
|
|
1451
1450
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1452
1451
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1453
1452
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1454
1453
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1455
|
-
},
|
|
1454
|
+
}, Yt = {
|
|
1456
1455
|
name: g.FIND_COMPLETED_TASKS,
|
|
1457
1456
|
description: "Get completed tasks (includes all collaborators by default—use responsibleUser to narrow).",
|
|
1458
|
-
parameters:
|
|
1459
|
-
outputSchema:
|
|
1457
|
+
parameters: Bt,
|
|
1458
|
+
outputSchema: Wt,
|
|
1460
1459
|
async execute(e, t) {
|
|
1461
|
-
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await
|
|
1462
|
-
let m =
|
|
1460
|
+
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
|
+
let m = ce(n, r);
|
|
1463
1462
|
u && p && (m = K(m, `assigned to: ${p}`));
|
|
1464
1463
|
const y = await t.getUser(), k = y.tzInfo?.gmtString || "+00:00", w = d === "inbox" ? y.inboxProjectId : d, D = `${i}T00:00:00${k}`, P = `${c}T23:59:59${k}`, h = new Date(D).toISOString(), T = new Date(P).toISOString(), { items: C, nextCursor: v } = o === "completion" ? await t.getCompletedTasksByCompletionDate({
|
|
1465
1464
|
...l,
|
|
@@ -1475,7 +1474,7 @@ const Wt = {
|
|
|
1475
1474
|
...m ? { filterQuery: m, filterLang: "en" } : {}
|
|
1476
1475
|
}), f = C.map(O);
|
|
1477
1476
|
return {
|
|
1478
|
-
textContent:
|
|
1477
|
+
textContent: zt({
|
|
1479
1478
|
tasks: f,
|
|
1480
1479
|
args: e,
|
|
1481
1480
|
nextCursor: v,
|
|
@@ -1491,7 +1490,7 @@ const Wt = {
|
|
|
1491
1490
|
};
|
|
1492
1491
|
}
|
|
1493
1492
|
};
|
|
1494
|
-
function
|
|
1493
|
+
function zt({
|
|
1495
1494
|
tasks: e,
|
|
1496
1495
|
args: t,
|
|
1497
1496
|
nextCursor: o,
|
|
@@ -1517,13 +1516,13 @@ function Kt({
|
|
|
1517
1516
|
zeroReasonHints: a
|
|
1518
1517
|
});
|
|
1519
1518
|
}
|
|
1520
|
-
const { FIND_PROJECTS:
|
|
1519
|
+
const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
1521
1520
|
projectId: s.string().min(1).describe("The ID of the project to search for collaborators in."),
|
|
1522
1521
|
searchTerm: s.string().optional().describe(
|
|
1523
1522
|
"Search for a collaborator by name or email (partial and case insensitive match). If omitted, all collaborators in the project are returned."
|
|
1524
1523
|
)
|
|
1525
|
-
},
|
|
1526
|
-
collaborators: s.array(
|
|
1524
|
+
}, Vt = {
|
|
1525
|
+
collaborators: s.array(Ke).describe("The found collaborators."),
|
|
1527
1526
|
projectInfo: s.object({
|
|
1528
1527
|
id: s.string().describe("The project ID."),
|
|
1529
1528
|
name: s.string().describe("The project name."),
|
|
@@ -1532,11 +1531,11 @@ const { FIND_PROJECTS: Ht, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Vt = {
|
|
|
1532
1531
|
totalCount: s.number().describe("The total number of collaborators found."),
|
|
1533
1532
|
totalAvailable: s.number().optional().describe("The total number of available collaborators in the project."),
|
|
1534
1533
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1535
|
-
},
|
|
1534
|
+
}, Gt = {
|
|
1536
1535
|
name: g.FIND_PROJECT_COLLABORATORS,
|
|
1537
1536
|
description: "Search for collaborators by name or other criteria in a project.",
|
|
1538
|
-
parameters:
|
|
1539
|
-
outputSchema:
|
|
1537
|
+
parameters: Ht,
|
|
1538
|
+
outputSchema: Vt,
|
|
1540
1539
|
async execute(e, t) {
|
|
1541
1540
|
const { projectId: o, searchTerm: n } = e;
|
|
1542
1541
|
let r = o, i;
|
|
@@ -1594,7 +1593,7 @@ const { FIND_PROJECTS: Ht, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Vt = {
|
|
|
1594
1593
|
);
|
|
1595
1594
|
}
|
|
1596
1595
|
return {
|
|
1597
|
-
textContent:
|
|
1596
|
+
textContent: qt({
|
|
1598
1597
|
collaborators: a,
|
|
1599
1598
|
projectName: r,
|
|
1600
1599
|
searchTerm: n,
|
|
@@ -1614,7 +1613,7 @@ const { FIND_PROJECTS: Ht, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Vt = {
|
|
|
1614
1613
|
};
|
|
1615
1614
|
}
|
|
1616
1615
|
};
|
|
1617
|
-
function
|
|
1616
|
+
function qt({
|
|
1618
1617
|
collaborators: e,
|
|
1619
1618
|
projectName: t,
|
|
1620
1619
|
searchTerm: o,
|
|
@@ -1630,7 +1629,7 @@ function Jt({
|
|
|
1630
1629
|
const a = [];
|
|
1631
1630
|
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")));
|
|
1632
1631
|
const d = [];
|
|
1633
|
-
return e.length > 0 ? (d.push(`Use ${je} with responsibleUser to assign new tasks`), d.push(`Use ${ve} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${
|
|
1632
|
+
return e.length > 0 ? (d.push(`Use ${je} with responsibleUser to assign new tasks`), d.push(`Use ${ve} with responsibleUser to reassign existing tasks`), d.push("Use collaborator names, emails, or IDs for assignments")) : (d.push(`Use ${Kt} to find other projects`), o && n > 0 && d.push("Try searching without filters to see all collaborators")), N({
|
|
1634
1633
|
subject: r,
|
|
1635
1634
|
count: e.length,
|
|
1636
1635
|
filterHints: i,
|
|
@@ -1640,7 +1639,7 @@ function Jt({
|
|
|
1640
1639
|
nextSteps: d
|
|
1641
1640
|
});
|
|
1642
1641
|
}
|
|
1643
|
-
const { ADD_PROJECTS:
|
|
1642
|
+
const { ADD_PROJECTS: Jt } = g, Xt = {
|
|
1644
1643
|
search: s.string().optional().describe(
|
|
1645
1644
|
"Search for a project by name (partial and case insensitive match). If omitted, all projects are returned."
|
|
1646
1645
|
),
|
|
@@ -1648,24 +1647,24 @@ const { ADD_PROJECTS: Xt } = g, Zt = {
|
|
|
1648
1647
|
cursor: s.string().optional().describe(
|
|
1649
1648
|
"The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1650
1649
|
)
|
|
1651
|
-
},
|
|
1652
|
-
projects: s.array(
|
|
1650
|
+
}, Zt = {
|
|
1651
|
+
projects: s.array(oe).describe("The found projects."),
|
|
1653
1652
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1654
1653
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
1655
1654
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1656
1655
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1657
|
-
},
|
|
1656
|
+
}, Qt = {
|
|
1658
1657
|
name: g.FIND_PROJECTS,
|
|
1659
1658
|
description: "List all projects or search for projects by name. If search parameter is omitted, all projects are returned.",
|
|
1660
|
-
parameters:
|
|
1661
|
-
outputSchema:
|
|
1659
|
+
parameters: Xt,
|
|
1660
|
+
outputSchema: Zt,
|
|
1662
1661
|
async execute(e, t) {
|
|
1663
1662
|
const { results: o, nextCursor: n } = await t.getProjects({
|
|
1664
1663
|
limit: e.limit,
|
|
1665
1664
|
cursor: e.cursor ?? null
|
|
1666
1665
|
}), r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(Ie);
|
|
1667
1666
|
return {
|
|
1668
|
-
textContent:
|
|
1667
|
+
textContent: es({ projects: c, args: e, nextCursor: n }),
|
|
1669
1668
|
structuredContent: {
|
|
1670
1669
|
projects: c,
|
|
1671
1670
|
nextCursor: n ?? void 0,
|
|
@@ -1676,17 +1675,17 @@ const { ADD_PROJECTS: Xt } = g, Zt = {
|
|
|
1676
1675
|
};
|
|
1677
1676
|
}
|
|
1678
1677
|
};
|
|
1679
|
-
function
|
|
1678
|
+
function es({
|
|
1680
1679
|
projects: e,
|
|
1681
1680
|
args: t,
|
|
1682
1681
|
nextCursor: o
|
|
1683
1682
|
}) {
|
|
1684
1683
|
const n = t.search ? `Projects matching "${t.search}"` : "Projects", r = [];
|
|
1685
1684
|
t.search && r.push(`search: "${t.search}"`);
|
|
1686
|
-
const i = 10, a = e.slice(0, i).map(
|
|
1685
|
+
const i = 10, a = e.slice(0, i).map(pt).join(`
|
|
1687
1686
|
`), d = e.length - i, l = d > 0 ? `${a}
|
|
1688
1687
|
…and ${d} more` : a, u = [];
|
|
1689
|
-
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 ${
|
|
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 ${Jt} to create a project`))), N({
|
|
1690
1689
|
subject: n,
|
|
1691
1690
|
count: e.length,
|
|
1692
1691
|
limit: t.limit,
|
|
@@ -1696,28 +1695,28 @@ function ts({
|
|
|
1696
1695
|
zeroReasonHints: u
|
|
1697
1696
|
});
|
|
1698
1697
|
}
|
|
1699
|
-
const { ADD_SECTIONS:
|
|
1698
|
+
const { ADD_SECTIONS: ts } = g, ss = {
|
|
1700
1699
|
projectId: s.string().min(1).describe(
|
|
1701
1700
|
'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
1702
1701
|
),
|
|
1703
1702
|
search: s.string().optional().describe(
|
|
1704
1703
|
"Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."
|
|
1705
1704
|
)
|
|
1706
|
-
},
|
|
1707
|
-
sections: s.array(
|
|
1705
|
+
}, os = {
|
|
1706
|
+
sections: s.array(ne).describe("The found sections."),
|
|
1708
1707
|
totalCount: s.number().describe("The total number of sections found."),
|
|
1709
1708
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1710
|
-
},
|
|
1709
|
+
}, ns = {
|
|
1711
1710
|
name: g.FIND_SECTIONS,
|
|
1712
1711
|
description: "Search for sections by name or other criteria in a project.",
|
|
1713
|
-
parameters:
|
|
1714
|
-
outputSchema:
|
|
1712
|
+
parameters: ss,
|
|
1713
|
+
outputSchema: os,
|
|
1715
1714
|
async execute(e, t) {
|
|
1716
1715
|
const o = e.projectId === "inbox" ? (await t.getUser()).inboxProjectId : e.projectId, { results: n } = await t.getSections({
|
|
1717
1716
|
projectId: o
|
|
1718
1717
|
}), 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 }));
|
|
1719
1718
|
return {
|
|
1720
|
-
textContent:
|
|
1719
|
+
textContent: rs({
|
|
1721
1720
|
sections: c,
|
|
1722
1721
|
projectId: e.projectId,
|
|
1723
1722
|
search: e.search
|
|
@@ -1730,13 +1729,13 @@ const { ADD_SECTIONS: ss } = g, os = {
|
|
|
1730
1729
|
};
|
|
1731
1730
|
}
|
|
1732
1731
|
};
|
|
1733
|
-
function
|
|
1732
|
+
function rs({
|
|
1734
1733
|
sections: e,
|
|
1735
1734
|
projectId: t,
|
|
1736
1735
|
search: o
|
|
1737
1736
|
}) {
|
|
1738
1737
|
const n = [];
|
|
1739
|
-
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 ${
|
|
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 ${ts} to create sections`));
|
|
1740
1739
|
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(`
|
|
1741
1740
|
`) : void 0;
|
|
1742
1741
|
return N({
|
|
@@ -1746,7 +1745,7 @@ function is({
|
|
|
1746
1745
|
zeroReasonHints: n
|
|
1747
1746
|
});
|
|
1748
1747
|
}
|
|
1749
|
-
const { FIND_COMPLETED_TASKS:
|
|
1748
|
+
const { FIND_COMPLETED_TASKS: le, ADD_TASKS: ue } = g, is = {
|
|
1750
1749
|
searchText: s.string().optional().describe("The text to search for in tasks."),
|
|
1751
1750
|
projectId: s.string().optional().describe(
|
|
1752
1751
|
'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -1761,18 +1760,18 @@ const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, as = {
|
|
|
1761
1760
|
cursor: s.string().optional().describe(
|
|
1762
1761
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1763
1762
|
),
|
|
1764
|
-
...
|
|
1765
|
-
},
|
|
1763
|
+
...ae
|
|
1764
|
+
}, as = {
|
|
1766
1765
|
tasks: s.array(W).describe("The found tasks."),
|
|
1767
1766
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1768
1767
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1769
1768
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1770
1769
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1771
|
-
},
|
|
1770
|
+
}, cs = {
|
|
1772
1771
|
name: g.FIND_TASKS,
|
|
1773
1772
|
description: "Find tasks by text search, or by project/section/parent container/responsible user. At least one filter must be provided.",
|
|
1774
|
-
parameters:
|
|
1775
|
-
outputSchema:
|
|
1773
|
+
parameters: is,
|
|
1774
|
+
outputSchema: as,
|
|
1776
1775
|
async execute(e, t) {
|
|
1777
1776
|
const {
|
|
1778
1777
|
searchText: o,
|
|
@@ -1790,7 +1789,7 @@ const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, as = {
|
|
|
1790
1789
|
throw new Error(
|
|
1791
1790
|
"At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, or labels"
|
|
1792
1791
|
);
|
|
1793
|
-
const y = await
|
|
1792
|
+
const y = await ee(t, c), k = y?.userId, w = y?.email;
|
|
1794
1793
|
if (n || r || i) {
|
|
1795
1794
|
const f = {
|
|
1796
1795
|
limit: d,
|
|
@@ -1801,7 +1800,7 @@ const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, as = {
|
|
|
1801
1800
|
let E = o ? x.filter(
|
|
1802
1801
|
(M) => M.content.toLowerCase().includes(o.toLowerCase()) || M.description?.toLowerCase().includes(o.toLowerCase())
|
|
1803
1802
|
) : x;
|
|
1804
|
-
return E =
|
|
1803
|
+
return E = de({
|
|
1805
1804
|
tasks: E,
|
|
1806
1805
|
resolvedAssigneeId: k,
|
|
1807
1806
|
currentUserId: b.id,
|
|
@@ -1853,14 +1852,14 @@ const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, as = {
|
|
|
1853
1852
|
}
|
|
1854
1853
|
let D = "";
|
|
1855
1854
|
o && (D = `search: ${o}`);
|
|
1856
|
-
const P =
|
|
1855
|
+
const P = ce(u, p);
|
|
1857
1856
|
D = K(D, P);
|
|
1858
|
-
const { tasks: h, nextCursor: T } = await
|
|
1857
|
+
const { tasks: h, nextCursor: T } = await se({
|
|
1859
1858
|
client: t,
|
|
1860
1859
|
query: D,
|
|
1861
1860
|
cursor: e.cursor,
|
|
1862
1861
|
limit: e.limit
|
|
1863
|
-
}), C =
|
|
1862
|
+
}), C = de({
|
|
1864
1863
|
tasks: h,
|
|
1865
1864
|
resolvedAssigneeId: k,
|
|
1866
1865
|
currentUserId: b.id,
|
|
@@ -1884,12 +1883,12 @@ const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, as = {
|
|
|
1884
1883
|
};
|
|
1885
1884
|
}
|
|
1886
1885
|
};
|
|
1887
|
-
function
|
|
1886
|
+
function ds(e) {
|
|
1888
1887
|
if (e.projectId) {
|
|
1889
1888
|
const t = [
|
|
1890
1889
|
e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
|
|
1891
1890
|
];
|
|
1892
|
-
return e.searchText || t.push(`Use ${
|
|
1891
|
+
return e.searchText || t.push(`Use ${ue} to create tasks`), t;
|
|
1893
1892
|
}
|
|
1894
1893
|
if (e.sectionId) {
|
|
1895
1894
|
const t = [e.searchText ? "No tasks in section match search" : "Section is empty"];
|
|
@@ -1897,7 +1896,7 @@ function ls(e) {
|
|
|
1897
1896
|
}
|
|
1898
1897
|
if (e.parentId) {
|
|
1899
1898
|
const t = [e.searchText ? "No subtasks match search" : "No subtasks created yet"];
|
|
1900
|
-
return e.searchText || t.push(`Use ${
|
|
1899
|
+
return e.searchText || t.push(`Use ${ue} with parentId to add subtasks`), t;
|
|
1901
1900
|
}
|
|
1902
1901
|
return [];
|
|
1903
1902
|
}
|
|
@@ -1919,7 +1918,7 @@ function J({
|
|
|
1919
1918
|
const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
1920
1919
|
c.push(`labels: ${d}`);
|
|
1921
1920
|
}
|
|
1922
|
-
e.length === 0 && a.push(...
|
|
1921
|
+
e.length === 0 && a.push(...ds(t));
|
|
1923
1922
|
} else {
|
|
1924
1923
|
const d = r || t.responsibleUser, l = [];
|
|
1925
1924
|
if (t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
@@ -1933,9 +1932,9 @@ function J({
|
|
|
1933
1932
|
if (e.length === 0) {
|
|
1934
1933
|
if (t.responsibleUser) {
|
|
1935
1934
|
const u = r || t.responsibleUser;
|
|
1936
|
-
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${
|
|
1935
|
+
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${le}`);
|
|
1937
1936
|
}
|
|
1938
|
-
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${
|
|
1937
|
+
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${le}`));
|
|
1939
1938
|
}
|
|
1940
1939
|
}
|
|
1941
1940
|
return N({
|
|
@@ -1948,7 +1947,7 @@ function J({
|
|
|
1948
1947
|
zeroReasonHints: a
|
|
1949
1948
|
});
|
|
1950
1949
|
}
|
|
1951
|
-
const
|
|
1950
|
+
const ls = {
|
|
1952
1951
|
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'."),
|
|
1953
1952
|
overdueOption: s.enum(["overdue-only", "include-overdue", "exclude-overdue"]).optional().describe(
|
|
1954
1953
|
"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'."
|
|
@@ -1964,49 +1963,49 @@ const us = {
|
|
|
1964
1963
|
responsibleUserFiltering: s.enum(ye).optional().describe(
|
|
1965
1964
|
'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".'
|
|
1966
1965
|
),
|
|
1967
|
-
...
|
|
1968
|
-
},
|
|
1966
|
+
...ae
|
|
1967
|
+
}, us = {
|
|
1969
1968
|
tasks: s.array(W).describe("The found tasks."),
|
|
1970
1969
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1971
1970
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1972
1971
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1973
1972
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1974
|
-
},
|
|
1973
|
+
}, ps = {
|
|
1975
1974
|
name: g.FIND_TASKS_BY_DATE,
|
|
1976
1975
|
description: "Get tasks by date range. Use startDate 'today' to get today's tasks including overdue items, or provide a specific date/date range.",
|
|
1977
|
-
parameters:
|
|
1978
|
-
outputSchema:
|
|
1976
|
+
parameters: ls,
|
|
1977
|
+
outputSchema: us,
|
|
1979
1978
|
async execute(e, t) {
|
|
1980
1979
|
if (!e.startDate && e.overdueOption !== "overdue-only")
|
|
1981
1980
|
throw new Error(
|
|
1982
1981
|
"Either startDate must be provided or overdueOption must be set to overdue-only"
|
|
1983
1982
|
);
|
|
1984
|
-
const o = await
|
|
1983
|
+
const o = await ee(t, e.responsibleUser), n = o?.userId, r = o?.email;
|
|
1985
1984
|
let i = "";
|
|
1986
1985
|
if (e.overdueOption === "overdue-only")
|
|
1987
1986
|
i = "overdue";
|
|
1988
1987
|
else if (e.startDate === "today")
|
|
1989
1988
|
i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
1990
1989
|
else if (e.startDate) {
|
|
1991
|
-
const p = e.startDate, b =
|
|
1990
|
+
const p = e.startDate, b = be(p, e.daysCount), m = Ae(b, { representation: "date" });
|
|
1992
1991
|
i = `(due after: ${p} | due: ${p}) & due before: ${m}`;
|
|
1993
1992
|
}
|
|
1994
|
-
const c =
|
|
1993
|
+
const c = ce(e.labels, e.labelsOperator);
|
|
1995
1994
|
c.length > 0 && (i = K(i, `(${c})`));
|
|
1996
|
-
const a =
|
|
1995
|
+
const a = Re({
|
|
1997
1996
|
resolvedAssigneeId: n,
|
|
1998
1997
|
assigneeEmail: r,
|
|
1999
1998
|
responsibleUserFiltering: e.responsibleUserFiltering
|
|
2000
1999
|
});
|
|
2001
2000
|
i = K(i, a);
|
|
2002
|
-
const { tasks: d, nextCursor: l } = await
|
|
2001
|
+
const { tasks: d, nextCursor: l } = await se({
|
|
2003
2002
|
client: t,
|
|
2004
2003
|
query: i,
|
|
2005
2004
|
cursor: e.cursor,
|
|
2006
2005
|
limit: e.limit
|
|
2007
2006
|
});
|
|
2008
2007
|
return {
|
|
2009
|
-
textContent:
|
|
2008
|
+
textContent: hs({ tasks: d, args: e, nextCursor: l, assigneeEmail: r }),
|
|
2010
2009
|
structuredContent: {
|
|
2011
2010
|
tasks: d,
|
|
2012
2011
|
nextCursor: l ?? void 0,
|
|
@@ -2017,7 +2016,7 @@ const us = {
|
|
|
2017
2016
|
};
|
|
2018
2017
|
}
|
|
2019
2018
|
};
|
|
2020
|
-
function
|
|
2019
|
+
function hs({
|
|
2021
2020
|
tasks: e,
|
|
2022
2021
|
args: t,
|
|
2023
2022
|
nextCursor: o,
|
|
@@ -2032,7 +2031,7 @@ function ms({
|
|
|
2032
2031
|
`today${a}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
2033
2032
|
);
|
|
2034
2033
|
} else if (t.startDate) {
|
|
2035
|
-
const a = t.daysCount > 1 ? ` to ${
|
|
2034
|
+
const a = t.daysCount > 1 ? ` to ${dt(be(t.startDate, t.daysCount))}` : "";
|
|
2036
2035
|
r.push(`${t.startDate}${a}`);
|
|
2037
2036
|
}
|
|
2038
2037
|
if (t.labels && t.labels.length > 0) {
|
|
@@ -2067,11 +2066,11 @@ function ms({
|
|
|
2067
2066
|
zeroReasonHints: c
|
|
2068
2067
|
});
|
|
2069
2068
|
}
|
|
2070
|
-
const
|
|
2069
|
+
const ms = {
|
|
2071
2070
|
projectId: s.string().min(1).optional().describe(
|
|
2072
2071
|
"Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
|
|
2073
2072
|
)
|
|
2074
|
-
},
|
|
2073
|
+
}, fs = {
|
|
2075
2074
|
type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
2076
2075
|
totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
|
|
2077
2076
|
totalTasks: s.number().optional().describe("Total number of tasks."),
|
|
@@ -2092,7 +2091,7 @@ const fs = {
|
|
|
2092
2091
|
tasks: s.array(s.any()).optional().describe("List of tasks (project overview only)."),
|
|
2093
2092
|
stats: s.any().optional().describe("Statistics object (project overview only).")
|
|
2094
2093
|
};
|
|
2095
|
-
function
|
|
2094
|
+
function bs(e) {
|
|
2096
2095
|
const t = {};
|
|
2097
2096
|
for (const r of e)
|
|
2098
2097
|
t[r.id] = {
|
|
@@ -2117,7 +2116,7 @@ function gs(e) {
|
|
|
2117
2116
|
}
|
|
2118
2117
|
return n(o), o;
|
|
2119
2118
|
}
|
|
2120
|
-
async function
|
|
2119
|
+
async function gs(e, t) {
|
|
2121
2120
|
const o = {};
|
|
2122
2121
|
return await Promise.all(
|
|
2123
2122
|
t.map(async (n) => {
|
|
@@ -2136,7 +2135,7 @@ function Ce(e, t, o = "") {
|
|
|
2136
2135
|
n.push(...Ce(i, t, `${o} `));
|
|
2137
2136
|
return n;
|
|
2138
2137
|
}
|
|
2139
|
-
function
|
|
2138
|
+
function pe(e) {
|
|
2140
2139
|
const t = {};
|
|
2141
2140
|
for (const n of e)
|
|
2142
2141
|
t[n.id] = { ...n, children: [] };
|
|
@@ -2170,7 +2169,7 @@ function Se(e, t) {
|
|
|
2170
2169
|
children: e.children.map((o) => Se(o, t))
|
|
2171
2170
|
};
|
|
2172
2171
|
}
|
|
2173
|
-
async function
|
|
2172
|
+
async function Ts(e, t) {
|
|
2174
2173
|
let o = [], n;
|
|
2175
2174
|
do {
|
|
2176
2175
|
const { results: r, nextCursor: i } = await e.getTasks({
|
|
@@ -2182,12 +2181,12 @@ async function ys(e, t) {
|
|
|
2182
2181
|
} while (n);
|
|
2183
2182
|
return o;
|
|
2184
2183
|
}
|
|
2185
|
-
async function
|
|
2184
|
+
async function ys(e, t) {
|
|
2186
2185
|
const { results: o } = await e.getSections({ projectId: t });
|
|
2187
2186
|
return o;
|
|
2188
2187
|
}
|
|
2189
|
-
async function
|
|
2190
|
-
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 =
|
|
2188
|
+
async function Is(e) {
|
|
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 = bs(n), i = t.map((p) => p.id), c = await gs(e, i), a = ["# Personal Projects", ""];
|
|
2191
2190
|
if (o) {
|
|
2192
2191
|
a.push(`- Inbox Project: ${o.name} (id=${o.id})`);
|
|
2193
2192
|
for (const p of c[o.id] || [])
|
|
@@ -2224,8 +2223,8 @@ async function ks(e) {
|
|
|
2224
2223
|
};
|
|
2225
2224
|
return { textContent: l, structuredContent: u };
|
|
2226
2225
|
}
|
|
2227
|
-
async function
|
|
2228
|
-
const o = await e.getProject(t), n = await
|
|
2226
|
+
async function ks(e, t) {
|
|
2227
|
+
const o = await e.getProject(t), n = await ys(e, t), r = await Ts(e, t), i = {};
|
|
2229
2228
|
for (const u of n)
|
|
2230
2229
|
i[u.id] = [];
|
|
2231
2230
|
const c = [];
|
|
@@ -2234,7 +2233,7 @@ async function ws(e, t) {
|
|
|
2234
2233
|
const a = [`# ${o.name}`];
|
|
2235
2234
|
if (c.length > 0) {
|
|
2236
2235
|
a.push("");
|
|
2237
|
-
const u =
|
|
2236
|
+
const u = pe(c);
|
|
2238
2237
|
a.push(...Z(u));
|
|
2239
2238
|
}
|
|
2240
2239
|
for (const u of n) {
|
|
@@ -2242,7 +2241,7 @@ async function ws(e, t) {
|
|
|
2242
2241
|
const p = i[u.id];
|
|
2243
2242
|
if (!p?.length)
|
|
2244
2243
|
continue;
|
|
2245
|
-
const b =
|
|
2244
|
+
const b = pe(p);
|
|
2246
2245
|
a.push(...Z(b));
|
|
2247
2246
|
}
|
|
2248
2247
|
const d = a.join(`
|
|
@@ -2266,21 +2265,21 @@ async function ws(e, t) {
|
|
|
2266
2265
|
};
|
|
2267
2266
|
return { textContent: d, structuredContent: l };
|
|
2268
2267
|
}
|
|
2269
|
-
const
|
|
2268
|
+
const ws = {
|
|
2270
2269
|
name: g.GET_OVERVIEW,
|
|
2271
2270
|
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.",
|
|
2272
|
-
parameters:
|
|
2273
|
-
outputSchema:
|
|
2271
|
+
parameters: ms,
|
|
2272
|
+
outputSchema: fs,
|
|
2274
2273
|
async execute(e, t) {
|
|
2275
|
-
const o = e.projectId ? await
|
|
2274
|
+
const o = e.projectId ? await ks(t, e.projectId) : await Is(t);
|
|
2276
2275
|
return {
|
|
2277
2276
|
textContent: o.textContent,
|
|
2278
2277
|
structuredContent: o.structuredContent
|
|
2279
2278
|
};
|
|
2280
2279
|
}
|
|
2281
|
-
}, { FIND_TASKS:
|
|
2280
|
+
}, { FIND_TASKS: js, FIND_PROJECT_COLLABORATORS: he, UPDATE_TASKS: vs } = g, Cs = 50, Ss = {
|
|
2282
2281
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
2283
|
-
taskIds: s.array(s.string()).min(1).max(
|
|
2282
|
+
taskIds: s.array(s.string()).min(1).max(Cs).describe("The IDs of the tasks to operate on (max 50)."),
|
|
2284
2283
|
responsibleUser: s.string().optional().describe(
|
|
2285
2284
|
"The user to assign tasks to. Can be user ID, name, or email. Required for assign and reassign operations."
|
|
2286
2285
|
),
|
|
@@ -2288,7 +2287,7 @@ const js = {
|
|
|
2288
2287
|
"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."
|
|
2289
2288
|
),
|
|
2290
2289
|
dryRun: s.boolean().optional().default(!1).describe("If true, validates operations without executing them.")
|
|
2291
|
-
},
|
|
2290
|
+
}, $s = {
|
|
2292
2291
|
results: s.array(
|
|
2293
2292
|
s.object({
|
|
2294
2293
|
taskId: s.string().describe("The ID of the task."),
|
|
@@ -2304,11 +2303,11 @@ const js = {
|
|
|
2304
2303
|
failed: s.number().describe("Number of failed operations."),
|
|
2305
2304
|
dryRun: s.boolean().describe("Whether this was a dry run.")
|
|
2306
2305
|
}).optional().describe("Summary of the operation.")
|
|
2307
|
-
},
|
|
2306
|
+
}, Ds = {
|
|
2308
2307
|
name: g.MANAGE_ASSIGNMENTS,
|
|
2309
2308
|
description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
|
|
2310
|
-
parameters:
|
|
2311
|
-
outputSchema:
|
|
2309
|
+
parameters: Ss,
|
|
2310
|
+
outputSchema: $s,
|
|
2312
2311
|
async execute(e, t) {
|
|
2313
2312
|
const { operation: o, taskIds: n, responsibleUser: r, fromAssigneeUser: i, dryRun: c } = e;
|
|
2314
2313
|
if ((o === "assign" || o === "reassign") && !r)
|
|
@@ -2417,7 +2416,7 @@ const js = {
|
|
|
2417
2416
|
}
|
|
2418
2417
|
};
|
|
2419
2418
|
}
|
|
2420
|
-
const b = await
|
|
2419
|
+
const b = await ie.validateBulkAssignment(
|
|
2421
2420
|
t,
|
|
2422
2421
|
p
|
|
2423
2422
|
), m = [], y = [];
|
|
@@ -2534,22 +2533,22 @@ function Y({
|
|
|
2534
2533
|
`;
|
|
2535
2534
|
}
|
|
2536
2535
|
return !o && n.length > 0 ? (a += `**Next steps:**
|
|
2537
|
-
`, a += `• Use ${
|
|
2538
|
-
`, a += `• Use ${
|
|
2539
|
-
`, r.length > 0 && (a += `• Check failed tasks and use ${
|
|
2536
|
+
`, a += `• Use ${js} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
|
|
2537
|
+
`, a += `• Use ${vs} for individual assignment changes
|
|
2538
|
+
`, r.length > 0 && (a += `• Check failed tasks and use ${he} to verify collaborator access
|
|
2540
2539
|
`)) : o ? (a += `**To execute:**
|
|
2541
2540
|
`, a += `• Remove dryRun parameter and run again to execute changes
|
|
2542
2541
|
`, n.length > 0 && (a += `• ${n.length} task${n.length === 1 ? "" : "s"} ready for ${e} operation
|
|
2543
2542
|
`), r.length > 0 && (a += `• Fix ${r.length} validation error${r.length === 1 ? "" : "s"} before executing
|
|
2544
2543
|
`)) : n.length === 0 && (a += `**Suggestions:**
|
|
2545
|
-
`, a += `• Use ${
|
|
2544
|
+
`, a += `• Use ${he} to find valid assignees
|
|
2546
2545
|
`, a += `• Check task IDs and assignee permissions
|
|
2547
2546
|
`, a += `• Use dryRun=true to validate before executing
|
|
2548
2547
|
`), a;
|
|
2549
2548
|
}
|
|
2550
|
-
const
|
|
2549
|
+
const xs = {
|
|
2551
2550
|
query: s.string().min(1).describe("The search query string to find tasks and projects.")
|
|
2552
|
-
},
|
|
2551
|
+
}, As = {
|
|
2553
2552
|
results: s.array(
|
|
2554
2553
|
s.object({
|
|
2555
2554
|
id: s.string().describe("The ID of the result."),
|
|
@@ -2558,14 +2557,14 @@ const As = {
|
|
|
2558
2557
|
})
|
|
2559
2558
|
).describe("The search results."),
|
|
2560
2559
|
totalCount: s.number().describe("Total number of results found.")
|
|
2561
|
-
},
|
|
2560
|
+
}, Us = {
|
|
2562
2561
|
name: g.SEARCH,
|
|
2563
2562
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
2564
|
-
parameters:
|
|
2565
|
-
outputSchema:
|
|
2563
|
+
parameters: xs,
|
|
2564
|
+
outputSchema: As,
|
|
2566
2565
|
async execute(e, t) {
|
|
2567
2566
|
const { query: o } = e, [n, r] = await Promise.all([
|
|
2568
|
-
|
|
2567
|
+
se({
|
|
2569
2568
|
client: t,
|
|
2570
2569
|
query: `search: ${o}`,
|
|
2571
2570
|
limit: $.TASKS_MAX,
|
|
@@ -2579,40 +2578,40 @@ const As = {
|
|
|
2579
2578
|
a.push({
|
|
2580
2579
|
id: `task:${d.id}`,
|
|
2581
2580
|
title: d.content,
|
|
2582
|
-
url:
|
|
2581
|
+
url: me(d.id)
|
|
2583
2582
|
});
|
|
2584
2583
|
for (const d of c)
|
|
2585
2584
|
a.push({
|
|
2586
2585
|
id: `project:${d.id}`,
|
|
2587
2586
|
title: d.name,
|
|
2588
|
-
url:
|
|
2587
|
+
url: fe(d.id)
|
|
2589
2588
|
});
|
|
2590
2589
|
return {
|
|
2591
2590
|
textContent: JSON.stringify({ results: a }),
|
|
2592
2591
|
structuredContent: { results: a, totalCount: a.length }
|
|
2593
2592
|
};
|
|
2594
2593
|
}
|
|
2595
|
-
},
|
|
2594
|
+
}, Ps = s.object({
|
|
2596
2595
|
id: s.string().min(1).describe("The ID of the comment to update."),
|
|
2597
2596
|
content: s.string().min(1).describe("The new content for the comment.")
|
|
2598
|
-
}),
|
|
2599
|
-
comments: s.array(
|
|
2600
|
-
},
|
|
2601
|
-
comments: s.array(
|
|
2597
|
+
}), Es = {
|
|
2598
|
+
comments: s.array(Ps).min(1).describe("The comments to update.")
|
|
2599
|
+
}, Os = {
|
|
2600
|
+
comments: s.array(re).describe("The updated comments."),
|
|
2602
2601
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
2603
2602
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
2604
2603
|
appliedOperations: s.object({
|
|
2605
2604
|
updateCount: s.number().describe("The number of comments updated.")
|
|
2606
2605
|
}).describe("Summary of operations performed.")
|
|
2607
|
-
},
|
|
2606
|
+
}, _s = {
|
|
2608
2607
|
name: g.UPDATE_COMMENTS,
|
|
2609
2608
|
description: "Update multiple existing comments with new content.",
|
|
2610
|
-
parameters:
|
|
2611
|
-
outputSchema:
|
|
2609
|
+
parameters: Es,
|
|
2610
|
+
outputSchema: Os,
|
|
2612
2611
|
async execute(e, t) {
|
|
2613
|
-
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(
|
|
2612
|
+
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(te);
|
|
2614
2613
|
return {
|
|
2615
|
-
textContent:
|
|
2614
|
+
textContent: Ns({
|
|
2616
2615
|
comments: i
|
|
2617
2616
|
}),
|
|
2618
2617
|
structuredContent: {
|
|
@@ -2626,7 +2625,7 @@ const As = {
|
|
|
2626
2625
|
};
|
|
2627
2626
|
}
|
|
2628
2627
|
};
|
|
2629
|
-
function
|
|
2628
|
+
function Ns({ comments: e }) {
|
|
2630
2629
|
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
2631
2630
|
if (t > 0) {
|
|
2632
2631
|
const i = t > 1 ? "comments" : "comment";
|
|
@@ -2638,29 +2637,29 @@ function Ms({ comments: e }) {
|
|
|
2638
2637
|
}
|
|
2639
2638
|
return n.length > 0 ? `Updated ${n.join(" and ")}` : "No comments updated";
|
|
2640
2639
|
}
|
|
2641
|
-
const
|
|
2640
|
+
const Ms = s.object({
|
|
2642
2641
|
id: s.string().min(1).describe("The ID of the project to update."),
|
|
2643
2642
|
name: s.string().min(1).optional().describe("The new name of the project."),
|
|
2644
2643
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
|
|
2645
2644
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style.")
|
|
2646
|
-
}),
|
|
2647
|
-
projects: s.array(
|
|
2648
|
-
},
|
|
2649
|
-
projects: s.array(
|
|
2645
|
+
}), Fs = {
|
|
2646
|
+
projects: s.array(Ms).min(1).describe("The projects to update.")
|
|
2647
|
+
}, Rs = {
|
|
2648
|
+
projects: s.array(oe).describe("The updated projects."),
|
|
2650
2649
|
totalCount: s.number().describe("The total number of projects updated."),
|
|
2651
2650
|
updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
|
|
2652
2651
|
appliedOperations: s.object({
|
|
2653
2652
|
updateCount: s.number().describe("The number of projects actually updated."),
|
|
2654
2653
|
skippedCount: s.number().describe("The number of projects skipped (no changes).")
|
|
2655
2654
|
}).describe("Summary of operations performed.")
|
|
2656
|
-
},
|
|
2655
|
+
}, Ls = {
|
|
2657
2656
|
name: g.UPDATE_PROJECTS,
|
|
2658
2657
|
description: "Update multiple existing projects with new values.",
|
|
2659
|
-
parameters:
|
|
2660
|
-
outputSchema:
|
|
2658
|
+
parameters: Fs,
|
|
2659
|
+
outputSchema: Rs,
|
|
2661
2660
|
async execute(e, t) {
|
|
2662
2661
|
const { projects: o } = e, n = o.map(async (c) => {
|
|
2663
|
-
if (!
|
|
2662
|
+
if (!Ws(c))
|
|
2664
2663
|
return;
|
|
2665
2664
|
const { id: a, ...d } = c;
|
|
2666
2665
|
return await t.updateProject(a, d);
|
|
@@ -2672,7 +2671,7 @@ const Fs = s.object({
|
|
|
2672
2671
|
inboxProject: "inboxProject" in c ? c.inboxProject : !1
|
|
2673
2672
|
}));
|
|
2674
2673
|
return {
|
|
2675
|
-
textContent:
|
|
2674
|
+
textContent: Bs({
|
|
2676
2675
|
projects: r,
|
|
2677
2676
|
args: e
|
|
2678
2677
|
}),
|
|
@@ -2688,7 +2687,7 @@ const Fs = s.object({
|
|
|
2688
2687
|
};
|
|
2689
2688
|
}
|
|
2690
2689
|
};
|
|
2691
|
-
function
|
|
2690
|
+
function Bs({
|
|
2692
2691
|
projects: e,
|
|
2693
2692
|
args: t
|
|
2694
2693
|
}) {
|
|
@@ -2698,29 +2697,29 @@ function Ws({
|
|
|
2698
2697
|
return r > 0 && (a += ` (${r} skipped - no changes)`), i > 0 && (a += `:
|
|
2699
2698
|
${c}`), a;
|
|
2700
2699
|
}
|
|
2701
|
-
function
|
|
2700
|
+
function Ws({ id: e, ...t }) {
|
|
2702
2701
|
return Object.keys(t).length > 0;
|
|
2703
2702
|
}
|
|
2704
|
-
const
|
|
2703
|
+
const Ys = s.object({
|
|
2705
2704
|
id: s.string().min(1).describe("The ID of the section to update."),
|
|
2706
2705
|
name: s.string().min(1).describe("The new name of the section.")
|
|
2707
|
-
}),
|
|
2708
|
-
sections: s.array(
|
|
2709
|
-
},
|
|
2710
|
-
sections: s.array(
|
|
2706
|
+
}), zs = {
|
|
2707
|
+
sections: s.array(Ys).min(1).describe("The sections to update.")
|
|
2708
|
+
}, Ks = {
|
|
2709
|
+
sections: s.array(ne).describe("The updated sections."),
|
|
2711
2710
|
totalCount: s.number().describe("The total number of sections updated."),
|
|
2712
2711
|
updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
|
|
2713
|
-
},
|
|
2712
|
+
}, Hs = {
|
|
2714
2713
|
name: g.UPDATE_SECTIONS,
|
|
2715
2714
|
description: "Update multiple existing sections with new values.",
|
|
2716
|
-
parameters:
|
|
2717
|
-
outputSchema:
|
|
2715
|
+
parameters: zs,
|
|
2716
|
+
outputSchema: Ks,
|
|
2718
2717
|
async execute({ sections: e }, t) {
|
|
2719
2718
|
const o = await Promise.all(
|
|
2720
2719
|
e.map((r) => t.updateSection(r.id, { name: r.name }))
|
|
2721
2720
|
);
|
|
2722
2721
|
return {
|
|
2723
|
-
textContent:
|
|
2722
|
+
textContent: Vs({
|
|
2724
2723
|
sections: o
|
|
2725
2724
|
}),
|
|
2726
2725
|
structuredContent: {
|
|
@@ -2731,13 +2730,13 @@ const zs = s.object({
|
|
|
2731
2730
|
};
|
|
2732
2731
|
}
|
|
2733
2732
|
};
|
|
2734
|
-
function
|
|
2733
|
+
function Vs({ sections: e }) {
|
|
2735
2734
|
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
2736
2735
|
`);
|
|
2737
2736
|
return `Updated ${t} section${t === 1 ? "" : "s"}:
|
|
2738
2737
|
${o}`;
|
|
2739
2738
|
}
|
|
2740
|
-
const
|
|
2739
|
+
const Gs = s.object({
|
|
2741
2740
|
id: s.string().min(1).describe("The ID of the task to update."),
|
|
2742
2741
|
content: s.string().optional().describe(
|
|
2743
2742
|
'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.'
|
|
@@ -2751,7 +2750,7 @@ const qs = s.object({
|
|
|
2751
2750
|
sectionId: s.string().optional().describe("The new section ID for the task."),
|
|
2752
2751
|
parentId: s.string().optional().describe("The new parent task ID (for subtasks)."),
|
|
2753
2752
|
order: s.number().optional().describe("The new order of the task within its parent/section."),
|
|
2754
|
-
priority:
|
|
2753
|
+
priority: Q.optional().describe(
|
|
2755
2754
|
"The new priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
2756
2755
|
),
|
|
2757
2756
|
dueString: s.string().optional().describe("The new due date for the task, in natural language (e.g., 'tomorrow at 5pm')."),
|
|
@@ -2765,9 +2764,9 @@ const qs = s.object({
|
|
|
2765
2764
|
'Change task assignment. Use "unassign" to remove assignment. Can be user ID, name, or email. User must be a project collaborator.'
|
|
2766
2765
|
),
|
|
2767
2766
|
labels: s.array(s.string()).optional().describe("The new labels for the task. Replaces all existing labels.")
|
|
2768
|
-
}),
|
|
2769
|
-
tasks: s.array(
|
|
2770
|
-
},
|
|
2767
|
+
}), qs = {
|
|
2768
|
+
tasks: s.array(Gs).min(1).describe("The tasks to update.")
|
|
2769
|
+
}, Js = {
|
|
2771
2770
|
tasks: s.array(W).describe("The updated tasks."),
|
|
2772
2771
|
totalCount: s.number().describe("The total number of tasks updated."),
|
|
2773
2772
|
updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
|
|
@@ -2775,14 +2774,14 @@ const qs = s.object({
|
|
|
2775
2774
|
updateCount: s.number().describe("The number of tasks actually updated."),
|
|
2776
2775
|
skippedCount: s.number().describe("The number of tasks skipped (no changes).")
|
|
2777
2776
|
}).describe("Summary of operations performed.")
|
|
2778
|
-
},
|
|
2777
|
+
}, Xs = {
|
|
2779
2778
|
name: g.UPDATE_TASKS,
|
|
2780
2779
|
description: "Update existing tasks including content, dates, priorities, and assignments.",
|
|
2781
|
-
parameters:
|
|
2782
|
-
outputSchema:
|
|
2780
|
+
parameters: qs,
|
|
2781
|
+
outputSchema: Js,
|
|
2783
2782
|
async execute(e, t) {
|
|
2784
2783
|
const { tasks: o } = e, n = o.map(async (a) => {
|
|
2785
|
-
if (!
|
|
2784
|
+
if (!Qs(a))
|
|
2786
2785
|
return;
|
|
2787
2786
|
const {
|
|
2788
2787
|
id: d,
|
|
@@ -2804,7 +2803,7 @@ const qs = s.object({
|
|
|
2804
2803
|
};
|
|
2805
2804
|
if (y && (h.priority = Te(y)), w !== void 0 && (w === null || w === "remove" ? h = { ...h, deadlineDate: null } : h = { ...h, deadlineDate: w }), b)
|
|
2806
2805
|
try {
|
|
2807
|
-
const { minutes: v } =
|
|
2806
|
+
const { minutes: v } = ge(b);
|
|
2808
2807
|
h = {
|
|
2809
2808
|
...h,
|
|
2810
2809
|
duration: v,
|
|
@@ -2817,7 +2816,7 @@ const qs = s.object({
|
|
|
2817
2816
|
if (m === null || m === "unassign")
|
|
2818
2817
|
h = { ...h, assigneeId: null };
|
|
2819
2818
|
else {
|
|
2820
|
-
const v = await
|
|
2819
|
+
const v = await ie.validateTaskUpdateAssignment(
|
|
2821
2820
|
t,
|
|
2822
2821
|
d,
|
|
2823
2822
|
m
|
|
@@ -2832,13 +2831,13 @@ const qs = s.object({
|
|
|
2832
2831
|
}
|
|
2833
2832
|
if (!P && !u && !p)
|
|
2834
2833
|
return await t.updateTask(d, h);
|
|
2835
|
-
const T =
|
|
2834
|
+
const T = Le(d, P, u, p), C = await t.moveTask(d, T);
|
|
2836
2835
|
return Object.keys(h).length > 0 ? await t.updateTask(d, h) : C;
|
|
2837
2836
|
}), r = (await Promise.all(n)).filter(
|
|
2838
2837
|
(a) => a !== void 0
|
|
2839
2838
|
), i = r.map(O);
|
|
2840
2839
|
return {
|
|
2841
|
-
textContent:
|
|
2840
|
+
textContent: Zs({
|
|
2842
2841
|
tasks: i,
|
|
2843
2842
|
args: e
|
|
2844
2843
|
}),
|
|
@@ -2854,7 +2853,7 @@ const qs = s.object({
|
|
|
2854
2853
|
};
|
|
2855
2854
|
}
|
|
2856
2855
|
};
|
|
2857
|
-
function
|
|
2856
|
+
function Zs({
|
|
2858
2857
|
tasks: e,
|
|
2859
2858
|
args: t
|
|
2860
2859
|
}) {
|
|
@@ -2865,10 +2864,10 @@ function Qs({
|
|
|
2865
2864
|
showDetails: e.length <= 5
|
|
2866
2865
|
});
|
|
2867
2866
|
}
|
|
2868
|
-
function
|
|
2867
|
+
function Qs({ id: e, ...t }) {
|
|
2869
2868
|
return Object.keys(t).length > 0;
|
|
2870
2869
|
}
|
|
2871
|
-
const
|
|
2870
|
+
const eo = {}, to = {
|
|
2872
2871
|
type: s.literal("user_info").describe("The type of the response."),
|
|
2873
2872
|
userId: s.string().describe("The user ID."),
|
|
2874
2873
|
fullName: s.string().describe("The full name of the user."),
|
|
@@ -2885,28 +2884,28 @@ const to = {}, so = {
|
|
|
2885
2884
|
email: s.string().describe("The email address of the user."),
|
|
2886
2885
|
plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
|
|
2887
2886
|
};
|
|
2888
|
-
function
|
|
2887
|
+
function so(e) {
|
|
2889
2888
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
2890
2889
|
}
|
|
2891
|
-
function
|
|
2890
|
+
function oo(e, t) {
|
|
2892
2891
|
const n = ((e.getDay() || 7) - t + 7) % 7, r = new Date(e);
|
|
2893
2892
|
return r.setDate(e.getDate() - n), r;
|
|
2894
2893
|
}
|
|
2895
|
-
function
|
|
2894
|
+
function no(e) {
|
|
2896
2895
|
const t = new Date(e);
|
|
2897
2896
|
return t.setDate(e.getDate() + 6), t;
|
|
2898
2897
|
}
|
|
2899
|
-
function
|
|
2898
|
+
function ro(e) {
|
|
2900
2899
|
const t = new Date(e.getFullYear(), 0, 1), o = (e.getTime() - t.getTime()) / 864e5;
|
|
2901
2900
|
return Math.ceil((o + t.getDay() + 1) / 7);
|
|
2902
2901
|
}
|
|
2903
|
-
function
|
|
2902
|
+
function io(e) {
|
|
2904
2903
|
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
|
|
2905
2904
|
}
|
|
2906
2905
|
function z(e) {
|
|
2907
2906
|
return e.toISOString().split("T")[0] ?? "";
|
|
2908
2907
|
}
|
|
2909
|
-
function
|
|
2908
|
+
function ao(e) {
|
|
2910
2909
|
try {
|
|
2911
2910
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
2912
2911
|
} catch {
|
|
@@ -2914,9 +2913,9 @@ function co(e) {
|
|
|
2914
2913
|
}
|
|
2915
2914
|
}
|
|
2916
2915
|
function $e(e) {
|
|
2917
|
-
return
|
|
2916
|
+
return ao(e) ? e : "UTC";
|
|
2918
2917
|
}
|
|
2919
|
-
function
|
|
2918
|
+
function co(e, t) {
|
|
2920
2919
|
const o = $e(t);
|
|
2921
2920
|
return e.toLocaleString("en-US", {
|
|
2922
2921
|
timeZone: o,
|
|
@@ -2929,8 +2928,8 @@ function lo(e, t) {
|
|
|
2929
2928
|
hour12: !1
|
|
2930
2929
|
});
|
|
2931
2930
|
}
|
|
2932
|
-
async function
|
|
2933
|
-
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", n = $e(o), r = /* @__PURE__ */ new Date(), i =
|
|
2931
|
+
async function lo(e) {
|
|
2932
|
+
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", n = $e(o), r = /* @__PURE__ */ new Date(), i = co(r, n), c = t.startDay ?? 1, a = io(c), d = so(t), l = new Date(r.toLocaleString("en-US", { timeZone: n })), u = oo(l, c), p = no(u), b = ro(l), y = [
|
|
2934
2933
|
"# User Information",
|
|
2935
2934
|
"",
|
|
2936
2935
|
`**User ID:** ${t.id}`,
|
|
@@ -2972,19 +2971,19 @@ async function uo(e) {
|
|
|
2972
2971
|
};
|
|
2973
2972
|
return { textContent: y, structuredContent: k };
|
|
2974
2973
|
}
|
|
2975
|
-
const
|
|
2974
|
+
const uo = {
|
|
2976
2975
|
name: g.USER_INFO,
|
|
2977
2976
|
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).",
|
|
2978
|
-
parameters:
|
|
2979
|
-
outputSchema:
|
|
2977
|
+
parameters: eo,
|
|
2978
|
+
outputSchema: to,
|
|
2980
2979
|
async execute(e, t) {
|
|
2981
|
-
const o = await
|
|
2980
|
+
const o = await lo(t);
|
|
2982
2981
|
return {
|
|
2983
2982
|
textContent: o.textContent,
|
|
2984
2983
|
structuredContent: o.structuredContent
|
|
2985
2984
|
};
|
|
2986
2985
|
}
|
|
2987
|
-
},
|
|
2986
|
+
}, po = `
|
|
2988
2987
|
## Todoist Task and Project Management Tools
|
|
2989
2988
|
|
|
2990
2989
|
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.
|
|
@@ -3052,41 +3051,41 @@ You have access to comprehensive Todoist management tools for personal productiv
|
|
|
3052
3051
|
|
|
3053
3052
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
3054
3053
|
`;
|
|
3055
|
-
function
|
|
3054
|
+
function To({ todoistApiKey: e, baseUrl: t }) {
|
|
3056
3055
|
const o = new xe(
|
|
3057
3056
|
{ name: "todoist-mcp-server", version: "0.1.0" },
|
|
3058
3057
|
{
|
|
3059
3058
|
capabilities: {
|
|
3060
3059
|
tools: { listChanged: !0 }
|
|
3061
3060
|
},
|
|
3062
|
-
instructions:
|
|
3061
|
+
instructions: po
|
|
3063
3062
|
}
|
|
3064
3063
|
), n = new De(e, t);
|
|
3065
|
-
return I(
|
|
3064
|
+
return I(bt, o, n), I(kt, o, n), I(Xs, o, n), I(cs, o, n), I(ps, o, n), I(Yt, o, n), I(tt, o, n), I(Ls, o, n), I(Qt, o, n), I(it, o, n), I(Hs, o, n), I(ns, o, n), I(Je, o, n), I(Ft, o, n), I(_s, o, n), I(Ut, o, n), I(ws, o, n), I(Ct, o, n), I(uo, o, n), I(Gt, o, n), I(Ds, o, n), I(Us, o, n), I(Dt, o, n), o;
|
|
3066
3065
|
}
|
|
3067
3066
|
export {
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3067
|
+
Gt as a,
|
|
3068
|
+
ws as b,
|
|
3069
|
+
Ut as c,
|
|
3070
|
+
Ct as d,
|
|
3071
|
+
Ft as e,
|
|
3072
|
+
Dt as f,
|
|
3073
|
+
To as g,
|
|
3074
|
+
_s as h,
|
|
3075
|
+
Je as i,
|
|
3076
|
+
ns as j,
|
|
3077
|
+
Hs as k,
|
|
3078
|
+
it as l,
|
|
3079
|
+
Ds as m,
|
|
3080
|
+
Qt as n,
|
|
3081
|
+
Ls as o,
|
|
3082
|
+
tt as p,
|
|
3083
|
+
Yt as q,
|
|
3084
|
+
ps as r,
|
|
3085
|
+
Us as s,
|
|
3086
|
+
cs as t,
|
|
3087
|
+
uo as u,
|
|
3088
|
+
Xs as v,
|
|
3089
|
+
kt as w,
|
|
3090
|
+
bt as x
|
|
3092
3091
|
};
|