@doist/todoist-ai 4.17.1 → 4.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +273 -198
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/main.js +1 -1
- package/dist/{mcp-server-BMGcSL1c.js → mcp-server-BSQxi0xQ.js} +627 -596
- package/dist/tool-helpers.d.ts +29 -2
- package/dist/tool-helpers.d.ts.map +1 -1
- package/dist/tools/add-comments.d.ts +48 -23
- package/dist/tools/add-comments.d.ts.map +1 -1
- package/dist/tools/add-projects.d.ts +5 -5
- package/dist/tools/add-tasks.d.ts +26 -26
- package/dist/tools/complete-tasks.d.ts +2 -2
- package/dist/tools/find-activity.d.ts +2 -2
- package/dist/tools/find-comments.d.ts +49 -24
- package/dist/tools/find-comments.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.d.ts +21 -21
- package/dist/tools/find-projects.d.ts +4 -4
- package/dist/tools/find-tasks-by-date.d.ts +19 -19
- package/dist/tools/find-tasks.d.ts +21 -21
- package/dist/tools/update-comments.d.ts +48 -23
- package/dist/tools/update-comments.d.ts.map +1 -1
- package/dist/tools/update-projects.d.ts +2 -2
- package/dist/tools/update-tasks.d.ts +26 -26
- package/dist/utils/output-schemas.d.ts +54 -26
- package/dist/utils/output-schemas.d.ts.map +1 -1
- package/dist/utils/sanitize-data.d.ts +3 -2
- package/dist/utils/sanitize-data.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getTaskUrl as
|
|
2
|
-
import { McpServer as
|
|
1
|
+
import { getTaskUrl as he, getProjectUrl as me, TodoistApi as De } from "@doist/todoist-api-typescript";
|
|
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 fe, formatISO as Ae } from "date-fns";
|
|
5
5
|
function X(e) {
|
|
6
6
|
if (e == null)
|
|
7
7
|
return e;
|
|
@@ -12,7 +12,7 @@ function X(e) {
|
|
|
12
12
|
for (const [o, n] of Object.entries(e))
|
|
13
13
|
if (n !== null) {
|
|
14
14
|
const r = X(n);
|
|
15
|
-
if (
|
|
15
|
+
if (r !== null && typeof r == "object" && !Array.isArray(r) && Object.keys(r).length === 0)
|
|
16
16
|
continue;
|
|
17
17
|
t[o] = r;
|
|
18
18
|
}
|
|
@@ -20,13 +20,13 @@ function X(e) {
|
|
|
20
20
|
}
|
|
21
21
|
return e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Ue = process.env.USE_STRUCTURED_CONTENT === "true" || process.env.NODE_ENV === "test";
|
|
24
|
+
function Pe({
|
|
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), !Ue && 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 Ue({
|
|
|
36
36
|
}
|
|
37
37
|
return n;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Ee(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 Pe({ 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 Ee(a);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
t.registerTool(
|
|
@@ -66,237 +66,12 @@ function I(e, t, o) {
|
|
|
66
66
|
n
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
const W = s.object({
|
|
70
|
-
id: s.string().describe("The unique ID of the task."),
|
|
71
|
-
content: s.string().describe("The task title/content."),
|
|
72
|
-
description: s.string().describe("The task description."),
|
|
73
|
-
dueDate: s.string().optional().describe("The due date of the task (ISO 8601 format)."),
|
|
74
|
-
recurring: s.union([s.boolean(), s.string()]).describe("Whether the task is recurring, or the recurrence string."),
|
|
75
|
-
deadlineDate: s.string().optional().describe("The deadline date of the task (ISO 8601 format)."),
|
|
76
|
-
priority: s.number().describe("The priority level (1-4, where 1 is highest priority)."),
|
|
77
|
-
projectId: s.string().describe("The ID of the project this task belongs to."),
|
|
78
|
-
sectionId: s.string().optional().describe("The ID of the section this task belongs to."),
|
|
79
|
-
parentId: s.string().optional().describe("The ID of the parent task (for subtasks)."),
|
|
80
|
-
labels: s.array(s.string()).describe("The labels attached to this task."),
|
|
81
|
-
duration: s.string().optional().describe('The duration of the task (e.g., "2h30m").'),
|
|
82
|
-
responsibleUid: s.string().optional().describe("The UID of the user responsible for this task."),
|
|
83
|
-
assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
|
|
84
|
-
checked: s.boolean().describe("Whether the task is checked/completed."),
|
|
85
|
-
completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
|
|
86
|
-
}), Q = s.object({
|
|
87
|
-
id: s.string().describe("The unique ID of the project."),
|
|
88
|
-
name: s.string().describe("The name of the project."),
|
|
89
|
-
color: s.string().describe("The color of the project."),
|
|
90
|
-
isFavorite: s.boolean().describe("Whether the project is marked as favorite."),
|
|
91
|
-
isShared: s.boolean().describe("Whether the project is shared."),
|
|
92
|
-
parentId: s.string().optional().describe("The ID of the parent project (for sub-projects)."),
|
|
93
|
-
inboxProject: s.boolean().describe("Whether this is the inbox project."),
|
|
94
|
-
viewStyle: s.string().describe("The view style of the project (list, board, calendar).")
|
|
95
|
-
}), ee = s.object({
|
|
96
|
-
id: s.string().describe("The unique ID of the section."),
|
|
97
|
-
name: s.string().describe("The name of the section.")
|
|
98
|
-
}), Ee = s.object({
|
|
99
|
-
resourceType: s.string().describe("The type of resource."),
|
|
100
|
-
fileName: s.string().optional().describe("The name of the file."),
|
|
101
|
-
fileSize: s.number().optional().describe("The size of the file in bytes."),
|
|
102
|
-
fileType: s.string().optional().describe("The MIME type of the file."),
|
|
103
|
-
fileUrl: s.string().optional().describe("The URL to access the file."),
|
|
104
|
-
fileDuration: s.number().optional().describe("The duration in milliseconds (for audio/video files)."),
|
|
105
|
-
uploadState: s.enum(["pending", "completed"]).optional().describe("The upload state of the file.")
|
|
106
|
-
}), te = s.object({
|
|
107
|
-
id: s.string().describe("The unique ID of the comment."),
|
|
108
|
-
taskId: s.string().optional().describe("The ID of the task this comment belongs to."),
|
|
109
|
-
projectId: s.string().optional().describe("The ID of the project this comment belongs to."),
|
|
110
|
-
content: s.string().describe("The content of the comment."),
|
|
111
|
-
postedAt: s.string().describe("When the comment was posted (ISO 8601 format)."),
|
|
112
|
-
attachment: Ee.optional().describe("File attachment information, if any.")
|
|
113
|
-
}), Oe = s.object({
|
|
114
|
-
id: s.string().optional().describe("The unique ID of the activity event."),
|
|
115
|
-
objectType: s.string().describe("The type of object this event relates to (task, project, etc)."),
|
|
116
|
-
objectId: s.string().describe("The ID of the object this event relates to."),
|
|
117
|
-
eventType: s.string().describe("The type of event (added, updated, deleted, completed, etc)."),
|
|
118
|
-
eventDate: s.string().describe("When the event occurred (ISO 8601 format)."),
|
|
119
|
-
parentProjectId: s.string().optional().describe("The ID of the parent project."),
|
|
120
|
-
parentItemId: s.string().optional().describe("The ID of the parent item."),
|
|
121
|
-
initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
|
|
122
|
-
extraData: s.record(s.unknown()).optional().describe("Additional event data.")
|
|
123
|
-
}), _e = s.object({
|
|
124
|
-
id: s.string().describe("The unique ID of the user."),
|
|
125
|
-
name: s.string().describe("The full name of the user."),
|
|
126
|
-
email: s.string().describe("The email address of the user.")
|
|
127
|
-
}), Ne = s.object({
|
|
128
|
-
item: s.string().describe("The item that failed (usually an ID or identifier)."),
|
|
129
|
-
error: s.string().describe("The error message."),
|
|
130
|
-
code: s.string().optional().describe("The error code, if available.")
|
|
131
|
-
}), g = {
|
|
132
|
-
// Task management tools
|
|
133
|
-
ADD_TASKS: "add-tasks",
|
|
134
|
-
COMPLETE_TASKS: "complete-tasks",
|
|
135
|
-
UPDATE_TASKS: "update-tasks",
|
|
136
|
-
FIND_TASKS: "find-tasks",
|
|
137
|
-
FIND_TASKS_BY_DATE: "find-tasks-by-date",
|
|
138
|
-
FIND_COMPLETED_TASKS: "find-completed-tasks",
|
|
139
|
-
// Project management tools
|
|
140
|
-
ADD_PROJECTS: "add-projects",
|
|
141
|
-
UPDATE_PROJECTS: "update-projects",
|
|
142
|
-
FIND_PROJECTS: "find-projects",
|
|
143
|
-
// Section management tools
|
|
144
|
-
ADD_SECTIONS: "add-sections",
|
|
145
|
-
UPDATE_SECTIONS: "update-sections",
|
|
146
|
-
FIND_SECTIONS: "find-sections",
|
|
147
|
-
// Comment management tools
|
|
148
|
-
ADD_COMMENTS: "add-comments",
|
|
149
|
-
UPDATE_COMMENTS: "update-comments",
|
|
150
|
-
FIND_COMMENTS: "find-comments",
|
|
151
|
-
// Assignment and collaboration tools
|
|
152
|
-
FIND_PROJECT_COLLABORATORS: "find-project-collaborators",
|
|
153
|
-
MANAGE_ASSIGNMENTS: "manage-assignments",
|
|
154
|
-
// Activity and audit tools
|
|
155
|
-
FIND_ACTIVITY: "find-activity",
|
|
156
|
-
// General tools
|
|
157
|
-
GET_OVERVIEW: "get-overview",
|
|
158
|
-
DELETE_OBJECT: "delete-object",
|
|
159
|
-
USER_INFO: "user-info",
|
|
160
|
-
// OpenAI MCP tools
|
|
161
|
-
SEARCH: "search",
|
|
162
|
-
FETCH: "fetch"
|
|
163
|
-
}, Me = s.object({
|
|
164
|
-
taskId: s.string().optional().describe("The ID of the task to comment on."),
|
|
165
|
-
projectId: s.string().optional().describe(
|
|
166
|
-
'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
167
|
-
),
|
|
168
|
-
content: s.string().min(1).describe("The content of the comment.")
|
|
169
|
-
}), Fe = {
|
|
170
|
-
comments: s.array(Me).min(1).describe("The array of comments to add.")
|
|
171
|
-
}, Re = {
|
|
172
|
-
comments: s.array(te).describe("The created comments."),
|
|
173
|
-
totalCount: s.number().describe("The total number of comments created."),
|
|
174
|
-
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
175
|
-
}, Le = {
|
|
176
|
-
name: g.ADD_COMMENTS,
|
|
177
|
-
description: "Add multiple comments to tasks or projects. Each comment must specify either taskId or projectId.",
|
|
178
|
-
parameters: Fe,
|
|
179
|
-
outputSchema: Re,
|
|
180
|
-
async execute(e, t) {
|
|
181
|
-
const { comments: o } = e;
|
|
182
|
-
for (const [d, l] of o.entries()) {
|
|
183
|
-
if (!l.taskId && !l.projectId)
|
|
184
|
-
throw new Error(
|
|
185
|
-
`Comment ${d + 1}: Either taskId or projectId must be provided.`
|
|
186
|
-
);
|
|
187
|
-
if (l.taskId && l.projectId)
|
|
188
|
-
throw new Error(
|
|
189
|
-
`Comment ${d + 1}: Cannot provide both taskId and projectId. Choose one.`
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
const r = o.some((d) => d.projectId === "inbox") ? await t.getUser() : null, i = o.map(async ({ content: d, taskId: l, projectId: u }) => {
|
|
193
|
-
const p = u === "inbox" && r ? r.inboxProjectId : u;
|
|
194
|
-
return await t.addComment({
|
|
195
|
-
content: d,
|
|
196
|
-
...l ? { taskId: l } : { projectId: p }
|
|
197
|
-
});
|
|
198
|
-
}), c = await Promise.all(i);
|
|
199
|
-
return {
|
|
200
|
-
textContent: Be({ comments: c }),
|
|
201
|
-
structuredContent: {
|
|
202
|
-
comments: c,
|
|
203
|
-
totalCount: c.length,
|
|
204
|
-
addedCommentIds: c.map((d) => d.id)
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
function Be({ comments: e }) {
|
|
210
|
-
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
211
|
-
if (t > 0) {
|
|
212
|
-
const i = t > 1 ? "comments" : "comment";
|
|
213
|
-
n.push(`${t} task ${i}`);
|
|
214
|
-
}
|
|
215
|
-
if (o > 0) {
|
|
216
|
-
const i = o > 1 ? "comments" : "comment";
|
|
217
|
-
n.push(`${o} project ${i}`);
|
|
218
|
-
}
|
|
219
|
-
return n.length > 0 ? `Added ${n.join(" and ")}` : "No comments added";
|
|
220
|
-
}
|
|
221
|
-
const We = s.object({
|
|
222
|
-
name: s.string().min(1).describe("The name of the project."),
|
|
223
|
-
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
224
|
-
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
225
|
-
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe('The project view style. Defaults to "list".')
|
|
226
|
-
}), Ye = {
|
|
227
|
-
projects: s.array(We).min(1).describe("The array of projects to add.")
|
|
228
|
-
}, Ke = {
|
|
229
|
-
projects: s.array(Q).describe("The created projects."),
|
|
230
|
-
totalCount: s.number().describe("The total number of projects created.")
|
|
231
|
-
}, ze = {
|
|
232
|
-
name: g.ADD_PROJECTS,
|
|
233
|
-
description: "Add one or more new projects.",
|
|
234
|
-
parameters: Ye,
|
|
235
|
-
outputSchema: Ke,
|
|
236
|
-
async execute({ projects: e }, t) {
|
|
237
|
-
const o = await Promise.all(e.map((i) => t.addProject(i))), n = Ve({ projects: o }), r = o.map((i) => ({
|
|
238
|
-
...i,
|
|
239
|
-
parentId: "parentId" in i ? i.parentId ?? void 0 : void 0,
|
|
240
|
-
inboxProject: "inboxProject" in i ? i.inboxProject : !1
|
|
241
|
-
}));
|
|
242
|
-
return {
|
|
243
|
-
textContent: n,
|
|
244
|
-
structuredContent: {
|
|
245
|
-
projects: r,
|
|
246
|
-
totalCount: r.length
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
function Ve({ projects: e }) {
|
|
252
|
-
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id})`).join(`
|
|
253
|
-
`);
|
|
254
|
-
return `Added ${t} project${t === 1 ? "" : "s"}:
|
|
255
|
-
${o}`;
|
|
256
|
-
}
|
|
257
|
-
const He = s.object({
|
|
258
|
-
name: s.string().min(1).describe("The name of the section."),
|
|
259
|
-
projectId: s.string().min(1).describe(
|
|
260
|
-
'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
261
|
-
)
|
|
262
|
-
}), Ge = {
|
|
263
|
-
sections: s.array(He).min(1).describe("The array of sections to add.")
|
|
264
|
-
}, qe = {
|
|
265
|
-
sections: s.array(ee).describe("The created sections."),
|
|
266
|
-
totalCount: s.number().describe("The total number of sections created.")
|
|
267
|
-
}, Je = {
|
|
268
|
-
name: g.ADD_SECTIONS,
|
|
269
|
-
description: "Add one or more new sections to projects.",
|
|
270
|
-
parameters: Ge,
|
|
271
|
-
outputSchema: qe,
|
|
272
|
-
async execute({ sections: e }, t) {
|
|
273
|
-
const n = e.some((a) => a.projectId === "inbox") ? await t.getUser() : null, r = e.map((a) => ({
|
|
274
|
-
...a,
|
|
275
|
-
projectId: a.projectId === "inbox" && n ? n.inboxProjectId : a.projectId
|
|
276
|
-
})), i = await Promise.all(
|
|
277
|
-
r.map((a) => t.addSection(a))
|
|
278
|
-
);
|
|
279
|
-
return {
|
|
280
|
-
textContent: Xe({ sections: i }),
|
|
281
|
-
structuredContent: {
|
|
282
|
-
sections: i,
|
|
283
|
-
totalCount: i.length
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
function Xe({ sections: e }) {
|
|
289
|
-
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
290
|
-
`);
|
|
291
|
-
return `Added ${t} section${t === 1 ? "" : "s"}:
|
|
292
|
-
${o}`;
|
|
293
|
-
}
|
|
294
69
|
class U extends Error {
|
|
295
70
|
constructor(t, o) {
|
|
296
71
|
super(`Invalid duration format "${t}": ${o}`), this.name = "DurationParseError";
|
|
297
72
|
}
|
|
298
73
|
}
|
|
299
|
-
function
|
|
74
|
+
function be(e) {
|
|
300
75
|
if (!e || typeof e != "string")
|
|
301
76
|
throw new U(e, "Duration must be a non-empty string");
|
|
302
77
|
const t = e.trim().toLowerCase().replace(/\s+/g, "");
|
|
@@ -330,13 +105,13 @@ function fe(e) {
|
|
|
330
105
|
throw new U(e, "Duration cannot exceed 24 hours (1440 minutes)");
|
|
331
106
|
return { minutes: n };
|
|
332
107
|
}
|
|
333
|
-
function
|
|
108
|
+
function Oe(e) {
|
|
334
109
|
if (e <= 0) return "0m";
|
|
335
110
|
const t = Math.floor(e / 60), o = e % 60;
|
|
336
111
|
return t === 0 ? `${o}m` : o === 0 ? `${t}h` : `${t}h${o}m`;
|
|
337
112
|
}
|
|
338
113
|
const A = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), G = 300 * 1e3;
|
|
339
|
-
class
|
|
114
|
+
class _e {
|
|
340
115
|
/**
|
|
341
116
|
* Resolve a user name or ID to a user ID by looking up collaborators across all shared projects.
|
|
342
117
|
* Supports exact name matches, partial matches, and email matches.
|
|
@@ -441,32 +216,32 @@ class Qe {
|
|
|
441
216
|
A.clear(), R.clear();
|
|
442
217
|
}
|
|
443
218
|
}
|
|
444
|
-
const _ = new
|
|
445
|
-
async function
|
|
219
|
+
const _ = new _e();
|
|
220
|
+
async function Ne(e, t) {
|
|
446
221
|
return _.resolveUser(e, t);
|
|
447
222
|
}
|
|
448
|
-
const
|
|
449
|
-
async function
|
|
223
|
+
const ge = ["assigned", "unassignedOrMe", "all"];
|
|
224
|
+
async function Q(e, t) {
|
|
450
225
|
if (!t)
|
|
451
226
|
return;
|
|
452
|
-
const o = await
|
|
227
|
+
const o = await Ne(e, t);
|
|
453
228
|
if (!o)
|
|
454
229
|
throw new Error(
|
|
455
230
|
`Could not find user: "${t}". Make sure the user is a collaborator on a shared project.`
|
|
456
231
|
);
|
|
457
232
|
return { userId: o.userId, email: o.email };
|
|
458
233
|
}
|
|
459
|
-
function
|
|
234
|
+
function K(e, t) {
|
|
460
235
|
return t.length === 0 ? e : e.length === 0 ? t : `${e} & ${t}`;
|
|
461
236
|
}
|
|
462
|
-
function
|
|
237
|
+
function Me({
|
|
463
238
|
resolvedAssigneeId: e,
|
|
464
239
|
assigneeEmail: t,
|
|
465
240
|
responsibleUserFiltering: o = "unassignedOrMe"
|
|
466
241
|
}) {
|
|
467
242
|
return e && t ? `assigned to: ${t}` : o === "unassignedOrMe" ? "!assigned to: others" : o === "assigned" ? "assigned to: others" : "";
|
|
468
243
|
}
|
|
469
|
-
function
|
|
244
|
+
function ce({
|
|
470
245
|
tasks: e,
|
|
471
246
|
resolvedAssigneeId: t,
|
|
472
247
|
currentUserId: o,
|
|
@@ -477,7 +252,7 @@ function ae({
|
|
|
477
252
|
function B(e) {
|
|
478
253
|
return "inboxProject" in e;
|
|
479
254
|
}
|
|
480
|
-
function
|
|
255
|
+
function Fe(e, t, o, n) {
|
|
481
256
|
const r = [t, o, n].filter(Boolean);
|
|
482
257
|
if (r.length > 1)
|
|
483
258
|
throw new Error(
|
|
@@ -505,14 +280,14 @@ function O(e) {
|
|
|
505
280
|
sectionId: e.sectionId ?? void 0,
|
|
506
281
|
parentId: e.parentId ?? void 0,
|
|
507
282
|
labels: e.labels,
|
|
508
|
-
duration: e.duration ?
|
|
283
|
+
duration: e.duration ? Oe(e.duration.amount) : void 0,
|
|
509
284
|
responsibleUid: e.responsibleUid ?? void 0,
|
|
510
285
|
assignedByUid: e.assignedByUid ?? void 0,
|
|
511
286
|
checked: e.checked,
|
|
512
287
|
completedAt: e.completedAt ?? void 0
|
|
513
288
|
};
|
|
514
289
|
}
|
|
515
|
-
function
|
|
290
|
+
function Te(e) {
|
|
516
291
|
return {
|
|
517
292
|
id: e.id,
|
|
518
293
|
name: e.name,
|
|
@@ -524,7 +299,31 @@ function ge(e) {
|
|
|
524
299
|
viewStyle: e.viewStyle
|
|
525
300
|
};
|
|
526
301
|
}
|
|
527
|
-
function
|
|
302
|
+
function ee(e) {
|
|
303
|
+
return {
|
|
304
|
+
id: e.id,
|
|
305
|
+
taskId: e.taskId ?? void 0,
|
|
306
|
+
projectId: e.projectId ?? void 0,
|
|
307
|
+
content: e.content,
|
|
308
|
+
postedAt: e.postedAt,
|
|
309
|
+
postedUid: e.postedUid ?? void 0,
|
|
310
|
+
fileAttachment: e.fileAttachment ? {
|
|
311
|
+
resourceType: e.fileAttachment.resourceType,
|
|
312
|
+
fileName: e.fileAttachment.fileName ?? void 0,
|
|
313
|
+
fileSize: e.fileAttachment.fileSize ?? void 0,
|
|
314
|
+
fileType: e.fileAttachment.fileType ?? void 0,
|
|
315
|
+
fileUrl: e.fileAttachment.fileUrl ?? void 0,
|
|
316
|
+
fileDuration: e.fileAttachment.fileDuration ?? void 0,
|
|
317
|
+
uploadState: e.fileAttachment.uploadState ?? void 0,
|
|
318
|
+
url: e.fileAttachment.url ?? void 0,
|
|
319
|
+
title: e.fileAttachment.title ?? void 0,
|
|
320
|
+
image: e.fileAttachment.image ?? void 0,
|
|
321
|
+
imageWidth: e.fileAttachment.imageWidth ?? void 0,
|
|
322
|
+
imageHeight: e.fileAttachment.imageHeight ?? void 0
|
|
323
|
+
} : void 0
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function Re(e) {
|
|
528
327
|
return {
|
|
529
328
|
id: e.id ?? void 0,
|
|
530
329
|
objectType: e.objectType,
|
|
@@ -537,7 +336,7 @@ function ot(e) {
|
|
|
537
336
|
extraData: e.extraData ?? void 0
|
|
538
337
|
};
|
|
539
338
|
}
|
|
540
|
-
const
|
|
339
|
+
const Le = F.object({
|
|
541
340
|
httpStatusCode: F.number(),
|
|
542
341
|
responseData: F.object({
|
|
543
342
|
error: F.string(),
|
|
@@ -545,7 +344,7 @@ const nt = F.object({
|
|
|
545
344
|
errorTag: F.string()
|
|
546
345
|
})
|
|
547
346
|
});
|
|
548
|
-
async function
|
|
347
|
+
async function te({
|
|
549
348
|
client: e,
|
|
550
349
|
query: t,
|
|
551
350
|
limit: o,
|
|
@@ -555,7 +354,7 @@ async function oe({
|
|
|
555
354
|
const { results: r, nextCursor: i } = await e.getTasksByFilter({ query: t, cursor: n, limit: o });
|
|
556
355
|
return { tasks: r.map(O), nextCursor: i };
|
|
557
356
|
} catch (r) {
|
|
558
|
-
const i =
|
|
357
|
+
const i = Le.safeParse(r);
|
|
559
358
|
if (!i.success)
|
|
560
359
|
throw r;
|
|
561
360
|
const { responseData: c } = i.data;
|
|
@@ -564,6 +363,237 @@ async function oe({
|
|
|
564
363
|
);
|
|
565
364
|
}
|
|
566
365
|
}
|
|
366
|
+
const W = s.object({
|
|
367
|
+
id: s.string().describe("The unique ID of the task."),
|
|
368
|
+
content: s.string().describe("The task title/content."),
|
|
369
|
+
description: s.string().describe("The task description."),
|
|
370
|
+
dueDate: s.string().optional().describe("The due date of the task (ISO 8601 format)."),
|
|
371
|
+
recurring: s.union([s.boolean(), s.string()]).describe("Whether the task is recurring, or the recurrence string."),
|
|
372
|
+
deadlineDate: s.string().optional().describe("The deadline date of the task (ISO 8601 format)."),
|
|
373
|
+
priority: s.number().describe("The priority level (1-4, where 1 is highest priority)."),
|
|
374
|
+
projectId: s.string().describe("The ID of the project this task belongs to."),
|
|
375
|
+
sectionId: s.string().optional().describe("The ID of the section this task belongs to."),
|
|
376
|
+
parentId: s.string().optional().describe("The ID of the parent task (for subtasks)."),
|
|
377
|
+
labels: s.array(s.string()).optional().describe("The labels attached to this task."),
|
|
378
|
+
duration: s.string().optional().describe('The duration of the task (e.g., "2h30m").'),
|
|
379
|
+
responsibleUid: s.string().optional().describe("The UID of the user responsible for this task."),
|
|
380
|
+
assignedByUid: s.string().optional().describe("The UID of the user who assigned this task."),
|
|
381
|
+
checked: s.boolean().describe("Whether the task is checked/completed."),
|
|
382
|
+
completedAt: s.string().optional().describe("When the task was completed (ISO 8601 format).")
|
|
383
|
+
}), se = s.object({
|
|
384
|
+
id: s.string().describe("The unique ID of the project."),
|
|
385
|
+
name: s.string().describe("The name of the project."),
|
|
386
|
+
color: s.string().describe("The color of the project."),
|
|
387
|
+
isFavorite: s.boolean().describe("Whether the project is marked as favorite."),
|
|
388
|
+
isShared: s.boolean().describe("Whether the project is shared."),
|
|
389
|
+
parentId: s.string().optional().describe("The ID of the parent project (for sub-projects)."),
|
|
390
|
+
inboxProject: s.boolean().describe("Whether this is the inbox project."),
|
|
391
|
+
viewStyle: s.string().describe("The view style of the project (list, board, calendar).")
|
|
392
|
+
}), oe = s.object({
|
|
393
|
+
id: s.string().describe("The unique ID of the section."),
|
|
394
|
+
name: s.string().describe("The name of the section.")
|
|
395
|
+
}), Be = s.object({
|
|
396
|
+
resourceType: s.string().describe("The type of resource (file, url, image, etc)."),
|
|
397
|
+
fileName: s.string().optional().describe("The name of the file."),
|
|
398
|
+
fileSize: s.number().optional().describe("The size of the file in bytes."),
|
|
399
|
+
fileType: s.string().optional().describe("The MIME type of the file."),
|
|
400
|
+
fileUrl: s.string().optional().describe("The URL to access the file."),
|
|
401
|
+
fileDuration: s.number().optional().describe("The duration in milliseconds (for audio/video files)."),
|
|
402
|
+
uploadState: s.enum(["pending", "completed"]).optional().describe("The upload state of the file."),
|
|
403
|
+
url: s.string().optional().describe("The URL for link/url resource types."),
|
|
404
|
+
title: s.string().optional().describe("The title for link/url resource types."),
|
|
405
|
+
image: s.string().optional().describe("The image URL for image resource types."),
|
|
406
|
+
imageWidth: s.number().optional().describe("The width of the image in pixels."),
|
|
407
|
+
imageHeight: s.number().optional().describe("The height of the image in pixels.")
|
|
408
|
+
}), ne = s.object({
|
|
409
|
+
id: s.string().describe("The unique ID of the comment."),
|
|
410
|
+
taskId: s.string().optional().describe("The ID of the task this comment belongs to."),
|
|
411
|
+
projectId: s.string().optional().describe("The ID of the project this comment belongs to."),
|
|
412
|
+
content: s.string().describe("The content of the comment."),
|
|
413
|
+
postedAt: s.string().describe("When the comment was posted (ISO 8601 format)."),
|
|
414
|
+
postedUid: s.string().optional().describe("The UID of the user who posted this comment."),
|
|
415
|
+
fileAttachment: Be.optional().describe("File attachment information, if any.")
|
|
416
|
+
}), We = s.object({
|
|
417
|
+
id: s.string().optional().describe("The unique ID of the activity event."),
|
|
418
|
+
objectType: s.string().describe("The type of object this event relates to (task, project, etc)."),
|
|
419
|
+
objectId: s.string().describe("The ID of the object this event relates to."),
|
|
420
|
+
eventType: s.string().describe("The type of event (added, updated, deleted, completed, etc)."),
|
|
421
|
+
eventDate: s.string().describe("When the event occurred (ISO 8601 format)."),
|
|
422
|
+
parentProjectId: s.string().optional().describe("The ID of the parent project."),
|
|
423
|
+
parentItemId: s.string().optional().describe("The ID of the parent item."),
|
|
424
|
+
initiatorId: s.string().optional().describe("The ID of the user who initiated this event."),
|
|
425
|
+
extraData: s.record(s.unknown()).optional().describe("Additional event data.")
|
|
426
|
+
}), Ye = s.object({
|
|
427
|
+
id: s.string().describe("The unique ID of the user."),
|
|
428
|
+
name: s.string().describe("The full name of the user."),
|
|
429
|
+
email: s.string().describe("The email address of the user.")
|
|
430
|
+
}), ze = s.object({
|
|
431
|
+
item: s.string().describe("The item that failed (usually an ID or identifier)."),
|
|
432
|
+
error: s.string().describe("The error message."),
|
|
433
|
+
code: s.string().optional().describe("The error code, if available.")
|
|
434
|
+
}), g = {
|
|
435
|
+
// Task management tools
|
|
436
|
+
ADD_TASKS: "add-tasks",
|
|
437
|
+
COMPLETE_TASKS: "complete-tasks",
|
|
438
|
+
UPDATE_TASKS: "update-tasks",
|
|
439
|
+
FIND_TASKS: "find-tasks",
|
|
440
|
+
FIND_TASKS_BY_DATE: "find-tasks-by-date",
|
|
441
|
+
FIND_COMPLETED_TASKS: "find-completed-tasks",
|
|
442
|
+
// Project management tools
|
|
443
|
+
ADD_PROJECTS: "add-projects",
|
|
444
|
+
UPDATE_PROJECTS: "update-projects",
|
|
445
|
+
FIND_PROJECTS: "find-projects",
|
|
446
|
+
// Section management tools
|
|
447
|
+
ADD_SECTIONS: "add-sections",
|
|
448
|
+
UPDATE_SECTIONS: "update-sections",
|
|
449
|
+
FIND_SECTIONS: "find-sections",
|
|
450
|
+
// Comment management tools
|
|
451
|
+
ADD_COMMENTS: "add-comments",
|
|
452
|
+
UPDATE_COMMENTS: "update-comments",
|
|
453
|
+
FIND_COMMENTS: "find-comments",
|
|
454
|
+
// Assignment and collaboration tools
|
|
455
|
+
FIND_PROJECT_COLLABORATORS: "find-project-collaborators",
|
|
456
|
+
MANAGE_ASSIGNMENTS: "manage-assignments",
|
|
457
|
+
// Activity and audit tools
|
|
458
|
+
FIND_ACTIVITY: "find-activity",
|
|
459
|
+
// General tools
|
|
460
|
+
GET_OVERVIEW: "get-overview",
|
|
461
|
+
DELETE_OBJECT: "delete-object",
|
|
462
|
+
USER_INFO: "user-info",
|
|
463
|
+
// OpenAI MCP tools
|
|
464
|
+
SEARCH: "search",
|
|
465
|
+
FETCH: "fetch"
|
|
466
|
+
}, Ke = s.object({
|
|
467
|
+
taskId: s.string().optional().describe("The ID of the task to comment on."),
|
|
468
|
+
projectId: s.string().optional().describe(
|
|
469
|
+
'The ID of the project to comment on. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
470
|
+
),
|
|
471
|
+
content: s.string().min(1).describe("The content of the comment.")
|
|
472
|
+
}), He = {
|
|
473
|
+
comments: s.array(Ke).min(1).describe("The array of comments to add.")
|
|
474
|
+
}, Ve = {
|
|
475
|
+
comments: s.array(ne).describe("The created comments."),
|
|
476
|
+
totalCount: s.number().describe("The total number of comments created."),
|
|
477
|
+
addedCommentIds: s.array(s.string()).describe("The IDs of the added comments.")
|
|
478
|
+
}, Ge = {
|
|
479
|
+
name: g.ADD_COMMENTS,
|
|
480
|
+
description: "Add multiple comments to tasks or projects. Each comment must specify either taskId or projectId.",
|
|
481
|
+
parameters: He,
|
|
482
|
+
outputSchema: Ve,
|
|
483
|
+
async execute(e, t) {
|
|
484
|
+
const { comments: o } = e;
|
|
485
|
+
for (const [l, u] of o.entries()) {
|
|
486
|
+
if (!u.taskId && !u.projectId)
|
|
487
|
+
throw new Error(
|
|
488
|
+
`Comment ${l + 1}: Either taskId or projectId must be provided.`
|
|
489
|
+
);
|
|
490
|
+
if (u.taskId && u.projectId)
|
|
491
|
+
throw new Error(
|
|
492
|
+
`Comment ${l + 1}: Cannot provide both taskId and projectId. Choose one.`
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
const r = o.some((l) => l.projectId === "inbox") ? await t.getUser() : null, i = o.map(async ({ content: l, taskId: u, projectId: p }) => {
|
|
496
|
+
const b = p === "inbox" && r ? r.inboxProjectId : p;
|
|
497
|
+
return await t.addComment({
|
|
498
|
+
content: l,
|
|
499
|
+
...u ? { taskId: u } : { projectId: b }
|
|
500
|
+
});
|
|
501
|
+
}), a = (await Promise.all(i)).map(ee);
|
|
502
|
+
return {
|
|
503
|
+
textContent: qe({ comments: a }),
|
|
504
|
+
structuredContent: {
|
|
505
|
+
comments: a,
|
|
506
|
+
totalCount: a.length,
|
|
507
|
+
addedCommentIds: a.map((l) => l.id)
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
function qe({ comments: e }) {
|
|
513
|
+
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
514
|
+
if (t > 0) {
|
|
515
|
+
const i = t > 1 ? "comments" : "comment";
|
|
516
|
+
n.push(`${t} task ${i}`);
|
|
517
|
+
}
|
|
518
|
+
if (o > 0) {
|
|
519
|
+
const i = o > 1 ? "comments" : "comment";
|
|
520
|
+
n.push(`${o} project ${i}`);
|
|
521
|
+
}
|
|
522
|
+
return n.length > 0 ? `Added ${n.join(" and ")}` : "No comments added";
|
|
523
|
+
}
|
|
524
|
+
const Je = s.object({
|
|
525
|
+
name: s.string().min(1).describe("The name of the project."),
|
|
526
|
+
parentId: s.string().optional().describe("The ID of the parent project. If provided, creates this as a sub-project."),
|
|
527
|
+
isFavorite: s.boolean().optional().describe("Whether the project is a favorite. Defaults to false."),
|
|
528
|
+
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe('The project view style. Defaults to "list".')
|
|
529
|
+
}), Xe = {
|
|
530
|
+
projects: s.array(Je).min(1).describe("The array of projects to add.")
|
|
531
|
+
}, Ze = {
|
|
532
|
+
projects: s.array(se).describe("The created projects."),
|
|
533
|
+
totalCount: s.number().describe("The total number of projects created.")
|
|
534
|
+
}, Qe = {
|
|
535
|
+
name: g.ADD_PROJECTS,
|
|
536
|
+
description: "Add one or more new projects.",
|
|
537
|
+
parameters: Xe,
|
|
538
|
+
outputSchema: Ze,
|
|
539
|
+
async execute({ projects: e }, t) {
|
|
540
|
+
const o = await Promise.all(e.map((i) => t.addProject(i))), n = et({ projects: o }), r = o.map((i) => ({
|
|
541
|
+
...i,
|
|
542
|
+
parentId: "parentId" in i ? i.parentId ?? void 0 : void 0,
|
|
543
|
+
inboxProject: "inboxProject" in i ? i.inboxProject : !1
|
|
544
|
+
}));
|
|
545
|
+
return {
|
|
546
|
+
textContent: n,
|
|
547
|
+
structuredContent: {
|
|
548
|
+
projects: r,
|
|
549
|
+
totalCount: r.length
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
function et({ projects: e }) {
|
|
555
|
+
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id})`).join(`
|
|
556
|
+
`);
|
|
557
|
+
return `Added ${t} project${t === 1 ? "" : "s"}:
|
|
558
|
+
${o}`;
|
|
559
|
+
}
|
|
560
|
+
const tt = s.object({
|
|
561
|
+
name: s.string().min(1).describe("The name of the section."),
|
|
562
|
+
projectId: s.string().min(1).describe(
|
|
563
|
+
'The ID of the project to add the section to. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
564
|
+
)
|
|
565
|
+
}), st = {
|
|
566
|
+
sections: s.array(tt).min(1).describe("The array of sections to add.")
|
|
567
|
+
}, ot = {
|
|
568
|
+
sections: s.array(oe).describe("The created sections."),
|
|
569
|
+
totalCount: s.number().describe("The total number of sections created.")
|
|
570
|
+
}, nt = {
|
|
571
|
+
name: g.ADD_SECTIONS,
|
|
572
|
+
description: "Add one or more new sections to projects.",
|
|
573
|
+
parameters: st,
|
|
574
|
+
outputSchema: ot,
|
|
575
|
+
async execute({ sections: e }, t) {
|
|
576
|
+
const n = e.some((a) => a.projectId === "inbox") ? await t.getUser() : null, r = e.map((a) => ({
|
|
577
|
+
...a,
|
|
578
|
+
projectId: a.projectId === "inbox" && n ? n.inboxProjectId : a.projectId
|
|
579
|
+
})), i = await Promise.all(
|
|
580
|
+
r.map((a) => t.addSection(a))
|
|
581
|
+
);
|
|
582
|
+
return {
|
|
583
|
+
textContent: rt({ sections: i }),
|
|
584
|
+
structuredContent: {
|
|
585
|
+
sections: i,
|
|
586
|
+
totalCount: i.length
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
function rt({ sections: e }) {
|
|
592
|
+
const t = e.length, o = e.map((r) => `• ${r.name} (id=${r.id}, projectId=${r.projectId})`).join(`
|
|
593
|
+
`);
|
|
594
|
+
return `Added ${t} section${t === 1 ? "" : "s"}:
|
|
595
|
+
${o}`;
|
|
596
|
+
}
|
|
567
597
|
const L = {
|
|
568
598
|
USER_NOT_FOUND: "USER_NOT_FOUND",
|
|
569
599
|
USER_NOT_COLLABORATOR: "USER_NOT_COLLABORATOR",
|
|
@@ -573,7 +603,7 @@ const L = {
|
|
|
573
603
|
PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND",
|
|
574
604
|
TASK_NOT_FOUND: "TASK_NOT_FOUND"
|
|
575
605
|
};
|
|
576
|
-
class
|
|
606
|
+
class it {
|
|
577
607
|
/**
|
|
578
608
|
* Validate a single assignment operation
|
|
579
609
|
*/
|
|
@@ -782,16 +812,16 @@ class rt {
|
|
|
782
812
|
};
|
|
783
813
|
}
|
|
784
814
|
}
|
|
785
|
-
const
|
|
815
|
+
const re = new it(), at = ["p1", "p2", "p3", "p4"], ye = s.enum(at, {
|
|
786
816
|
description: "Task priority: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)"
|
|
787
817
|
});
|
|
788
|
-
function
|
|
818
|
+
function Ie(e) {
|
|
789
819
|
return { p1: 4, p2: 3, p3: 2, p4: 1 }[e];
|
|
790
820
|
}
|
|
791
|
-
function
|
|
821
|
+
function ct(e) {
|
|
792
822
|
return { 4: "P1", 3: "P2", 2: "P3", 1: "P4" }[e] || "";
|
|
793
823
|
}
|
|
794
|
-
const
|
|
824
|
+
const $ = {
|
|
795
825
|
/** Default limit for task listings */
|
|
796
826
|
TASKS_DEFAULT: 10,
|
|
797
827
|
/** Maximum limit for task search and list operations */
|
|
@@ -818,15 +848,15 @@ const S = {
|
|
|
818
848
|
/** Maximum number of failures to show in detailed error messages */
|
|
819
849
|
MAX_FAILURES_SHOWN: 3
|
|
820
850
|
};
|
|
821
|
-
function
|
|
851
|
+
function dt(e = /* @__PURE__ */ new Date()) {
|
|
822
852
|
return e.toISOString().split("T")[0] ?? "";
|
|
823
853
|
}
|
|
824
|
-
function
|
|
854
|
+
function ke(e, t, o = {}) {
|
|
825
855
|
const { context: n, showDetails: r = !1 } = o, i = t.length, c = [], d = `${e} ${i} ${i === 1 ? "task" : "tasks"}${n ? ` ${n}` : ""}.`;
|
|
826
856
|
c.push(d);
|
|
827
857
|
const l = 5;
|
|
828
858
|
if (r || i <= l) {
|
|
829
|
-
const u =
|
|
859
|
+
const u = H(t, l);
|
|
830
860
|
if (u.length > 0) {
|
|
831
861
|
const p = i > l ? `, +${i - l} more` : "";
|
|
832
862
|
c.push(`Tasks:
|
|
@@ -836,7 +866,7 @@ ${u}${p}.`);
|
|
|
836
866
|
return c.join(`
|
|
837
867
|
`);
|
|
838
868
|
}
|
|
839
|
-
function
|
|
869
|
+
function lt(e) {
|
|
840
870
|
const { action: t, success: o, total: n, successItems: r, failures: i } = e, c = [], a = `${t}: ${o}/${n} successful.`;
|
|
841
871
|
if (c.push(a), r?.length && r.length <= 5 && c.push(`Completed:
|
|
842
872
|
${r.map((d) => ` ${d}`).join(`
|
|
@@ -851,16 +881,16 @@ ${i.slice(0, q.MAX_FAILURES_SHOWN).map((u) => ` ${u.item} (Error: ${u.error}$
|
|
|
851
881
|
return c.join(`
|
|
852
882
|
`);
|
|
853
883
|
}
|
|
854
|
-
function
|
|
855
|
-
const t = e.content || e.title || "Untitled", o = e.dueDate ? ` • due ${e.dueDate}` : "", n = e.priority ? ` • ${
|
|
884
|
+
function ut(e) {
|
|
885
|
+
const t = e.content || e.title || "Untitled", o = e.dueDate ? ` • due ${e.dueDate}` : "", n = e.priority ? ` • ${ct(e.priority)}` : "", r = e.projectName ? ` • ${e.projectName}` : "", i = e.id ? ` • id=${e.id}` : "";
|
|
856
886
|
return ` ${t}${o}${n}${r}${i}`;
|
|
857
887
|
}
|
|
858
|
-
function
|
|
888
|
+
function pt(e) {
|
|
859
889
|
const t = e.inboxProject ? " • Inbox" : "", o = e.isFavorite ? " • ⭐" : "", n = e.isShared ? " • Shared" : "", r = e.viewStyle && e.viewStyle !== "list" ? ` • ${e.viewStyle}` : "", i = ` • id=${e.id}`;
|
|
860
890
|
return ` ${e.name}${t}${o}${n}${r}${i}`;
|
|
861
891
|
}
|
|
862
|
-
function
|
|
863
|
-
const n = e.slice(0, t).map(
|
|
892
|
+
function H(e, t = 5) {
|
|
893
|
+
const n = e.slice(0, t).map(ut).join(`
|
|
864
894
|
`);
|
|
865
895
|
if (e.length > t) {
|
|
866
896
|
const r = e.length - t;
|
|
@@ -881,23 +911,23 @@ function N({
|
|
|
881
911
|
}) {
|
|
882
912
|
const d = [], l = `${e}: ${t}${typeof o == "number" ? ` (limit ${o})` : ""}${n ? ", more available" : ""}.`;
|
|
883
913
|
return d.push(l), r?.length && d.push(`Filter: ${r.join("; ")}.`), i?.length && d.push(`Preview:
|
|
884
|
-
${i}`), !t && c?.length && d.push(`No results. ${c.join("; ")}.`), (a?.length || n) && d.push(
|
|
914
|
+
${i}`), !t && c?.length && d.push(`No results. ${c.join("; ")}.`), (a?.length || n) && d.push(we(a || [], n)), d.join(`
|
|
885
915
|
`);
|
|
886
916
|
}
|
|
887
|
-
function
|
|
917
|
+
function we(e, t) {
|
|
888
918
|
const o = [...e];
|
|
889
919
|
return t && o.push(`Pass cursor '${t}' to fetch more results.`), `${o.length === 1 ? "Possible suggested next step:" : "Possible suggested next steps:"}
|
|
890
920
|
${o.map((r) => `- ${r}`).join(`
|
|
891
921
|
`)}`;
|
|
892
922
|
}
|
|
893
|
-
const
|
|
923
|
+
const ht = s.object({
|
|
894
924
|
content: s.string().min(1).describe(
|
|
895
925
|
'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.'
|
|
896
926
|
),
|
|
897
927
|
description: s.string().optional().describe(
|
|
898
928
|
"Additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown."
|
|
899
929
|
),
|
|
900
|
-
priority:
|
|
930
|
+
priority: ye.optional().describe(
|
|
901
931
|
"The priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
902
932
|
),
|
|
903
933
|
dueString: s.string().optional().describe("The due date for the task, in natural language."),
|
|
@@ -916,20 +946,20 @@ const pt = s.object({
|
|
|
916
946
|
responsibleUser: s.string().optional().describe(
|
|
917
947
|
"Assign task to this user. Can be a user ID, name, or email address. User must be a collaborator on the target project."
|
|
918
948
|
)
|
|
919
|
-
}),
|
|
920
|
-
tasks: s.array(
|
|
921
|
-
},
|
|
949
|
+
}), mt = {
|
|
950
|
+
tasks: s.array(ht).min(1).describe("The array of tasks to add.")
|
|
951
|
+
}, ft = {
|
|
922
952
|
tasks: s.array(W).describe("The created tasks."),
|
|
923
953
|
totalCount: s.number().describe("The total number of tasks created.")
|
|
924
|
-
},
|
|
954
|
+
}, bt = {
|
|
925
955
|
name: g.ADD_TASKS,
|
|
926
956
|
description: "Add one or more tasks to a project, section, or parent. Supports assignment to project collaborators.",
|
|
927
|
-
parameters:
|
|
928
|
-
outputSchema:
|
|
957
|
+
parameters: mt,
|
|
958
|
+
outputSchema: ft,
|
|
929
959
|
async execute({ tasks: e }, t) {
|
|
930
|
-
const o = e.map((c) =>
|
|
960
|
+
const o = e.map((c) => gt(c, t)), r = (await Promise.all(o)).map(O);
|
|
931
961
|
return {
|
|
932
|
-
textContent:
|
|
962
|
+
textContent: Tt({
|
|
933
963
|
tasks: r,
|
|
934
964
|
args: { tasks: e }
|
|
935
965
|
}),
|
|
@@ -940,7 +970,7 @@ const pt = s.object({
|
|
|
940
970
|
};
|
|
941
971
|
}
|
|
942
972
|
};
|
|
943
|
-
async function
|
|
973
|
+
async function gt(e, t) {
|
|
944
974
|
const {
|
|
945
975
|
duration: o,
|
|
946
976
|
projectId: n,
|
|
@@ -962,13 +992,13 @@ async function bt(e, t) {
|
|
|
962
992
|
labels: d,
|
|
963
993
|
deadlineDate: l
|
|
964
994
|
};
|
|
965
|
-
if (a && (b.priority =
|
|
995
|
+
if (a && (b.priority = Ie(a)), c && !p && !r && !i)
|
|
966
996
|
throw new Error(
|
|
967
997
|
`Task "${e.content}": Cannot assign tasks without specifying project context. Please specify a projectId, sectionId, or parentId.`
|
|
968
998
|
);
|
|
969
999
|
if (o)
|
|
970
1000
|
try {
|
|
971
|
-
const { minutes: m } =
|
|
1001
|
+
const { minutes: m } = be(o);
|
|
972
1002
|
b = {
|
|
973
1003
|
...b,
|
|
974
1004
|
duration: m,
|
|
@@ -993,7 +1023,7 @@ async function bt(e, t) {
|
|
|
993
1023
|
throw new Error(
|
|
994
1024
|
`Task "${e.content}": Cannot determine target project for assignment validation`
|
|
995
1025
|
);
|
|
996
|
-
const y = await
|
|
1026
|
+
const y = await re.validateTaskCreationAssignment(
|
|
997
1027
|
t,
|
|
998
1028
|
m,
|
|
999
1029
|
c
|
|
@@ -1008,7 +1038,7 @@ async function bt(e, t) {
|
|
|
1008
1038
|
}
|
|
1009
1039
|
return await t.addTask(b);
|
|
1010
1040
|
}
|
|
1011
|
-
function
|
|
1041
|
+
function Tt({
|
|
1012
1042
|
tasks: e,
|
|
1013
1043
|
args: t
|
|
1014
1044
|
}) {
|
|
@@ -1020,24 +1050,24 @@ function gt({
|
|
|
1020
1050
|
const r = Array.from(o)[0];
|
|
1021
1051
|
n = r === "inbox" ? "" : `to ${r}`;
|
|
1022
1052
|
} else o.size > 1 && (n = "to multiple contexts");
|
|
1023
|
-
return
|
|
1053
|
+
return ke("Added", e, {
|
|
1024
1054
|
context: n,
|
|
1025
1055
|
showDetails: !0
|
|
1026
1056
|
});
|
|
1027
1057
|
}
|
|
1028
|
-
const
|
|
1058
|
+
const yt = {
|
|
1029
1059
|
ids: s.array(s.string().min(1)).min(1).describe("The IDs of the tasks to complete.")
|
|
1030
|
-
},
|
|
1060
|
+
}, It = {
|
|
1031
1061
|
completed: s.array(s.string()).describe("The IDs of successfully completed tasks."),
|
|
1032
|
-
failures: s.array(
|
|
1062
|
+
failures: s.array(ze).describe("Failed task completions with error details."),
|
|
1033
1063
|
totalRequested: s.number().describe("The total number of tasks requested to complete."),
|
|
1034
1064
|
successCount: s.number().describe("The number of successfully completed tasks."),
|
|
1035
1065
|
failureCount: s.number().describe("The number of failed task completions.")
|
|
1036
|
-
},
|
|
1066
|
+
}, kt = {
|
|
1037
1067
|
name: g.COMPLETE_TASKS,
|
|
1038
1068
|
description: "Complete one or more tasks by their IDs.",
|
|
1039
|
-
parameters:
|
|
1040
|
-
outputSchema:
|
|
1069
|
+
parameters: yt,
|
|
1070
|
+
outputSchema: It,
|
|
1041
1071
|
async execute(e, t) {
|
|
1042
1072
|
const o = [], n = [];
|
|
1043
1073
|
for (const i of e.ids)
|
|
@@ -1051,7 +1081,7 @@ const Tt = {
|
|
|
1051
1081
|
});
|
|
1052
1082
|
}
|
|
1053
1083
|
return {
|
|
1054
|
-
textContent:
|
|
1084
|
+
textContent: wt({
|
|
1055
1085
|
completed: o,
|
|
1056
1086
|
failures: n,
|
|
1057
1087
|
args: e
|
|
@@ -1066,12 +1096,12 @@ const Tt = {
|
|
|
1066
1096
|
};
|
|
1067
1097
|
}
|
|
1068
1098
|
};
|
|
1069
|
-
function
|
|
1099
|
+
function wt({
|
|
1070
1100
|
completed: e,
|
|
1071
1101
|
failures: t,
|
|
1072
1102
|
args: o
|
|
1073
1103
|
}) {
|
|
1074
|
-
return
|
|
1104
|
+
return lt({
|
|
1075
1105
|
action: "Completed tasks",
|
|
1076
1106
|
success: e.length,
|
|
1077
1107
|
total: o.ids.length,
|
|
@@ -1079,20 +1109,20 @@ function kt({
|
|
|
1079
1109
|
failures: t
|
|
1080
1110
|
});
|
|
1081
1111
|
}
|
|
1082
|
-
const
|
|
1112
|
+
const jt = {
|
|
1083
1113
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of entity to delete."),
|
|
1084
1114
|
id: s.string().min(1).describe("The ID of the entity to delete.")
|
|
1085
|
-
},
|
|
1115
|
+
}, vt = {
|
|
1086
1116
|
deletedEntity: s.object({
|
|
1087
1117
|
type: s.enum(["project", "section", "task", "comment"]).describe("The type of deleted entity."),
|
|
1088
1118
|
id: s.string().describe("The ID of the deleted entity.")
|
|
1089
1119
|
}).describe("Information about the deleted entity."),
|
|
1090
1120
|
success: s.boolean().describe("Whether the deletion was successful.")
|
|
1091
|
-
},
|
|
1121
|
+
}, Ct = {
|
|
1092
1122
|
name: g.DELETE_OBJECT,
|
|
1093
1123
|
description: "Delete a project, section, task, or comment by its ID.",
|
|
1094
|
-
parameters:
|
|
1095
|
-
outputSchema:
|
|
1124
|
+
parameters: jt,
|
|
1125
|
+
outputSchema: vt,
|
|
1096
1126
|
async execute(e, t) {
|
|
1097
1127
|
switch (e.type) {
|
|
1098
1128
|
case "project":
|
|
@@ -1116,7 +1146,7 @@ const wt = {
|
|
|
1116
1146
|
}
|
|
1117
1147
|
};
|
|
1118
1148
|
}
|
|
1119
|
-
},
|
|
1149
|
+
}, St = {
|
|
1120
1150
|
id: s.string().min(1).describe(
|
|
1121
1151
|
'A unique identifier for the document in the format "task:{id}" or "project:{id}".'
|
|
1122
1152
|
)
|
|
@@ -1126,10 +1156,10 @@ const wt = {
|
|
|
1126
1156
|
text: s.string().describe("The text content of the document."),
|
|
1127
1157
|
url: s.string().describe("The URL of the document."),
|
|
1128
1158
|
metadata: s.record(s.unknown()).optional().describe("Additional metadata about the document.")
|
|
1129
|
-
},
|
|
1159
|
+
}, Dt = {
|
|
1130
1160
|
name: g.FETCH,
|
|
1131
1161
|
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}".',
|
|
1132
|
-
parameters:
|
|
1162
|
+
parameters: St,
|
|
1133
1163
|
outputSchema: $t,
|
|
1134
1164
|
async execute(e, t) {
|
|
1135
1165
|
const { id: o } = e, [n, r] = o.split(":", 2);
|
|
@@ -1148,7 +1178,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1148
1178
|
id: `task:${a.id}`,
|
|
1149
1179
|
title: a.content,
|
|
1150
1180
|
text: d.join(""),
|
|
1151
|
-
url:
|
|
1181
|
+
url: he(a.id),
|
|
1152
1182
|
metadata: {
|
|
1153
1183
|
priority: a.priority,
|
|
1154
1184
|
projectId: a.projectId,
|
|
@@ -1163,7 +1193,7 @@ Labels: ${a.labels.join(", ")}`), i = {
|
|
|
1163
1193
|
}
|
|
1164
1194
|
};
|
|
1165
1195
|
} else {
|
|
1166
|
-
const c = await t.getProject(r), a =
|
|
1196
|
+
const c = await t.getProject(r), a = Te(c), d = [a.name];
|
|
1167
1197
|
a.isShared && d.push(`
|
|
1168
1198
|
|
|
1169
1199
|
Shared project`), a.isFavorite && d.push(`
|
|
@@ -1171,7 +1201,7 @@ Favorite: Yes`), i = {
|
|
|
1171
1201
|
id: `project:${a.id}`,
|
|
1172
1202
|
title: a.name,
|
|
1173
1203
|
text: d.join(""),
|
|
1174
|
-
url:
|
|
1204
|
+
url: me(a.id),
|
|
1175
1205
|
metadata: {
|
|
1176
1206
|
color: a.color,
|
|
1177
1207
|
isFavorite: a.isFavorite,
|
|
@@ -1184,7 +1214,7 @@ Favorite: Yes`), i = {
|
|
|
1184
1214
|
}
|
|
1185
1215
|
return { textContent: JSON.stringify(i) };
|
|
1186
1216
|
}
|
|
1187
|
-
},
|
|
1217
|
+
}, xt = {
|
|
1188
1218
|
objectType: s.enum(["task", "project", "comment"]).optional().describe("Type of object to filter by."),
|
|
1189
1219
|
objectId: s.string().optional().describe("Filter by specific object ID (task, project, or comment)."),
|
|
1190
1220
|
eventType: s.enum([
|
|
@@ -1201,28 +1231,28 @@ Favorite: Yes`), i = {
|
|
|
1201
1231
|
projectId: s.string().optional().describe("Filter events by parent project ID."),
|
|
1202
1232
|
taskId: s.string().optional().describe("Filter events by parent task ID (for subtask events)."),
|
|
1203
1233
|
initiatorId: s.string().optional().describe("Filter by the user ID who initiated the event."),
|
|
1204
|
-
limit: s.number().int().min(1).max(
|
|
1234
|
+
limit: s.number().int().min(1).max($.ACTIVITY_MAX).default($.ACTIVITY_DEFAULT).describe("Maximum number of activity events to return."),
|
|
1205
1235
|
cursor: s.string().optional().describe("Pagination cursor for retrieving the next page of results.")
|
|
1206
|
-
},
|
|
1207
|
-
events: s.array(
|
|
1236
|
+
}, At = {
|
|
1237
|
+
events: s.array(We).describe("The activity events."),
|
|
1208
1238
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1209
1239
|
totalCount: s.number().describe("The total number of events in this page."),
|
|
1210
1240
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1211
1241
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1212
|
-
},
|
|
1242
|
+
}, Ut = {
|
|
1213
1243
|
name: g.FIND_ACTIVITY,
|
|
1214
1244
|
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.",
|
|
1215
|
-
parameters:
|
|
1216
|
-
outputSchema:
|
|
1245
|
+
parameters: xt,
|
|
1246
|
+
outputSchema: At,
|
|
1217
1247
|
async execute(e, t) {
|
|
1218
1248
|
const { objectType: o, objectId: n, eventType: r, projectId: i, taskId: c, initiatorId: a, limit: d, cursor: l } = e, u = {
|
|
1219
1249
|
limit: d,
|
|
1220
1250
|
cursor: l ?? null
|
|
1221
1251
|
};
|
|
1222
1252
|
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);
|
|
1223
|
-
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(
|
|
1253
|
+
const { results: p, nextCursor: b } = await t.getActivityLogs(u), m = p.map(Re);
|
|
1224
1254
|
return {
|
|
1225
|
-
textContent:
|
|
1255
|
+
textContent: Pt({ events: m, args: e, nextCursor: b }),
|
|
1226
1256
|
structuredContent: {
|
|
1227
1257
|
events: m,
|
|
1228
1258
|
nextCursor: b ?? void 0,
|
|
@@ -1233,7 +1263,7 @@ Favorite: Yes`), i = {
|
|
|
1233
1263
|
};
|
|
1234
1264
|
}
|
|
1235
1265
|
};
|
|
1236
|
-
function
|
|
1266
|
+
function Pt({
|
|
1237
1267
|
events: e,
|
|
1238
1268
|
args: t,
|
|
1239
1269
|
nextCursor: o
|
|
@@ -1254,12 +1284,12 @@ function Ut({
|
|
|
1254
1284
|
limit: t.limit,
|
|
1255
1285
|
nextCursor: o ?? void 0,
|
|
1256
1286
|
filterHints: i,
|
|
1257
|
-
previewLines:
|
|
1287
|
+
previewLines: Et(e, Math.min(e.length, t.limit)),
|
|
1258
1288
|
zeroReasonHints: c
|
|
1259
1289
|
});
|
|
1260
1290
|
}
|
|
1261
|
-
function
|
|
1262
|
-
const n = e.slice(0, t).map(
|
|
1291
|
+
function Et(e, t = 10) {
|
|
1292
|
+
const n = e.slice(0, t).map(Ot).join(`
|
|
1263
1293
|
`);
|
|
1264
1294
|
if (e.length > t) {
|
|
1265
1295
|
const r = e.length - t;
|
|
@@ -1268,8 +1298,8 @@ function Pt(e, t = 10) {
|
|
|
1268
1298
|
}
|
|
1269
1299
|
return n;
|
|
1270
1300
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const t =
|
|
1301
|
+
function Ot(e) {
|
|
1302
|
+
const t = _t(e.eventDate), o = `${e.eventType} ${e.objectType}`;
|
|
1273
1303
|
let n = "";
|
|
1274
1304
|
if (e.extraData) {
|
|
1275
1305
|
const a = e.extraData.content || e.extraData.name || e.extraData.last_content;
|
|
@@ -1278,7 +1308,7 @@ function Et(e) {
|
|
|
1278
1308
|
const r = e.objectId ? ` • id=${e.objectId}` : "", i = e.initiatorId ? ` • by=${e.initiatorId}` : " • system", c = e.parentProjectId ? ` • project=${e.parentProjectId}` : "";
|
|
1279
1309
|
return ` [${t}] ${o}${n}${r}${i}${c}`;
|
|
1280
1310
|
}
|
|
1281
|
-
function
|
|
1311
|
+
function _t(e) {
|
|
1282
1312
|
try {
|
|
1283
1313
|
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", {
|
|
1284
1314
|
hour: "2-digit",
|
|
@@ -1291,23 +1321,23 @@ function Ot(e) {
|
|
|
1291
1321
|
return e;
|
|
1292
1322
|
}
|
|
1293
1323
|
}
|
|
1294
|
-
const
|
|
1324
|
+
const Nt = {
|
|
1295
1325
|
taskId: s.string().optional().describe("Find comments for a specific task."),
|
|
1296
1326
|
projectId: s.string().optional().describe(
|
|
1297
1327
|
'Find comments for a specific project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
1298
1328
|
),
|
|
1299
1329
|
commentId: s.string().optional().describe("Get a specific comment by ID."),
|
|
1300
1330
|
cursor: s.string().optional().describe("Pagination cursor for retrieving more results."),
|
|
1301
|
-
limit: s.number().int().min(1).max(
|
|
1302
|
-
},
|
|
1303
|
-
comments: s.array(
|
|
1331
|
+
limit: s.number().int().min(1).max($.COMMENTS_MAX).optional().describe("Maximum number of comments to return")
|
|
1332
|
+
}, Mt = {
|
|
1333
|
+
comments: s.array(ne).describe("The found comments."),
|
|
1304
1334
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1305
1335
|
totalCount: s.number().describe("The total number of comments in this page.")
|
|
1306
|
-
},
|
|
1336
|
+
}, Ft = {
|
|
1307
1337
|
name: g.FIND_COMMENTS,
|
|
1308
1338
|
description: "Find comments by task, project, or get a specific comment by ID. Exactly one of taskId, projectId, or commentId must be provided.",
|
|
1309
|
-
parameters:
|
|
1310
|
-
outputSchema:
|
|
1339
|
+
parameters: Nt,
|
|
1340
|
+
outputSchema: Mt,
|
|
1311
1341
|
async execute(e, t) {
|
|
1312
1342
|
const o = [e.taskId, e.projectId, e.commentId].filter(Boolean);
|
|
1313
1343
|
if (o.length === 0)
|
|
@@ -1317,45 +1347,46 @@ const _t = {
|
|
|
1317
1347
|
"Cannot provide multiple search parameters. Choose one of: taskId, projectId, or commentId."
|
|
1318
1348
|
);
|
|
1319
1349
|
const n = e.projectId === "inbox" ? (await t.getUser()).inboxProjectId : e.projectId;
|
|
1320
|
-
let r
|
|
1350
|
+
let r = !1, i = null, c;
|
|
1321
1351
|
if (e.commentId)
|
|
1322
|
-
|
|
1352
|
+
c = [await t.getComment(e.commentId)];
|
|
1323
1353
|
else if (e.taskId) {
|
|
1324
|
-
const
|
|
1354
|
+
const l = await t.getComments({
|
|
1325
1355
|
taskId: e.taskId,
|
|
1326
1356
|
cursor: e.cursor || null,
|
|
1327
|
-
limit: e.limit ||
|
|
1357
|
+
limit: e.limit || $.COMMENTS_DEFAULT
|
|
1328
1358
|
});
|
|
1329
|
-
|
|
1359
|
+
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1330
1360
|
} else if (n) {
|
|
1331
|
-
const
|
|
1361
|
+
const l = await t.getComments({
|
|
1332
1362
|
projectId: n,
|
|
1333
1363
|
cursor: e.cursor || null,
|
|
1334
|
-
limit: e.limit ||
|
|
1364
|
+
limit: e.limit || $.COMMENTS_DEFAULT
|
|
1335
1365
|
});
|
|
1336
|
-
|
|
1366
|
+
c = l.results, r = l.nextCursor !== null, i = l.nextCursor;
|
|
1337
1367
|
} else
|
|
1338
1368
|
throw new Error("Invalid state: no search parameter provided");
|
|
1369
|
+
const a = c.map(ee);
|
|
1339
1370
|
return {
|
|
1340
|
-
textContent:
|
|
1341
|
-
comments:
|
|
1371
|
+
textContent: Rt({
|
|
1372
|
+
comments: a,
|
|
1342
1373
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
1343
1374
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
1344
|
-
hasMore:
|
|
1345
|
-
nextCursor:
|
|
1375
|
+
hasMore: r,
|
|
1376
|
+
nextCursor: i
|
|
1346
1377
|
}),
|
|
1347
1378
|
structuredContent: {
|
|
1348
|
-
comments:
|
|
1379
|
+
comments: a,
|
|
1349
1380
|
searchType: e.commentId ? "single" : e.taskId ? "task" : "project",
|
|
1350
1381
|
searchId: e.commentId || e.taskId || e.projectId || "",
|
|
1351
|
-
hasMore:
|
|
1352
|
-
nextCursor:
|
|
1353
|
-
totalCount:
|
|
1382
|
+
hasMore: r,
|
|
1383
|
+
nextCursor: i ?? void 0,
|
|
1384
|
+
totalCount: a.length
|
|
1354
1385
|
}
|
|
1355
1386
|
};
|
|
1356
1387
|
}
|
|
1357
1388
|
};
|
|
1358
|
-
function
|
|
1389
|
+
function Rt({
|
|
1359
1390
|
comments: e,
|
|
1360
1391
|
searchType: t,
|
|
1361
1392
|
searchId: o,
|
|
@@ -1369,30 +1400,30 @@ function Ft({
|
|
|
1369
1400
|
const c = e[0];
|
|
1370
1401
|
if (!c)
|
|
1371
1402
|
return "Comment not found";
|
|
1372
|
-
i = `Found comment${c.fileAttachment !==
|
|
1403
|
+
i = `Found comment${c.fileAttachment !== void 0 ? ` • Has attachment: ${c.fileAttachment?.fileName || "file"}` : ""} • id=${c.id}`;
|
|
1373
1404
|
} else {
|
|
1374
|
-
const c = e.filter((l) => l.fileAttachment !==
|
|
1405
|
+
const c = e.filter((l) => l.fileAttachment !== void 0).length, a = c > 0 ? ` (${c} with attachments)` : "", d = e.length === 1 ? "comment" : "comments";
|
|
1375
1406
|
i = `Found ${e.length} ${d} for ${t} ${o}${a}`, n && (i += " • More available");
|
|
1376
1407
|
}
|
|
1377
1408
|
if (r) {
|
|
1378
|
-
const c =
|
|
1409
|
+
const c = we([], r);
|
|
1379
1410
|
return `${i}
|
|
1380
1411
|
${c}`;
|
|
1381
1412
|
}
|
|
1382
1413
|
return i;
|
|
1383
1414
|
}
|
|
1384
|
-
const
|
|
1415
|
+
const Lt = ["and", "or"], ie = {
|
|
1385
1416
|
labels: s.string().array().optional().describe("The labels to filter the tasks by"),
|
|
1386
|
-
labelsOperator: s.enum(
|
|
1417
|
+
labelsOperator: s.enum(Lt).optional().describe(
|
|
1387
1418
|
'The operator to use when filtering by labels. This will dictate whether a task has all labels, or some of them. Default is "or".'
|
|
1388
1419
|
)
|
|
1389
1420
|
};
|
|
1390
|
-
function
|
|
1421
|
+
function ae(e = [], t = "or") {
|
|
1391
1422
|
if (e.length === 0) return "";
|
|
1392
1423
|
const o = t === "and" ? " & " : " | ";
|
|
1393
1424
|
return `(${e.map((i) => i.startsWith("@") ? i : `@${i}`).join(` ${o} `)})`;
|
|
1394
1425
|
}
|
|
1395
|
-
const
|
|
1426
|
+
const Bt = {
|
|
1396
1427
|
getBy: s.enum(["completion", "due"]).default("completion").describe(
|
|
1397
1428
|
'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).'
|
|
1398
1429
|
),
|
|
@@ -1407,26 +1438,26 @@ const Lt = {
|
|
|
1407
1438
|
responsibleUser: s.string().optional().describe(
|
|
1408
1439
|
"Find tasks assigned to this user. Can be a user ID, name, or email address. Defaults to all collaborators when omitted."
|
|
1409
1440
|
),
|
|
1410
|
-
limit: s.number().int().min(1).max(
|
|
1441
|
+
limit: s.number().int().min(1).max($.COMPLETED_TASKS_MAX).default($.COMPLETED_TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1411
1442
|
cursor: s.string().optional().describe(
|
|
1412
1443
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1413
1444
|
),
|
|
1414
|
-
...
|
|
1415
|
-
},
|
|
1445
|
+
...ie
|
|
1446
|
+
}, Wt = {
|
|
1416
1447
|
tasks: s.array(W).describe("The found completed tasks."),
|
|
1417
1448
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1418
1449
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1419
1450
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1420
1451
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1421
|
-
},
|
|
1452
|
+
}, Yt = {
|
|
1422
1453
|
name: g.FIND_COMPLETED_TASKS,
|
|
1423
1454
|
description: "Get completed tasks (includes all collaborators by default—use responsibleUser to narrow).",
|
|
1424
|
-
parameters:
|
|
1425
|
-
outputSchema:
|
|
1455
|
+
parameters: Bt,
|
|
1456
|
+
outputSchema: Wt,
|
|
1426
1457
|
async execute(e, t) {
|
|
1427
|
-
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await
|
|
1428
|
-
let m =
|
|
1429
|
-
u && p && (m =
|
|
1458
|
+
const { getBy: o, labels: n, labelsOperator: r, since: i, until: c, responsibleUser: a, projectId: d, ...l } = e, u = await Q(t, a), p = u?.email;
|
|
1459
|
+
let m = ae(n, r);
|
|
1460
|
+
u && p && (m = K(m, `assigned to: ${p}`));
|
|
1430
1461
|
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({
|
|
1431
1462
|
...l,
|
|
1432
1463
|
projectId: w,
|
|
@@ -1441,7 +1472,7 @@ const Lt = {
|
|
|
1441
1472
|
...m ? { filterQuery: m, filterLang: "en" } : {}
|
|
1442
1473
|
}), f = C.map(O);
|
|
1443
1474
|
return {
|
|
1444
|
-
textContent:
|
|
1475
|
+
textContent: zt({
|
|
1445
1476
|
tasks: f,
|
|
1446
1477
|
args: e,
|
|
1447
1478
|
nextCursor: v,
|
|
@@ -1457,7 +1488,7 @@ const Lt = {
|
|
|
1457
1488
|
};
|
|
1458
1489
|
}
|
|
1459
1490
|
};
|
|
1460
|
-
function
|
|
1491
|
+
function zt({
|
|
1461
1492
|
tasks: e,
|
|
1462
1493
|
args: t,
|
|
1463
1494
|
nextCursor: o,
|
|
@@ -1479,17 +1510,17 @@ function Yt({
|
|
|
1479
1510
|
limit: t.limit,
|
|
1480
1511
|
nextCursor: o ?? void 0,
|
|
1481
1512
|
filterHints: c,
|
|
1482
|
-
previewLines:
|
|
1513
|
+
previewLines: H(e, Math.min(e.length, t.limit)),
|
|
1483
1514
|
zeroReasonHints: a
|
|
1484
1515
|
});
|
|
1485
1516
|
}
|
|
1486
|
-
const { FIND_PROJECTS: Kt, ADD_TASKS:
|
|
1517
|
+
const { FIND_PROJECTS: Kt, ADD_TASKS: je, UPDATE_TASKS: ve } = g, Ht = {
|
|
1487
1518
|
projectId: s.string().min(1).describe("The ID of the project to search for collaborators in."),
|
|
1488
1519
|
searchTerm: s.string().optional().describe(
|
|
1489
1520
|
"Search for a collaborator by name or email (partial and case insensitive match). If omitted, all collaborators in the project are returned."
|
|
1490
1521
|
)
|
|
1491
1522
|
}, Vt = {
|
|
1492
|
-
collaborators: s.array(
|
|
1523
|
+
collaborators: s.array(Ye).describe("The found collaborators."),
|
|
1493
1524
|
projectInfo: s.object({
|
|
1494
1525
|
id: s.string().describe("The project ID."),
|
|
1495
1526
|
name: s.string().describe("The project name."),
|
|
@@ -1498,10 +1529,10 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: we, UPDATE_TASKS: je } = g, zt = {
|
|
|
1498
1529
|
totalCount: s.number().describe("The total number of collaborators found."),
|
|
1499
1530
|
totalAvailable: s.number().optional().describe("The total number of available collaborators in the project."),
|
|
1500
1531
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1501
|
-
},
|
|
1532
|
+
}, Gt = {
|
|
1502
1533
|
name: g.FIND_PROJECT_COLLABORATORS,
|
|
1503
1534
|
description: "Search for collaborators by name or other criteria in a project.",
|
|
1504
|
-
parameters:
|
|
1535
|
+
parameters: Ht,
|
|
1505
1536
|
outputSchema: Vt,
|
|
1506
1537
|
async execute(e, t) {
|
|
1507
1538
|
const { projectId: o, searchTerm: n } = e;
|
|
@@ -1515,7 +1546,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: we, UPDATE_TASKS: je } = g, zt = {
|
|
|
1515
1546
|
|
|
1516
1547
|
**Next steps:**
|
|
1517
1548
|
• Share the project to enable collaboration
|
|
1518
|
-
• Use ${
|
|
1549
|
+
• Use ${je} and ${ve} for assignment features once shared`,
|
|
1519
1550
|
structuredContent: {
|
|
1520
1551
|
collaborators: [],
|
|
1521
1552
|
projectInfo: {
|
|
@@ -1560,7 +1591,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: we, UPDATE_TASKS: je } = g, zt = {
|
|
|
1560
1591
|
);
|
|
1561
1592
|
}
|
|
1562
1593
|
return {
|
|
1563
|
-
textContent:
|
|
1594
|
+
textContent: qt({
|
|
1564
1595
|
collaborators: a,
|
|
1565
1596
|
projectName: r,
|
|
1566
1597
|
searchTerm: n,
|
|
@@ -1580,7 +1611,7 @@ const { FIND_PROJECTS: Kt, ADD_TASKS: we, UPDATE_TASKS: je } = g, zt = {
|
|
|
1580
1611
|
};
|
|
1581
1612
|
}
|
|
1582
1613
|
};
|
|
1583
|
-
function
|
|
1614
|
+
function qt({
|
|
1584
1615
|
collaborators: e,
|
|
1585
1616
|
projectName: t,
|
|
1586
1617
|
searchTerm: o,
|
|
@@ -1596,7 +1627,7 @@ function Gt({
|
|
|
1596
1627
|
const a = [];
|
|
1597
1628
|
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")));
|
|
1598
1629
|
const d = [];
|
|
1599
|
-
return e.length > 0 ? (d.push(`Use ${
|
|
1630
|
+
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({
|
|
1600
1631
|
subject: r,
|
|
1601
1632
|
count: e.length,
|
|
1602
1633
|
filterHints: i,
|
|
@@ -1606,32 +1637,32 @@ function Gt({
|
|
|
1606
1637
|
nextSteps: d
|
|
1607
1638
|
});
|
|
1608
1639
|
}
|
|
1609
|
-
const { ADD_PROJECTS:
|
|
1640
|
+
const { ADD_PROJECTS: Jt } = g, Xt = {
|
|
1610
1641
|
search: s.string().optional().describe(
|
|
1611
1642
|
"Search for a project by name (partial and case insensitive match). If omitted, all projects are returned."
|
|
1612
1643
|
),
|
|
1613
|
-
limit: s.number().int().min(1).max(
|
|
1644
|
+
limit: s.number().int().min(1).max($.PROJECTS_MAX).default($.PROJECTS_DEFAULT).describe("The maximum number of projects to return."),
|
|
1614
1645
|
cursor: s.string().optional().describe(
|
|
1615
1646
|
"The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1616
1647
|
)
|
|
1617
|
-
},
|
|
1618
|
-
projects: s.array(
|
|
1648
|
+
}, Zt = {
|
|
1649
|
+
projects: s.array(se).describe("The found projects."),
|
|
1619
1650
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1620
1651
|
totalCount: s.number().describe("The total number of projects in this page."),
|
|
1621
1652
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1622
1653
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1623
|
-
},
|
|
1654
|
+
}, Qt = {
|
|
1624
1655
|
name: g.FIND_PROJECTS,
|
|
1625
1656
|
description: "List all projects or search for projects by name. If search parameter is omitted, all projects are returned.",
|
|
1626
|
-
parameters:
|
|
1627
|
-
outputSchema:
|
|
1657
|
+
parameters: Xt,
|
|
1658
|
+
outputSchema: Zt,
|
|
1628
1659
|
async execute(e, t) {
|
|
1629
1660
|
const { results: o, nextCursor: n } = await t.getProjects({
|
|
1630
1661
|
limit: e.limit,
|
|
1631
1662
|
cursor: e.cursor ?? null
|
|
1632
|
-
}), r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(
|
|
1663
|
+
}), r = e.search ? e.search.toLowerCase() : void 0, c = (r ? o.filter((a) => a.name.toLowerCase().includes(r)) : o).map(Te);
|
|
1633
1664
|
return {
|
|
1634
|
-
textContent:
|
|
1665
|
+
textContent: es({ projects: c, args: e, nextCursor: n }),
|
|
1635
1666
|
structuredContent: {
|
|
1636
1667
|
projects: c,
|
|
1637
1668
|
nextCursor: n ?? void 0,
|
|
@@ -1642,17 +1673,17 @@ const { ADD_PROJECTS: qt } = g, Jt = {
|
|
|
1642
1673
|
};
|
|
1643
1674
|
}
|
|
1644
1675
|
};
|
|
1645
|
-
function
|
|
1676
|
+
function es({
|
|
1646
1677
|
projects: e,
|
|
1647
1678
|
args: t,
|
|
1648
1679
|
nextCursor: o
|
|
1649
1680
|
}) {
|
|
1650
1681
|
const n = t.search ? `Projects matching "${t.search}"` : "Projects", r = [];
|
|
1651
1682
|
t.search && r.push(`search: "${t.search}"`);
|
|
1652
|
-
const i = 10, a = e.slice(0, i).map(
|
|
1683
|
+
const i = 10, a = e.slice(0, i).map(pt).join(`
|
|
1653
1684
|
`), d = e.length - i, l = d > 0 ? `${a}
|
|
1654
1685
|
…and ${d} more` : a, u = [];
|
|
1655
|
-
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 ${
|
|
1686
|
+
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({
|
|
1656
1687
|
subject: n,
|
|
1657
1688
|
count: e.length,
|
|
1658
1689
|
limit: t.limit,
|
|
@@ -1662,28 +1693,28 @@ function Qt({
|
|
|
1662
1693
|
zeroReasonHints: u
|
|
1663
1694
|
});
|
|
1664
1695
|
}
|
|
1665
|
-
const { ADD_SECTIONS:
|
|
1696
|
+
const { ADD_SECTIONS: ts } = g, ss = {
|
|
1666
1697
|
projectId: s.string().min(1).describe(
|
|
1667
1698
|
'The ID of the project to search sections in. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
1668
1699
|
),
|
|
1669
1700
|
search: s.string().optional().describe(
|
|
1670
1701
|
"Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."
|
|
1671
1702
|
)
|
|
1672
|
-
},
|
|
1673
|
-
sections: s.array(
|
|
1703
|
+
}, os = {
|
|
1704
|
+
sections: s.array(oe).describe("The found sections."),
|
|
1674
1705
|
totalCount: s.number().describe("The total number of sections found."),
|
|
1675
1706
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1676
|
-
},
|
|
1707
|
+
}, ns = {
|
|
1677
1708
|
name: g.FIND_SECTIONS,
|
|
1678
1709
|
description: "Search for sections by name or other criteria in a project.",
|
|
1679
|
-
parameters:
|
|
1680
|
-
outputSchema:
|
|
1710
|
+
parameters: ss,
|
|
1711
|
+
outputSchema: os,
|
|
1681
1712
|
async execute(e, t) {
|
|
1682
1713
|
const o = e.projectId === "inbox" ? (await t.getUser()).inboxProjectId : e.projectId, { results: n } = await t.getSections({
|
|
1683
1714
|
projectId: o
|
|
1684
1715
|
}), 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 }));
|
|
1685
1716
|
return {
|
|
1686
|
-
textContent:
|
|
1717
|
+
textContent: rs({
|
|
1687
1718
|
sections: c,
|
|
1688
1719
|
projectId: e.projectId,
|
|
1689
1720
|
search: e.search
|
|
@@ -1696,13 +1727,13 @@ const { ADD_SECTIONS: es } = g, ts = {
|
|
|
1696
1727
|
};
|
|
1697
1728
|
}
|
|
1698
1729
|
};
|
|
1699
|
-
function
|
|
1730
|
+
function rs({
|
|
1700
1731
|
sections: e,
|
|
1701
1732
|
projectId: t,
|
|
1702
1733
|
search: o
|
|
1703
1734
|
}) {
|
|
1704
1735
|
const n = [];
|
|
1705
|
-
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 ${
|
|
1736
|
+
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`));
|
|
1706
1737
|
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(`
|
|
1707
1738
|
`) : void 0;
|
|
1708
1739
|
return N({
|
|
@@ -1712,7 +1743,7 @@ function ns({
|
|
|
1712
1743
|
zeroReasonHints: n
|
|
1713
1744
|
});
|
|
1714
1745
|
}
|
|
1715
|
-
const { FIND_COMPLETED_TASKS:
|
|
1746
|
+
const { FIND_COMPLETED_TASKS: de, ADD_TASKS: le } = g, is = {
|
|
1716
1747
|
searchText: s.string().optional().describe("The text to search for in tasks."),
|
|
1717
1748
|
projectId: s.string().optional().describe(
|
|
1718
1749
|
'Find tasks in this project. Project ID should be an ID string, or the text "inbox", for inbox tasks.'
|
|
@@ -1720,25 +1751,25 @@ const { FIND_COMPLETED_TASKS: ce, ADD_TASKS: de } = g, rs = {
|
|
|
1720
1751
|
sectionId: s.string().optional().describe("Find tasks in this section."),
|
|
1721
1752
|
parentId: s.string().optional().describe("Find subtasks of this parent task."),
|
|
1722
1753
|
responsibleUser: s.string().optional().describe("Find tasks assigned to this user. Can be a user ID, name, or email address."),
|
|
1723
|
-
responsibleUserFiltering: s.enum(
|
|
1754
|
+
responsibleUserFiltering: s.enum(ge).optional().describe(
|
|
1724
1755
|
'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`.'
|
|
1725
1756
|
),
|
|
1726
|
-
limit: s.number().int().min(1).max(
|
|
1757
|
+
limit: s.number().int().min(1).max($.TASKS_MAX).default($.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1727
1758
|
cursor: s.string().optional().describe(
|
|
1728
1759
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1729
1760
|
),
|
|
1730
|
-
...
|
|
1731
|
-
},
|
|
1761
|
+
...ie
|
|
1762
|
+
}, as = {
|
|
1732
1763
|
tasks: s.array(W).describe("The found tasks."),
|
|
1733
1764
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1734
1765
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1735
1766
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1736
1767
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1737
|
-
},
|
|
1768
|
+
}, cs = {
|
|
1738
1769
|
name: g.FIND_TASKS,
|
|
1739
1770
|
description: "Find tasks by text search, or by project/section/parent container/responsible user. At least one filter must be provided.",
|
|
1740
|
-
parameters:
|
|
1741
|
-
outputSchema:
|
|
1771
|
+
parameters: is,
|
|
1772
|
+
outputSchema: as,
|
|
1742
1773
|
async execute(e, t) {
|
|
1743
1774
|
const {
|
|
1744
1775
|
searchText: o,
|
|
@@ -1756,39 +1787,39 @@ const { FIND_COMPLETED_TASKS: ce, ADD_TASKS: de } = g, rs = {
|
|
|
1756
1787
|
throw new Error(
|
|
1757
1788
|
"At least one filter must be provided: searchText, projectId, sectionId, parentId, responsibleUser, or labels"
|
|
1758
1789
|
);
|
|
1759
|
-
const y = await
|
|
1790
|
+
const y = await Q(t, c), k = y?.userId, w = y?.email;
|
|
1760
1791
|
if (n || r || i) {
|
|
1761
1792
|
const f = {
|
|
1762
1793
|
limit: d,
|
|
1763
1794
|
cursor: l ?? null
|
|
1764
1795
|
};
|
|
1765
1796
|
n && (f.projectId = n === "inbox" ? b.inboxProjectId : n), r && (f.sectionId = r), i && (f.parentId = i);
|
|
1766
|
-
const { results: j, nextCursor:
|
|
1797
|
+
const { results: j, nextCursor: S } = await t.getTasks(f), x = j.map(O);
|
|
1767
1798
|
let E = o ? x.filter(
|
|
1768
1799
|
(M) => M.content.toLowerCase().includes(o.toLowerCase()) || M.description?.toLowerCase().includes(o.toLowerCase())
|
|
1769
1800
|
) : x;
|
|
1770
|
-
return E =
|
|
1801
|
+
return E = ce({
|
|
1771
1802
|
tasks: E,
|
|
1772
1803
|
resolvedAssigneeId: k,
|
|
1773
1804
|
currentUserId: b.id,
|
|
1774
1805
|
responsibleUserFiltering: a
|
|
1775
1806
|
}), u && u.length > 0 && (E = p === "and" ? E.filter(
|
|
1776
|
-
(M) => u.every((
|
|
1807
|
+
(M) => u.every((V) => M.labels.includes(V))
|
|
1777
1808
|
) : E.filter(
|
|
1778
|
-
(M) => u.some((
|
|
1809
|
+
(M) => u.some((V) => M.labels.includes(V))
|
|
1779
1810
|
)), {
|
|
1780
1811
|
textContent: J({
|
|
1781
1812
|
tasks: E,
|
|
1782
1813
|
args: e,
|
|
1783
|
-
nextCursor:
|
|
1814
|
+
nextCursor: S,
|
|
1784
1815
|
isContainerSearch: !0,
|
|
1785
1816
|
assigneeEmail: w
|
|
1786
1817
|
}),
|
|
1787
1818
|
structuredContent: {
|
|
1788
1819
|
tasks: E,
|
|
1789
|
-
nextCursor:
|
|
1820
|
+
nextCursor: S ?? void 0,
|
|
1790
1821
|
totalCount: E.length,
|
|
1791
|
-
hasMore:
|
|
1822
|
+
hasMore: !!S,
|
|
1792
1823
|
appliedFilters: e
|
|
1793
1824
|
}
|
|
1794
1825
|
};
|
|
@@ -1799,19 +1830,19 @@ const { FIND_COMPLETED_TASKS: ce, ADD_TASKS: de } = g, rs = {
|
|
|
1799
1830
|
lang: "en",
|
|
1800
1831
|
limit: d,
|
|
1801
1832
|
cursor: l ?? null
|
|
1802
|
-
}),
|
|
1833
|
+
}), S = f.map(O);
|
|
1803
1834
|
return {
|
|
1804
1835
|
textContent: J({
|
|
1805
|
-
tasks:
|
|
1836
|
+
tasks: S,
|
|
1806
1837
|
args: e,
|
|
1807
1838
|
nextCursor: j,
|
|
1808
1839
|
isContainerSearch: !1,
|
|
1809
1840
|
assigneeEmail: w
|
|
1810
1841
|
}),
|
|
1811
1842
|
structuredContent: {
|
|
1812
|
-
tasks:
|
|
1843
|
+
tasks: S,
|
|
1813
1844
|
nextCursor: j ?? void 0,
|
|
1814
|
-
totalCount:
|
|
1845
|
+
totalCount: S.length,
|
|
1815
1846
|
hasMore: !!j,
|
|
1816
1847
|
appliedFilters: e
|
|
1817
1848
|
}
|
|
@@ -1819,14 +1850,14 @@ const { FIND_COMPLETED_TASKS: ce, ADD_TASKS: de } = g, rs = {
|
|
|
1819
1850
|
}
|
|
1820
1851
|
let D = "";
|
|
1821
1852
|
o && (D = `search: ${o}`);
|
|
1822
|
-
const P =
|
|
1823
|
-
D =
|
|
1824
|
-
const { tasks: h, nextCursor: T } = await
|
|
1853
|
+
const P = ae(u, p);
|
|
1854
|
+
D = K(D, P);
|
|
1855
|
+
const { tasks: h, nextCursor: T } = await te({
|
|
1825
1856
|
client: t,
|
|
1826
1857
|
query: D,
|
|
1827
1858
|
cursor: e.cursor,
|
|
1828
1859
|
limit: e.limit
|
|
1829
|
-
}), C =
|
|
1860
|
+
}), C = ce({
|
|
1830
1861
|
tasks: h,
|
|
1831
1862
|
resolvedAssigneeId: k,
|
|
1832
1863
|
currentUserId: b.id,
|
|
@@ -1850,12 +1881,12 @@ const { FIND_COMPLETED_TASKS: ce, ADD_TASKS: de } = g, rs = {
|
|
|
1850
1881
|
};
|
|
1851
1882
|
}
|
|
1852
1883
|
};
|
|
1853
|
-
function
|
|
1884
|
+
function ds(e) {
|
|
1854
1885
|
if (e.projectId) {
|
|
1855
1886
|
const t = [
|
|
1856
1887
|
e.searchText ? "No tasks in project match search" : "Project has no tasks yet"
|
|
1857
1888
|
];
|
|
1858
|
-
return e.searchText || t.push(`Use ${
|
|
1889
|
+
return e.searchText || t.push(`Use ${le} to create tasks`), t;
|
|
1859
1890
|
}
|
|
1860
1891
|
if (e.sectionId) {
|
|
1861
1892
|
const t = [e.searchText ? "No tasks in section match search" : "Section is empty"];
|
|
@@ -1863,7 +1894,7 @@ function cs(e) {
|
|
|
1863
1894
|
}
|
|
1864
1895
|
if (e.parentId) {
|
|
1865
1896
|
const t = [e.searchText ? "No subtasks match search" : "No subtasks created yet"];
|
|
1866
|
-
return e.searchText || t.push(`Use ${
|
|
1897
|
+
return e.searchText || t.push(`Use ${le} with parentId to add subtasks`), t;
|
|
1867
1898
|
}
|
|
1868
1899
|
return [];
|
|
1869
1900
|
}
|
|
@@ -1885,7 +1916,7 @@ function J({
|
|
|
1885
1916
|
const d = t.labels.map((l) => `@${l}`).join(t.labelsOperator === "and" ? " & " : " | ");
|
|
1886
1917
|
c.push(`labels: ${d}`);
|
|
1887
1918
|
}
|
|
1888
|
-
e.length === 0 && a.push(...
|
|
1919
|
+
e.length === 0 && a.push(...ds(t));
|
|
1889
1920
|
} else {
|
|
1890
1921
|
const d = r || t.responsibleUser, l = [];
|
|
1891
1922
|
if (t.searchText && l.push(`"${t.searchText}"`), t.responsibleUser && l.push(`assigned to ${d}`), t.labels && t.labels.length > 0) {
|
|
@@ -1899,9 +1930,9 @@ function J({
|
|
|
1899
1930
|
if (e.length === 0) {
|
|
1900
1931
|
if (t.responsibleUser) {
|
|
1901
1932
|
const u = r || t.responsibleUser;
|
|
1902
|
-
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${
|
|
1933
|
+
a.push(`No tasks assigned to ${u}`), a.push("Check if the user name is correct"), a.push(`Check completed tasks with ${de}`);
|
|
1903
1934
|
}
|
|
1904
|
-
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${
|
|
1935
|
+
t.searchText && (a.push("Try broader search terms"), a.push("Verify spelling and try partial words"), t.responsibleUser || a.push(`Check completed tasks with ${de}`));
|
|
1905
1936
|
}
|
|
1906
1937
|
}
|
|
1907
1938
|
return N({
|
|
@@ -1910,11 +1941,11 @@ function J({
|
|
|
1910
1941
|
limit: t.limit,
|
|
1911
1942
|
nextCursor: o ?? void 0,
|
|
1912
1943
|
filterHints: c,
|
|
1913
|
-
previewLines:
|
|
1944
|
+
previewLines: H(e, Math.min(e.length, t.limit)),
|
|
1914
1945
|
zeroReasonHints: a
|
|
1915
1946
|
});
|
|
1916
1947
|
}
|
|
1917
|
-
const
|
|
1948
|
+
const ls = {
|
|
1918
1949
|
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'."),
|
|
1919
1950
|
overdueOption: s.enum(["overdue-only", "include-overdue", "exclude-overdue"]).optional().describe(
|
|
1920
1951
|
"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'."
|
|
@@ -1922,57 +1953,57 @@ const ds = {
|
|
|
1922
1953
|
daysCount: s.number().int().min(1).max(30).default(1).describe(
|
|
1923
1954
|
"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."
|
|
1924
1955
|
),
|
|
1925
|
-
limit: s.number().int().min(1).max(
|
|
1956
|
+
limit: s.number().int().min(1).max($.TASKS_MAX).default($.TASKS_DEFAULT).describe("The maximum number of tasks to return."),
|
|
1926
1957
|
cursor: s.string().optional().describe(
|
|
1927
1958
|
"The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."
|
|
1928
1959
|
),
|
|
1929
1960
|
responsibleUser: s.string().optional().describe("Find tasks assigned to this user. Can be a user ID, name, or email address."),
|
|
1930
|
-
responsibleUserFiltering: s.enum(
|
|
1961
|
+
responsibleUserFiltering: s.enum(ge).optional().describe(
|
|
1931
1962
|
'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".'
|
|
1932
1963
|
),
|
|
1933
|
-
...
|
|
1934
|
-
},
|
|
1964
|
+
...ie
|
|
1965
|
+
}, us = {
|
|
1935
1966
|
tasks: s.array(W).describe("The found tasks."),
|
|
1936
1967
|
nextCursor: s.string().optional().describe("Cursor for the next page of results."),
|
|
1937
1968
|
totalCount: s.number().describe("The total number of tasks in this page."),
|
|
1938
1969
|
hasMore: s.boolean().describe("Whether there are more results available."),
|
|
1939
1970
|
appliedFilters: s.record(s.unknown()).describe("The filters that were applied to the search.")
|
|
1940
|
-
},
|
|
1971
|
+
}, ps = {
|
|
1941
1972
|
name: g.FIND_TASKS_BY_DATE,
|
|
1942
1973
|
description: "Get tasks by date range. Use startDate 'today' to get today's tasks including overdue items, or provide a specific date/date range.",
|
|
1943
|
-
parameters:
|
|
1944
|
-
outputSchema:
|
|
1974
|
+
parameters: ls,
|
|
1975
|
+
outputSchema: us,
|
|
1945
1976
|
async execute(e, t) {
|
|
1946
1977
|
if (!e.startDate && e.overdueOption !== "overdue-only")
|
|
1947
1978
|
throw new Error(
|
|
1948
1979
|
"Either startDate must be provided or overdueOption must be set to overdue-only"
|
|
1949
1980
|
);
|
|
1950
|
-
const o = await
|
|
1981
|
+
const o = await Q(t, e.responsibleUser), n = o?.userId, r = o?.email;
|
|
1951
1982
|
let i = "";
|
|
1952
1983
|
if (e.overdueOption === "overdue-only")
|
|
1953
1984
|
i = "overdue";
|
|
1954
1985
|
else if (e.startDate === "today")
|
|
1955
1986
|
i = e.overdueOption === "exclude-overdue" ? "today" : "(today | overdue)";
|
|
1956
1987
|
else if (e.startDate) {
|
|
1957
|
-
const p = e.startDate, b =
|
|
1988
|
+
const p = e.startDate, b = fe(p, e.daysCount), m = Ae(b, { representation: "date" });
|
|
1958
1989
|
i = `(due after: ${p} | due: ${p}) & due before: ${m}`;
|
|
1959
1990
|
}
|
|
1960
|
-
const c =
|
|
1961
|
-
c.length > 0 && (i =
|
|
1962
|
-
const a =
|
|
1991
|
+
const c = ae(e.labels, e.labelsOperator);
|
|
1992
|
+
c.length > 0 && (i = K(i, `(${c})`));
|
|
1993
|
+
const a = Me({
|
|
1963
1994
|
resolvedAssigneeId: n,
|
|
1964
1995
|
assigneeEmail: r,
|
|
1965
1996
|
responsibleUserFiltering: e.responsibleUserFiltering
|
|
1966
1997
|
});
|
|
1967
|
-
i =
|
|
1968
|
-
const { tasks: d, nextCursor: l } = await
|
|
1998
|
+
i = K(i, a);
|
|
1999
|
+
const { tasks: d, nextCursor: l } = await te({
|
|
1969
2000
|
client: t,
|
|
1970
2001
|
query: i,
|
|
1971
2002
|
cursor: e.cursor,
|
|
1972
2003
|
limit: e.limit
|
|
1973
2004
|
});
|
|
1974
2005
|
return {
|
|
1975
|
-
textContent:
|
|
2006
|
+
textContent: hs({ tasks: d, args: e, nextCursor: l, assigneeEmail: r }),
|
|
1976
2007
|
structuredContent: {
|
|
1977
2008
|
tasks: d,
|
|
1978
2009
|
nextCursor: l ?? void 0,
|
|
@@ -1983,7 +2014,7 @@ const ds = {
|
|
|
1983
2014
|
};
|
|
1984
2015
|
}
|
|
1985
2016
|
};
|
|
1986
|
-
function
|
|
2017
|
+
function hs({
|
|
1987
2018
|
tasks: e,
|
|
1988
2019
|
args: t,
|
|
1989
2020
|
nextCursor: o,
|
|
@@ -1998,7 +2029,7 @@ function ps({
|
|
|
1998
2029
|
`today${a}${t.daysCount > 1 ? ` + ${t.daysCount - 1} more days` : ""}`
|
|
1999
2030
|
);
|
|
2000
2031
|
} else if (t.startDate) {
|
|
2001
|
-
const a = t.daysCount > 1 ? ` to ${
|
|
2032
|
+
const a = t.daysCount > 1 ? ` to ${dt(fe(t.startDate, t.daysCount))}` : "";
|
|
2002
2033
|
r.push(`${t.startDate}${a}`);
|
|
2003
2034
|
}
|
|
2004
2035
|
if (t.labels && t.labels.length > 0) {
|
|
@@ -2029,15 +2060,15 @@ function ps({
|
|
|
2029
2060
|
limit: t.limit,
|
|
2030
2061
|
nextCursor: o ?? void 0,
|
|
2031
2062
|
filterHints: r,
|
|
2032
|
-
previewLines:
|
|
2063
|
+
previewLines: H(e, Math.min(e.length, t.limit)),
|
|
2033
2064
|
zeroReasonHints: c
|
|
2034
2065
|
});
|
|
2035
2066
|
}
|
|
2036
|
-
const
|
|
2067
|
+
const ms = {
|
|
2037
2068
|
projectId: s.string().min(1).optional().describe(
|
|
2038
2069
|
"Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects."
|
|
2039
2070
|
)
|
|
2040
|
-
},
|
|
2071
|
+
}, fs = {
|
|
2041
2072
|
type: s.enum(["account_overview", "project_overview"]).describe("The type of overview returned."),
|
|
2042
2073
|
totalProjects: s.number().optional().describe("Total number of projects (account overview only)."),
|
|
2043
2074
|
totalTasks: s.number().optional().describe("Total number of tasks."),
|
|
@@ -2058,7 +2089,7 @@ const hs = {
|
|
|
2058
2089
|
tasks: s.array(s.any()).optional().describe("List of tasks (project overview only)."),
|
|
2059
2090
|
stats: s.any().optional().describe("Statistics object (project overview only).")
|
|
2060
2091
|
};
|
|
2061
|
-
function
|
|
2092
|
+
function bs(e) {
|
|
2062
2093
|
const t = {};
|
|
2063
2094
|
for (const r of e)
|
|
2064
2095
|
t[r.id] = {
|
|
@@ -2083,7 +2114,7 @@ function fs(e) {
|
|
|
2083
2114
|
}
|
|
2084
2115
|
return n(o), o;
|
|
2085
2116
|
}
|
|
2086
|
-
async function
|
|
2117
|
+
async function gs(e, t) {
|
|
2087
2118
|
const o = {};
|
|
2088
2119
|
return await Promise.all(
|
|
2089
2120
|
t.map(async (n) => {
|
|
@@ -2092,17 +2123,17 @@ async function bs(e, t) {
|
|
|
2092
2123
|
})
|
|
2093
2124
|
), o;
|
|
2094
2125
|
}
|
|
2095
|
-
function
|
|
2126
|
+
function Ce(e, t, o = "") {
|
|
2096
2127
|
const n = [];
|
|
2097
2128
|
n.push(`${o}- Project: ${e.name} (id=${e.id})`);
|
|
2098
2129
|
const r = t[e.id] || [];
|
|
2099
2130
|
for (const i of r)
|
|
2100
2131
|
n.push(`${o} - Section: ${i.name} (id=${i.id})`);
|
|
2101
2132
|
for (const i of e.children)
|
|
2102
|
-
n.push(...
|
|
2133
|
+
n.push(...Ce(i, t, `${o} `));
|
|
2103
2134
|
return n;
|
|
2104
2135
|
}
|
|
2105
|
-
function
|
|
2136
|
+
function ue(e) {
|
|
2106
2137
|
const t = {};
|
|
2107
2138
|
for (const n of e)
|
|
2108
2139
|
t[n.id] = { ...n, children: [] };
|
|
@@ -2127,33 +2158,33 @@ function Z(e, t = "") {
|
|
|
2127
2158
|
}
|
|
2128
2159
|
return o;
|
|
2129
2160
|
}
|
|
2130
|
-
function
|
|
2161
|
+
function Se(e, t) {
|
|
2131
2162
|
return {
|
|
2132
2163
|
id: e.id,
|
|
2133
2164
|
name: e.name,
|
|
2134
2165
|
parentId: B(e) ? e.parentId ?? null : null,
|
|
2135
2166
|
sections: t[e.id] || [],
|
|
2136
|
-
children: e.children.map((o) =>
|
|
2167
|
+
children: e.children.map((o) => Se(o, t))
|
|
2137
2168
|
};
|
|
2138
2169
|
}
|
|
2139
|
-
async function
|
|
2170
|
+
async function Ts(e, t) {
|
|
2140
2171
|
let o = [], n;
|
|
2141
2172
|
do {
|
|
2142
2173
|
const { results: r, nextCursor: i } = await e.getTasks({
|
|
2143
2174
|
projectId: t,
|
|
2144
|
-
limit:
|
|
2175
|
+
limit: $.TASKS_BATCH_SIZE,
|
|
2145
2176
|
cursor: n ?? void 0
|
|
2146
2177
|
});
|
|
2147
2178
|
o = o.concat(r.map(O)), n = i ?? void 0;
|
|
2148
2179
|
} while (n);
|
|
2149
2180
|
return o;
|
|
2150
2181
|
}
|
|
2151
|
-
async function
|
|
2182
|
+
async function ys(e, t) {
|
|
2152
2183
|
const { results: o } = await e.getSections({ projectId: t });
|
|
2153
2184
|
return o;
|
|
2154
2185
|
}
|
|
2155
|
-
async function
|
|
2156
|
-
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 =
|
|
2186
|
+
async function Is(e) {
|
|
2187
|
+
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", ""];
|
|
2157
2188
|
if (o) {
|
|
2158
2189
|
a.push(`- Inbox Project: ${o.name} (id=${o.id})`);
|
|
2159
2190
|
for (const p of c[o.id] || [])
|
|
@@ -2161,7 +2192,7 @@ async function ys(e) {
|
|
|
2161
2192
|
}
|
|
2162
2193
|
if (r.length)
|
|
2163
2194
|
for (const p of r)
|
|
2164
|
-
a.push(...
|
|
2195
|
+
a.push(...Ce(p, c));
|
|
2165
2196
|
else
|
|
2166
2197
|
a.push("_No projects found._");
|
|
2167
2198
|
a.push("");
|
|
@@ -2179,7 +2210,7 @@ async function ys(e) {
|
|
|
2179
2210
|
sections: c[o.id] || []
|
|
2180
2211
|
} : null,
|
|
2181
2212
|
projects: r.map(
|
|
2182
|
-
(p) =>
|
|
2213
|
+
(p) => Se(p, c)
|
|
2183
2214
|
),
|
|
2184
2215
|
totalProjects: t.length,
|
|
2185
2216
|
totalSections: i.reduce(
|
|
@@ -2190,8 +2221,8 @@ async function ys(e) {
|
|
|
2190
2221
|
};
|
|
2191
2222
|
return { textContent: l, structuredContent: u };
|
|
2192
2223
|
}
|
|
2193
|
-
async function
|
|
2194
|
-
const o = await e.getProject(t), n = await
|
|
2224
|
+
async function ks(e, t) {
|
|
2225
|
+
const o = await e.getProject(t), n = await ys(e, t), r = await Ts(e, t), i = {};
|
|
2195
2226
|
for (const u of n)
|
|
2196
2227
|
i[u.id] = [];
|
|
2197
2228
|
const c = [];
|
|
@@ -2200,7 +2231,7 @@ async function Is(e, t) {
|
|
|
2200
2231
|
const a = [`# ${o.name}`];
|
|
2201
2232
|
if (c.length > 0) {
|
|
2202
2233
|
a.push("");
|
|
2203
|
-
const u =
|
|
2234
|
+
const u = ue(c);
|
|
2204
2235
|
a.push(...Z(u));
|
|
2205
2236
|
}
|
|
2206
2237
|
for (const u of n) {
|
|
@@ -2208,7 +2239,7 @@ async function Is(e, t) {
|
|
|
2208
2239
|
const p = i[u.id];
|
|
2209
2240
|
if (!p?.length)
|
|
2210
2241
|
continue;
|
|
2211
|
-
const b =
|
|
2242
|
+
const b = ue(p);
|
|
2212
2243
|
a.push(...Z(b));
|
|
2213
2244
|
}
|
|
2214
2245
|
const d = a.join(`
|
|
@@ -2232,21 +2263,21 @@ async function Is(e, t) {
|
|
|
2232
2263
|
};
|
|
2233
2264
|
return { textContent: d, structuredContent: l };
|
|
2234
2265
|
}
|
|
2235
|
-
const
|
|
2266
|
+
const ws = {
|
|
2236
2267
|
name: g.GET_OVERVIEW,
|
|
2237
2268
|
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.",
|
|
2238
|
-
parameters:
|
|
2239
|
-
outputSchema:
|
|
2269
|
+
parameters: ms,
|
|
2270
|
+
outputSchema: fs,
|
|
2240
2271
|
async execute(e, t) {
|
|
2241
|
-
const o = e.projectId ? await
|
|
2272
|
+
const o = e.projectId ? await ks(t, e.projectId) : await Is(t);
|
|
2242
2273
|
return {
|
|
2243
2274
|
textContent: o.textContent,
|
|
2244
2275
|
structuredContent: o.structuredContent
|
|
2245
2276
|
};
|
|
2246
2277
|
}
|
|
2247
|
-
}, { FIND_TASKS:
|
|
2278
|
+
}, { FIND_TASKS: js, FIND_PROJECT_COLLABORATORS: pe, UPDATE_TASKS: vs } = g, Cs = 50, Ss = {
|
|
2248
2279
|
operation: s.enum(["assign", "unassign", "reassign"]).describe("The assignment operation to perform."),
|
|
2249
|
-
taskIds: s.array(s.string()).min(1).max(
|
|
2280
|
+
taskIds: s.array(s.string()).min(1).max(Cs).describe("The IDs of the tasks to operate on (max 50)."),
|
|
2250
2281
|
responsibleUser: s.string().optional().describe(
|
|
2251
2282
|
"The user to assign tasks to. Can be user ID, name, or email. Required for assign and reassign operations."
|
|
2252
2283
|
),
|
|
@@ -2270,10 +2301,10 @@ const ks = {
|
|
|
2270
2301
|
failed: s.number().describe("Number of failed operations."),
|
|
2271
2302
|
dryRun: s.boolean().describe("Whether this was a dry run.")
|
|
2272
2303
|
}).optional().describe("Summary of the operation.")
|
|
2273
|
-
},
|
|
2304
|
+
}, Ds = {
|
|
2274
2305
|
name: g.MANAGE_ASSIGNMENTS,
|
|
2275
2306
|
description: "Bulk assignment operations for multiple tasks. Supports assign, unassign, and reassign operations with atomic rollback on failures.",
|
|
2276
|
-
parameters:
|
|
2307
|
+
parameters: Ss,
|
|
2277
2308
|
outputSchema: $s,
|
|
2278
2309
|
async execute(e, t) {
|
|
2279
2310
|
const { operation: o, taskIds: n, responsibleUser: r, fromAssigneeUser: i, dryRun: c } = e;
|
|
@@ -2328,10 +2359,10 @@ const ks = {
|
|
|
2328
2359
|
});
|
|
2329
2360
|
if (o === "unassign") {
|
|
2330
2361
|
if (c) {
|
|
2331
|
-
const f = d.map((
|
|
2332
|
-
taskId:
|
|
2362
|
+
const f = d.map((S) => ({
|
|
2363
|
+
taskId: S.id,
|
|
2333
2364
|
success: !0,
|
|
2334
|
-
originalAssigneeId:
|
|
2365
|
+
originalAssigneeId: S.responsibleUid ?? void 0,
|
|
2335
2366
|
newAssigneeId: void 0
|
|
2336
2367
|
}));
|
|
2337
2368
|
return {
|
|
@@ -2383,7 +2414,7 @@ const ks = {
|
|
|
2383
2414
|
}
|
|
2384
2415
|
};
|
|
2385
2416
|
}
|
|
2386
|
-
const b = await
|
|
2417
|
+
const b = await re.validateBulkAssignment(
|
|
2387
2418
|
t,
|
|
2388
2419
|
p
|
|
2389
2420
|
), m = [], y = [];
|
|
@@ -2401,7 +2432,7 @@ const ks = {
|
|
|
2401
2432
|
);
|
|
2402
2433
|
if (!T)
|
|
2403
2434
|
return C.map(({ assignment: f, validation: j }) => {
|
|
2404
|
-
const
|
|
2435
|
+
const S = d.find((x) => x.id === f.taskId);
|
|
2405
2436
|
if (!f.taskId || !j.resolvedUser?.userId)
|
|
2406
2437
|
throw new Error(
|
|
2407
2438
|
"Invalid assignment or validation data - this should not happen"
|
|
@@ -2409,19 +2440,19 @@ const ks = {
|
|
|
2409
2440
|
return {
|
|
2410
2441
|
taskId: f.taskId,
|
|
2411
2442
|
success: !0,
|
|
2412
|
-
originalAssigneeId:
|
|
2443
|
+
originalAssigneeId: S?.responsibleUid ?? void 0,
|
|
2413
2444
|
newAssigneeId: j.resolvedUser.userId
|
|
2414
2445
|
};
|
|
2415
2446
|
});
|
|
2416
2447
|
const v = C.map(
|
|
2417
2448
|
async ({ assignment: f, validation: j }) => {
|
|
2418
|
-
const
|
|
2449
|
+
const S = d.find((x) => x.id === f.taskId);
|
|
2419
2450
|
if (!f.taskId || !j.resolvedUser?.userId)
|
|
2420
2451
|
return {
|
|
2421
2452
|
taskId: f.taskId || "unknown-task",
|
|
2422
2453
|
success: !1,
|
|
2423
2454
|
error: "Invalid assignment data - missing task ID or resolved user",
|
|
2424
|
-
originalAssigneeId:
|
|
2455
|
+
originalAssigneeId: S?.responsibleUid ?? void 0
|
|
2425
2456
|
};
|
|
2426
2457
|
try {
|
|
2427
2458
|
return await t.updateTask(f.taskId, {
|
|
@@ -2429,7 +2460,7 @@ const ks = {
|
|
|
2429
2460
|
}), {
|
|
2430
2461
|
taskId: f.taskId,
|
|
2431
2462
|
success: !0,
|
|
2432
|
-
originalAssigneeId:
|
|
2463
|
+
originalAssigneeId: S?.responsibleUid ?? void 0,
|
|
2433
2464
|
newAssigneeId: j.resolvedUser.userId
|
|
2434
2465
|
};
|
|
2435
2466
|
} catch (x) {
|
|
@@ -2437,7 +2468,7 @@ const ks = {
|
|
|
2437
2468
|
taskId: f.taskId,
|
|
2438
2469
|
success: !1,
|
|
2439
2470
|
error: x instanceof Error ? x.message : "Update failed",
|
|
2440
|
-
originalAssigneeId:
|
|
2471
|
+
originalAssigneeId: S?.responsibleUid ?? void 0
|
|
2441
2472
|
};
|
|
2442
2473
|
}
|
|
2443
2474
|
}
|
|
@@ -2500,22 +2531,22 @@ function Y({
|
|
|
2500
2531
|
`;
|
|
2501
2532
|
}
|
|
2502
2533
|
return !o && n.length > 0 ? (a += `**Next steps:**
|
|
2503
|
-
`, a += `• Use ${
|
|
2504
|
-
`, a += `• Use ${
|
|
2505
|
-
`, r.length > 0 && (a += `• Check failed tasks and use ${
|
|
2534
|
+
`, a += `• Use ${js} with responsibleUser to see ${e === "unassign" ? "unassigned" : "newly assigned"} tasks
|
|
2535
|
+
`, a += `• Use ${vs} for individual assignment changes
|
|
2536
|
+
`, r.length > 0 && (a += `• Check failed tasks and use ${pe} to verify collaborator access
|
|
2506
2537
|
`)) : o ? (a += `**To execute:**
|
|
2507
2538
|
`, a += `• Remove dryRun parameter and run again to execute changes
|
|
2508
2539
|
`, n.length > 0 && (a += `• ${n.length} task${n.length === 1 ? "" : "s"} ready for ${e} operation
|
|
2509
2540
|
`), r.length > 0 && (a += `• Fix ${r.length} validation error${r.length === 1 ? "" : "s"} before executing
|
|
2510
2541
|
`)) : n.length === 0 && (a += `**Suggestions:**
|
|
2511
|
-
`, a += `• Use ${
|
|
2542
|
+
`, a += `• Use ${pe} to find valid assignees
|
|
2512
2543
|
`, a += `• Check task IDs and assignee permissions
|
|
2513
2544
|
`, a += `• Use dryRun=true to validate before executing
|
|
2514
2545
|
`), a;
|
|
2515
2546
|
}
|
|
2516
|
-
const
|
|
2547
|
+
const xs = {
|
|
2517
2548
|
query: s.string().min(1).describe("The search query string to find tasks and projects.")
|
|
2518
|
-
},
|
|
2549
|
+
}, As = {
|
|
2519
2550
|
results: s.array(
|
|
2520
2551
|
s.object({
|
|
2521
2552
|
id: s.string().describe("The ID of the result."),
|
|
@@ -2524,20 +2555,20 @@ const Ds = {
|
|
|
2524
2555
|
})
|
|
2525
2556
|
).describe("The search results."),
|
|
2526
2557
|
totalCount: s.number().describe("Total number of results found.")
|
|
2527
|
-
},
|
|
2558
|
+
}, Us = {
|
|
2528
2559
|
name: g.SEARCH,
|
|
2529
2560
|
description: "Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.",
|
|
2530
|
-
parameters:
|
|
2531
|
-
outputSchema:
|
|
2561
|
+
parameters: xs,
|
|
2562
|
+
outputSchema: As,
|
|
2532
2563
|
async execute(e, t) {
|
|
2533
2564
|
const { query: o } = e, [n, r] = await Promise.all([
|
|
2534
|
-
|
|
2565
|
+
te({
|
|
2535
2566
|
client: t,
|
|
2536
2567
|
query: `search: ${o}`,
|
|
2537
|
-
limit:
|
|
2568
|
+
limit: $.TASKS_MAX,
|
|
2538
2569
|
cursor: void 0
|
|
2539
2570
|
}),
|
|
2540
|
-
t.getProjects({ limit:
|
|
2571
|
+
t.getProjects({ limit: $.PROJECTS_MAX })
|
|
2541
2572
|
]), i = o.toLowerCase(), c = r.results.filter(
|
|
2542
2573
|
(d) => d.name.toLowerCase().includes(i)
|
|
2543
2574
|
), a = [];
|
|
@@ -2545,54 +2576,54 @@ const Ds = {
|
|
|
2545
2576
|
a.push({
|
|
2546
2577
|
id: `task:${d.id}`,
|
|
2547
2578
|
title: d.content,
|
|
2548
|
-
url:
|
|
2579
|
+
url: he(d.id)
|
|
2549
2580
|
});
|
|
2550
2581
|
for (const d of c)
|
|
2551
2582
|
a.push({
|
|
2552
2583
|
id: `project:${d.id}`,
|
|
2553
2584
|
title: d.name,
|
|
2554
|
-
url:
|
|
2585
|
+
url: me(d.id)
|
|
2555
2586
|
});
|
|
2556
2587
|
return {
|
|
2557
2588
|
textContent: JSON.stringify({ results: a }),
|
|
2558
2589
|
structuredContent: { results: a, totalCount: a.length }
|
|
2559
2590
|
};
|
|
2560
2591
|
}
|
|
2561
|
-
},
|
|
2592
|
+
}, Ps = s.object({
|
|
2562
2593
|
id: s.string().min(1).describe("The ID of the comment to update."),
|
|
2563
2594
|
content: s.string().min(1).describe("The new content for the comment.")
|
|
2564
|
-
}),
|
|
2565
|
-
comments: s.array(
|
|
2566
|
-
},
|
|
2567
|
-
comments: s.array(
|
|
2595
|
+
}), Es = {
|
|
2596
|
+
comments: s.array(Ps).min(1).describe("The comments to update.")
|
|
2597
|
+
}, Os = {
|
|
2598
|
+
comments: s.array(ne).describe("The updated comments."),
|
|
2568
2599
|
totalCount: s.number().describe("The total number of comments updated."),
|
|
2569
2600
|
updatedCommentIds: s.array(s.string()).describe("The IDs of the updated comments."),
|
|
2570
2601
|
appliedOperations: s.object({
|
|
2571
2602
|
updateCount: s.number().describe("The number of comments updated.")
|
|
2572
2603
|
}).describe("Summary of operations performed.")
|
|
2573
|
-
},
|
|
2604
|
+
}, _s = {
|
|
2574
2605
|
name: g.UPDATE_COMMENTS,
|
|
2575
2606
|
description: "Update multiple existing comments with new content.",
|
|
2576
|
-
parameters:
|
|
2577
|
-
outputSchema:
|
|
2607
|
+
parameters: Es,
|
|
2608
|
+
outputSchema: Os,
|
|
2578
2609
|
async execute(e, t) {
|
|
2579
|
-
const { comments: o } = e, n = o.map(async (
|
|
2610
|
+
const { comments: o } = e, n = o.map(async (a) => await t.updateComment(a.id, { content: a.content })), i = (await Promise.all(n)).map(ee);
|
|
2580
2611
|
return {
|
|
2581
|
-
textContent:
|
|
2582
|
-
comments:
|
|
2612
|
+
textContent: Ns({
|
|
2613
|
+
comments: i
|
|
2583
2614
|
}),
|
|
2584
2615
|
structuredContent: {
|
|
2585
|
-
comments:
|
|
2586
|
-
totalCount:
|
|
2587
|
-
updatedCommentIds:
|
|
2616
|
+
comments: i,
|
|
2617
|
+
totalCount: i.length,
|
|
2618
|
+
updatedCommentIds: i.map((a) => a.id),
|
|
2588
2619
|
appliedOperations: {
|
|
2589
|
-
updateCount:
|
|
2620
|
+
updateCount: i.length
|
|
2590
2621
|
}
|
|
2591
2622
|
}
|
|
2592
2623
|
};
|
|
2593
2624
|
}
|
|
2594
2625
|
};
|
|
2595
|
-
function
|
|
2626
|
+
function Ns({ comments: e }) {
|
|
2596
2627
|
const t = e.filter((i) => i.taskId).length, o = e.filter((i) => i.projectId).length, n = [];
|
|
2597
2628
|
if (t > 0) {
|
|
2598
2629
|
const i = t > 1 ? "comments" : "comment";
|
|
@@ -2604,29 +2635,29 @@ function _s({ comments: e }) {
|
|
|
2604
2635
|
}
|
|
2605
2636
|
return n.length > 0 ? `Updated ${n.join(" and ")}` : "No comments updated";
|
|
2606
2637
|
}
|
|
2607
|
-
const
|
|
2638
|
+
const Ms = s.object({
|
|
2608
2639
|
id: s.string().min(1).describe("The ID of the project to update."),
|
|
2609
2640
|
name: s.string().min(1).optional().describe("The new name of the project."),
|
|
2610
2641
|
isFavorite: s.boolean().optional().describe("Whether the project is a favorite."),
|
|
2611
2642
|
viewStyle: s.enum(["list", "board", "calendar"]).optional().describe("The project view style.")
|
|
2612
|
-
}),
|
|
2613
|
-
projects: s.array(
|
|
2614
|
-
},
|
|
2615
|
-
projects: s.array(
|
|
2643
|
+
}), Fs = {
|
|
2644
|
+
projects: s.array(Ms).min(1).describe("The projects to update.")
|
|
2645
|
+
}, Rs = {
|
|
2646
|
+
projects: s.array(se).describe("The updated projects."),
|
|
2616
2647
|
totalCount: s.number().describe("The total number of projects updated."),
|
|
2617
2648
|
updatedProjectIds: s.array(s.string()).describe("The IDs of the updated projects."),
|
|
2618
2649
|
appliedOperations: s.object({
|
|
2619
2650
|
updateCount: s.number().describe("The number of projects actually updated."),
|
|
2620
2651
|
skippedCount: s.number().describe("The number of projects skipped (no changes).")
|
|
2621
2652
|
}).describe("Summary of operations performed.")
|
|
2622
|
-
},
|
|
2653
|
+
}, Ls = {
|
|
2623
2654
|
name: g.UPDATE_PROJECTS,
|
|
2624
2655
|
description: "Update multiple existing projects with new values.",
|
|
2625
|
-
parameters:
|
|
2626
|
-
outputSchema:
|
|
2656
|
+
parameters: Fs,
|
|
2657
|
+
outputSchema: Rs,
|
|
2627
2658
|
async execute(e, t) {
|
|
2628
2659
|
const { projects: o } = e, n = o.map(async (c) => {
|
|
2629
|
-
if (!
|
|
2660
|
+
if (!Ws(c))
|
|
2630
2661
|
return;
|
|
2631
2662
|
const { id: a, ...d } = c;
|
|
2632
2663
|
return await t.updateProject(a, d);
|
|
@@ -2638,7 +2669,7 @@ const Ns = s.object({
|
|
|
2638
2669
|
inboxProject: "inboxProject" in c ? c.inboxProject : !1
|
|
2639
2670
|
}));
|
|
2640
2671
|
return {
|
|
2641
|
-
textContent:
|
|
2672
|
+
textContent: Bs({
|
|
2642
2673
|
projects: r,
|
|
2643
2674
|
args: e
|
|
2644
2675
|
}),
|
|
@@ -2654,7 +2685,7 @@ const Ns = s.object({
|
|
|
2654
2685
|
};
|
|
2655
2686
|
}
|
|
2656
2687
|
};
|
|
2657
|
-
function
|
|
2688
|
+
function Bs({
|
|
2658
2689
|
projects: e,
|
|
2659
2690
|
args: t
|
|
2660
2691
|
}) {
|
|
@@ -2664,22 +2695,22 @@ function Ls({
|
|
|
2664
2695
|
return r > 0 && (a += ` (${r} skipped - no changes)`), i > 0 && (a += `:
|
|
2665
2696
|
${c}`), a;
|
|
2666
2697
|
}
|
|
2667
|
-
function
|
|
2698
|
+
function Ws({ id: e, ...t }) {
|
|
2668
2699
|
return Object.keys(t).length > 0;
|
|
2669
2700
|
}
|
|
2670
|
-
const
|
|
2701
|
+
const Ys = s.object({
|
|
2671
2702
|
id: s.string().min(1).describe("The ID of the section to update."),
|
|
2672
2703
|
name: s.string().min(1).describe("The new name of the section.")
|
|
2673
|
-
}),
|
|
2674
|
-
sections: s.array(
|
|
2704
|
+
}), zs = {
|
|
2705
|
+
sections: s.array(Ys).min(1).describe("The sections to update.")
|
|
2675
2706
|
}, Ks = {
|
|
2676
|
-
sections: s.array(
|
|
2707
|
+
sections: s.array(oe).describe("The updated sections."),
|
|
2677
2708
|
totalCount: s.number().describe("The total number of sections updated."),
|
|
2678
2709
|
updatedSectionIds: s.array(s.string()).describe("The IDs of the updated sections.")
|
|
2679
|
-
},
|
|
2710
|
+
}, Hs = {
|
|
2680
2711
|
name: g.UPDATE_SECTIONS,
|
|
2681
2712
|
description: "Update multiple existing sections with new values.",
|
|
2682
|
-
parameters:
|
|
2713
|
+
parameters: zs,
|
|
2683
2714
|
outputSchema: Ks,
|
|
2684
2715
|
async execute({ sections: e }, t) {
|
|
2685
2716
|
const o = await Promise.all(
|
|
@@ -2703,7 +2734,7 @@ function Vs({ sections: e }) {
|
|
|
2703
2734
|
return `Updated ${t} section${t === 1 ? "" : "s"}:
|
|
2704
2735
|
${o}`;
|
|
2705
2736
|
}
|
|
2706
|
-
const
|
|
2737
|
+
const Gs = s.object({
|
|
2707
2738
|
id: s.string().min(1).describe("The ID of the task to update."),
|
|
2708
2739
|
content: s.string().optional().describe(
|
|
2709
2740
|
'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.'
|
|
@@ -2717,7 +2748,7 @@ const Hs = s.object({
|
|
|
2717
2748
|
sectionId: s.string().optional().describe("The new section ID for the task."),
|
|
2718
2749
|
parentId: s.string().optional().describe("The new parent task ID (for subtasks)."),
|
|
2719
2750
|
order: s.number().optional().describe("The new order of the task within its parent/section."),
|
|
2720
|
-
priority:
|
|
2751
|
+
priority: ye.optional().describe(
|
|
2721
2752
|
"The new priority of the task: p1 (highest), p2 (high), p3 (medium), p4 (lowest/default)."
|
|
2722
2753
|
),
|
|
2723
2754
|
dueString: s.string().optional().describe("The new due date for the task, in natural language (e.g., 'tomorrow at 5pm')."),
|
|
@@ -2731,9 +2762,9 @@ const Hs = s.object({
|
|
|
2731
2762
|
'Change task assignment. Use "unassign" to remove assignment. Can be user ID, name, or email. User must be a project collaborator.'
|
|
2732
2763
|
),
|
|
2733
2764
|
labels: s.array(s.string()).optional().describe("The new labels for the task. Replaces all existing labels.")
|
|
2734
|
-
}),
|
|
2735
|
-
tasks: s.array(
|
|
2736
|
-
},
|
|
2765
|
+
}), qs = {
|
|
2766
|
+
tasks: s.array(Gs).min(1).describe("The tasks to update.")
|
|
2767
|
+
}, Js = {
|
|
2737
2768
|
tasks: s.array(W).describe("The updated tasks."),
|
|
2738
2769
|
totalCount: s.number().describe("The total number of tasks updated."),
|
|
2739
2770
|
updatedTaskIds: s.array(s.string()).describe("The IDs of the updated tasks."),
|
|
@@ -2741,14 +2772,14 @@ const Hs = s.object({
|
|
|
2741
2772
|
updateCount: s.number().describe("The number of tasks actually updated."),
|
|
2742
2773
|
skippedCount: s.number().describe("The number of tasks skipped (no changes).")
|
|
2743
2774
|
}).describe("Summary of operations performed.")
|
|
2744
|
-
},
|
|
2775
|
+
}, Xs = {
|
|
2745
2776
|
name: g.UPDATE_TASKS,
|
|
2746
2777
|
description: "Update existing tasks including content, dates, priorities, and assignments.",
|
|
2747
|
-
parameters:
|
|
2748
|
-
outputSchema:
|
|
2778
|
+
parameters: qs,
|
|
2779
|
+
outputSchema: Js,
|
|
2749
2780
|
async execute(e, t) {
|
|
2750
2781
|
const { tasks: o } = e, n = o.map(async (a) => {
|
|
2751
|
-
if (!
|
|
2782
|
+
if (!Qs(a))
|
|
2752
2783
|
return;
|
|
2753
2784
|
const {
|
|
2754
2785
|
id: d,
|
|
@@ -2768,9 +2799,9 @@ const Hs = s.object({
|
|
|
2768
2799
|
...D,
|
|
2769
2800
|
...k !== void 0 && { labels: k }
|
|
2770
2801
|
};
|
|
2771
|
-
if (y && (h.priority =
|
|
2802
|
+
if (y && (h.priority = Ie(y)), w !== void 0 && (w === null || w === "remove" ? h = { ...h, deadlineDate: null } : h = { ...h, deadlineDate: w }), b)
|
|
2772
2803
|
try {
|
|
2773
|
-
const { minutes: v } =
|
|
2804
|
+
const { minutes: v } = be(b);
|
|
2774
2805
|
h = {
|
|
2775
2806
|
...h,
|
|
2776
2807
|
duration: v,
|
|
@@ -2783,7 +2814,7 @@ const Hs = s.object({
|
|
|
2783
2814
|
if (m === null || m === "unassign")
|
|
2784
2815
|
h = { ...h, assigneeId: null };
|
|
2785
2816
|
else {
|
|
2786
|
-
const v = await
|
|
2817
|
+
const v = await re.validateTaskUpdateAssignment(
|
|
2787
2818
|
t,
|
|
2788
2819
|
d,
|
|
2789
2820
|
m
|
|
@@ -2798,13 +2829,13 @@ const Hs = s.object({
|
|
|
2798
2829
|
}
|
|
2799
2830
|
if (!P && !u && !p)
|
|
2800
2831
|
return await t.updateTask(d, h);
|
|
2801
|
-
const T =
|
|
2832
|
+
const T = Fe(d, P, u, p), C = await t.moveTask(d, T);
|
|
2802
2833
|
return Object.keys(h).length > 0 ? await t.updateTask(d, h) : C;
|
|
2803
2834
|
}), r = (await Promise.all(n)).filter(
|
|
2804
2835
|
(a) => a !== void 0
|
|
2805
2836
|
), i = r.map(O);
|
|
2806
2837
|
return {
|
|
2807
|
-
textContent:
|
|
2838
|
+
textContent: Zs({
|
|
2808
2839
|
tasks: i,
|
|
2809
2840
|
args: e
|
|
2810
2841
|
}),
|
|
@@ -2820,21 +2851,21 @@ const Hs = s.object({
|
|
|
2820
2851
|
};
|
|
2821
2852
|
}
|
|
2822
2853
|
};
|
|
2823
|
-
function
|
|
2854
|
+
function Zs({
|
|
2824
2855
|
tasks: e,
|
|
2825
2856
|
args: t
|
|
2826
2857
|
}) {
|
|
2827
2858
|
const o = t.tasks.length, n = e.length, r = o - n;
|
|
2828
2859
|
let i = "";
|
|
2829
|
-
return r > 0 && (i = ` (${r} skipped - no changes)`),
|
|
2860
|
+
return r > 0 && (i = ` (${r} skipped - no changes)`), ke("Updated", e, {
|
|
2830
2861
|
context: i,
|
|
2831
2862
|
showDetails: e.length <= 5
|
|
2832
2863
|
});
|
|
2833
2864
|
}
|
|
2834
|
-
function
|
|
2865
|
+
function Qs({ id: e, ...t }) {
|
|
2835
2866
|
return Object.keys(t).length > 0;
|
|
2836
2867
|
}
|
|
2837
|
-
const
|
|
2868
|
+
const eo = {}, to = {
|
|
2838
2869
|
type: s.literal("user_info").describe("The type of the response."),
|
|
2839
2870
|
userId: s.string().describe("The user ID."),
|
|
2840
2871
|
fullName: s.string().describe("The full name of the user."),
|
|
@@ -2851,28 +2882,28 @@ const Qs = {}, eo = {
|
|
|
2851
2882
|
email: s.string().describe("The email address of the user."),
|
|
2852
2883
|
plan: s.enum(["Todoist Free", "Todoist Pro", "Todoist Business"]).describe("The user plan.")
|
|
2853
2884
|
};
|
|
2854
|
-
function
|
|
2885
|
+
function so(e) {
|
|
2855
2886
|
return e.businessAccountId ? "Todoist Business" : e.isPremium ? "Todoist Pro" : "Todoist Free";
|
|
2856
2887
|
}
|
|
2857
|
-
function
|
|
2888
|
+
function oo(e, t) {
|
|
2858
2889
|
const n = ((e.getDay() || 7) - t + 7) % 7, r = new Date(e);
|
|
2859
2890
|
return r.setDate(e.getDate() - n), r;
|
|
2860
2891
|
}
|
|
2861
|
-
function
|
|
2892
|
+
function no(e) {
|
|
2862
2893
|
const t = new Date(e);
|
|
2863
2894
|
return t.setDate(e.getDate() + 6), t;
|
|
2864
2895
|
}
|
|
2865
|
-
function
|
|
2896
|
+
function ro(e) {
|
|
2866
2897
|
const t = new Date(e.getFullYear(), 0, 1), o = (e.getTime() - t.getTime()) / 864e5;
|
|
2867
2898
|
return Math.ceil((o + t.getDay() + 1) / 7);
|
|
2868
2899
|
}
|
|
2869
|
-
function
|
|
2900
|
+
function io(e) {
|
|
2870
2901
|
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][e === 7 ? 0 : e] ?? "Unknown";
|
|
2871
2902
|
}
|
|
2872
|
-
function
|
|
2903
|
+
function z(e) {
|
|
2873
2904
|
return e.toISOString().split("T")[0] ?? "";
|
|
2874
2905
|
}
|
|
2875
|
-
function
|
|
2906
|
+
function ao(e) {
|
|
2876
2907
|
try {
|
|
2877
2908
|
return new Intl.DateTimeFormat("en-US", { timeZone: e }), !0;
|
|
2878
2909
|
} catch {
|
|
@@ -2880,9 +2911,9 @@ function io(e) {
|
|
|
2880
2911
|
}
|
|
2881
2912
|
}
|
|
2882
2913
|
function $e(e) {
|
|
2883
|
-
return
|
|
2914
|
+
return ao(e) ? e : "UTC";
|
|
2884
2915
|
}
|
|
2885
|
-
function
|
|
2916
|
+
function co(e, t) {
|
|
2886
2917
|
const o = $e(t);
|
|
2887
2918
|
return e.toLocaleString("en-US", {
|
|
2888
2919
|
timeZone: o,
|
|
@@ -2895,8 +2926,8 @@ function ao(e, t) {
|
|
|
2895
2926
|
hour12: !1
|
|
2896
2927
|
});
|
|
2897
2928
|
}
|
|
2898
|
-
async function
|
|
2899
|
-
const t = await e.getUser(), o = t.tzInfo?.timezone ?? "UTC", n = $e(o), r = /* @__PURE__ */ new Date(), i =
|
|
2929
|
+
async function lo(e) {
|
|
2930
|
+
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 = [
|
|
2900
2931
|
"# User Information",
|
|
2901
2932
|
"",
|
|
2902
2933
|
`**User ID:** ${t.id}`,
|
|
@@ -2908,8 +2939,8 @@ async function co(e) {
|
|
|
2908
2939
|
"## Week Settings",
|
|
2909
2940
|
`**Week Start Day:** ${a} (${c})`,
|
|
2910
2941
|
`**Current Week:** Week ${b}`,
|
|
2911
|
-
`**Week Start Date:** ${
|
|
2912
|
-
`**Week End Date:** ${
|
|
2942
|
+
`**Week Start Date:** ${z(u)}`,
|
|
2943
|
+
`**Week End Date:** ${z(p)}`,
|
|
2913
2944
|
"",
|
|
2914
2945
|
"## Daily Progress",
|
|
2915
2946
|
`**Completed Today:** ${t.completedToday}`,
|
|
@@ -2927,8 +2958,8 @@ async function co(e) {
|
|
|
2927
2958
|
currentLocalTime: i,
|
|
2928
2959
|
startDay: c,
|
|
2929
2960
|
startDayName: a,
|
|
2930
|
-
weekStartDate:
|
|
2931
|
-
weekEndDate:
|
|
2961
|
+
weekStartDate: z(u),
|
|
2962
|
+
weekEndDate: z(p),
|
|
2932
2963
|
currentWeekNumber: b,
|
|
2933
2964
|
completedToday: t.completedToday,
|
|
2934
2965
|
dailyGoal: t.dailyGoal,
|
|
@@ -2938,19 +2969,19 @@ async function co(e) {
|
|
|
2938
2969
|
};
|
|
2939
2970
|
return { textContent: y, structuredContent: k };
|
|
2940
2971
|
}
|
|
2941
|
-
const
|
|
2972
|
+
const uo = {
|
|
2942
2973
|
name: g.USER_INFO,
|
|
2943
2974
|
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).",
|
|
2944
|
-
parameters:
|
|
2945
|
-
outputSchema:
|
|
2975
|
+
parameters: eo,
|
|
2976
|
+
outputSchema: to,
|
|
2946
2977
|
async execute(e, t) {
|
|
2947
|
-
const o = await
|
|
2978
|
+
const o = await lo(t);
|
|
2948
2979
|
return {
|
|
2949
2980
|
textContent: o.textContent,
|
|
2950
2981
|
structuredContent: o.structuredContent
|
|
2951
2982
|
};
|
|
2952
2983
|
}
|
|
2953
|
-
},
|
|
2984
|
+
}, po = `
|
|
2954
2985
|
## Todoist Task and Project Management Tools
|
|
2955
2986
|
|
|
2956
2987
|
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.
|
|
@@ -3018,41 +3049,41 @@ You have access to comprehensive Todoist management tools for personal productiv
|
|
|
3018
3049
|
|
|
3019
3050
|
Always provide clear, actionable task titles and descriptions. Use the overview tools to give users context about their workload and project status.
|
|
3020
3051
|
`;
|
|
3021
|
-
function
|
|
3022
|
-
const o = new
|
|
3052
|
+
function To({ todoistApiKey: e, baseUrl: t }) {
|
|
3053
|
+
const o = new xe(
|
|
3023
3054
|
{ name: "todoist-mcp-server", version: "0.1.0" },
|
|
3024
3055
|
{
|
|
3025
3056
|
capabilities: {
|
|
3026
3057
|
tools: { listChanged: !0 }
|
|
3027
3058
|
},
|
|
3028
|
-
instructions:
|
|
3059
|
+
instructions: po
|
|
3029
3060
|
}
|
|
3030
|
-
), n = new
|
|
3031
|
-
return I(
|
|
3061
|
+
), n = new De(e, t);
|
|
3062
|
+
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(Qe, o, n), I(Ls, o, n), I(Qt, o, n), I(nt, o, n), I(Hs, o, n), I(ns, o, n), I(Ge, 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;
|
|
3032
3063
|
}
|
|
3033
3064
|
export {
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3065
|
+
Gt as a,
|
|
3066
|
+
ws as b,
|
|
3067
|
+
Ut as c,
|
|
3068
|
+
Ct as d,
|
|
3069
|
+
Ft as e,
|
|
3070
|
+
Dt as f,
|
|
3071
|
+
To as g,
|
|
3072
|
+
_s as h,
|
|
3073
|
+
Ge as i,
|
|
3074
|
+
ns as j,
|
|
3075
|
+
Hs as k,
|
|
3076
|
+
nt as l,
|
|
3077
|
+
Ds as m,
|
|
3078
|
+
Qt as n,
|
|
3079
|
+
Ls as o,
|
|
3080
|
+
Qe as p,
|
|
3081
|
+
Yt as q,
|
|
3082
|
+
ps as r,
|
|
3083
|
+
Us as s,
|
|
3084
|
+
cs as t,
|
|
3085
|
+
uo as u,
|
|
3086
|
+
Xs as v,
|
|
3087
|
+
kt as w,
|
|
3088
|
+
bt as x
|
|
3058
3089
|
};
|