@doist/todoist-ai 2.2.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/index.d.ts +496 -255
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -29
- package/dist/mcp-helpers.d.ts +25 -3
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/mcp-helpers.js +37 -19
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +32 -28
- package/dist/tools/__tests__/add-tasks.test.d.ts +2 -0
- package/dist/tools/__tests__/add-tasks.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{tasks-add-multiple.test.js → add-tasks.test.js} +85 -81
- package/dist/tools/__tests__/complete-tasks.test.d.ts +2 -0
- package/dist/tools/__tests__/complete-tasks.test.d.ts.map +1 -0
- package/dist/tools/__tests__/complete-tasks.test.js +206 -0
- package/dist/tools/__tests__/delete-object.test.d.ts +2 -0
- package/dist/tools/__tests__/delete-object.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{delete-one.test.js → delete-object.test.js} +42 -22
- package/dist/tools/__tests__/find-completed-tasks.test.d.ts +2 -0
- package/dist/tools/__tests__/find-completed-tasks.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{tasks-list-completed.test.js → find-completed-tasks.test.js} +13 -36
- package/dist/tools/__tests__/find-projects.test.d.ts +2 -0
- package/dist/tools/__tests__/find-projects.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{projects-list.test.js → find-projects.test.js} +55 -39
- package/dist/tools/__tests__/find-sections.test.d.ts +2 -0
- package/dist/tools/__tests__/find-sections.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{sections-search.test.js → find-sections.test.js} +64 -50
- package/dist/tools/__tests__/find-tasks-by-date.test.d.ts +2 -0
- package/dist/tools/__tests__/find-tasks-by-date.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{tasks-list-by-date.test.js → find-tasks-by-date.test.js} +96 -14
- package/dist/tools/__tests__/find-tasks.test.d.ts +2 -0
- package/dist/tools/__tests__/find-tasks.test.d.ts.map +1 -0
- package/dist/tools/__tests__/find-tasks.test.js +334 -0
- package/dist/tools/__tests__/get-overview.test.d.ts +2 -0
- package/dist/tools/__tests__/get-overview.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{overview.test.js → get-overview.test.js} +77 -13
- package/dist/tools/__tests__/manage-projects.test.d.ts +2 -0
- package/dist/tools/__tests__/manage-projects.test.d.ts.map +1 -0
- package/dist/tools/__tests__/{projects-manage.test.js → manage-projects.test.js} +33 -30
- package/dist/tools/__tests__/manage-sections.test.d.ts +2 -0
- package/dist/tools/__tests__/manage-sections.test.d.ts.map +1 -0
- package/dist/tools/__tests__/manage-sections.test.js +162 -0
- package/dist/tools/__tests__/update-tasks.test.d.ts +2 -0
- package/dist/tools/__tests__/update-tasks.test.d.ts.map +1 -0
- package/dist/tools/__tests__/update-tasks.test.js +645 -0
- package/dist/tools/{tasks-add-multiple.d.ts → add-tasks.d.ts} +36 -16
- package/dist/tools/add-tasks.d.ts.map +1 -0
- package/dist/tools/{tasks-add-multiple.js → add-tasks.js} +39 -4
- package/dist/tools/complete-tasks.d.ts +40 -0
- package/dist/tools/complete-tasks.d.ts.map +1 -0
- package/dist/tools/complete-tasks.js +68 -0
- package/dist/tools/delete-object.d.ts +38 -0
- package/dist/tools/delete-object.d.ts.map +1 -0
- package/dist/tools/delete-object.js +69 -0
- package/dist/tools/find-completed-tasks.d.ts +74 -0
- package/dist/tools/find-completed-tasks.d.ts.map +1 -0
- package/dist/tools/find-completed-tasks.js +112 -0
- package/dist/tools/find-projects.d.ts +53 -0
- package/dist/tools/find-projects.d.ts.map +1 -0
- package/dist/tools/find-projects.js +101 -0
- package/dist/tools/find-sections.d.ts +42 -0
- package/dist/tools/find-sections.d.ts.map +1 -0
- package/dist/tools/find-sections.js +96 -0
- package/dist/tools/find-tasks-by-date.d.ts +59 -0
- package/dist/tools/find-tasks-by-date.d.ts.map +1 -0
- package/dist/tools/find-tasks-by-date.js +121 -0
- package/dist/tools/find-tasks.d.ts +65 -0
- package/dist/tools/find-tasks.d.ts.map +1 -0
- package/dist/tools/find-tasks.js +182 -0
- package/dist/tools/get-overview.d.ts +67 -0
- package/dist/tools/get-overview.d.ts.map +1 -0
- package/dist/tools/{overview.js → get-overview.js} +66 -19
- package/dist/tools/manage-projects.d.ts +35 -0
- package/dist/tools/manage-projects.d.ts.map +1 -0
- package/dist/tools/manage-projects.js +63 -0
- package/dist/tools/manage-sections.d.ts +38 -0
- package/dist/tools/manage-sections.d.ts.map +1 -0
- package/dist/tools/manage-sections.js +78 -0
- package/dist/tools/update-tasks.d.ts +94 -0
- package/dist/tools/update-tasks.d.ts.map +1 -0
- package/dist/tools/update-tasks.js +120 -0
- package/dist/utils/constants.d.ts +35 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +37 -0
- package/dist/utils/response-builders.d.ts +88 -0
- package/dist/utils/response-builders.d.ts.map +1 -0
- package/dist/utils/response-builders.js +202 -0
- package/dist/{tools → utils}/test-helpers.d.ts +16 -0
- package/dist/utils/test-helpers.d.ts.map +1 -0
- package/dist/{tools → utils}/test-helpers.js +51 -0
- package/dist/utils/tool-names.d.ts +23 -0
- package/dist/utils/tool-names.d.ts.map +1 -0
- package/dist/utils/tool-names.js +25 -0
- package/package.json +1 -1
- package/dist/tools/__tests__/delete-one.test.d.ts +0 -2
- package/dist/tools/__tests__/delete-one.test.d.ts.map +0 -1
- package/dist/tools/__tests__/overview.test.d.ts +0 -2
- package/dist/tools/__tests__/overview.test.d.ts.map +0 -1
- package/dist/tools/__tests__/projects-list.test.d.ts +0 -2
- package/dist/tools/__tests__/projects-list.test.d.ts.map +0 -1
- package/dist/tools/__tests__/projects-manage.test.d.ts +0 -2
- package/dist/tools/__tests__/projects-manage.test.d.ts.map +0 -1
- package/dist/tools/__tests__/sections-manage.test.d.ts +0 -2
- package/dist/tools/__tests__/sections-manage.test.d.ts.map +0 -1
- package/dist/tools/__tests__/sections-manage.test.js +0 -138
- package/dist/tools/__tests__/sections-search.test.d.ts +0 -2
- package/dist/tools/__tests__/sections-search.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-add-multiple.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-add-multiple.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-complete-multiple.test.js +0 -146
- package/dist/tools/__tests__/tasks-list-by-date.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-list-by-date.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-list-completed.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-list-completed.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-list-for-container.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-list-for-container.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-list-for-container.test.js +0 -232
- package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-organize-multiple.test.js +0 -245
- package/dist/tools/__tests__/tasks-search.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-search.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-search.test.js +0 -106
- package/dist/tools/__tests__/tasks-update-one.test.d.ts +0 -2
- package/dist/tools/__tests__/tasks-update-one.test.d.ts.map +0 -1
- package/dist/tools/__tests__/tasks-update-one.test.js +0 -251
- package/dist/tools/delete-one.d.ts +0 -17
- package/dist/tools/delete-one.d.ts.map +0 -1
- package/dist/tools/delete-one.js +0 -25
- package/dist/tools/overview.d.ts +0 -14
- package/dist/tools/overview.d.ts.map +0 -1
- package/dist/tools/projects-list.d.ts +0 -29
- package/dist/tools/projects-list.d.ts.map +0 -1
- package/dist/tools/projects-list.js +0 -39
- package/dist/tools/projects-manage.d.ts +0 -24
- package/dist/tools/projects-manage.d.ts.map +0 -1
- package/dist/tools/projects-manage.js +0 -26
- package/dist/tools/sections-manage.d.ts +0 -23
- package/dist/tools/sections-manage.d.ts.map +0 -1
- package/dist/tools/sections-manage.js +0 -37
- package/dist/tools/sections-search.d.ts +0 -18
- package/dist/tools/sections-search.d.ts.map +0 -1
- package/dist/tools/sections-search.js +0 -27
- package/dist/tools/tasks-add-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-complete-multiple.d.ts +0 -16
- package/dist/tools/tasks-complete-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-complete-multiple.js +0 -23
- package/dist/tools/tasks-list-by-date.d.ts +0 -34
- package/dist/tools/tasks-list-by-date.d.ts.map +0 -1
- package/dist/tools/tasks-list-by-date.js +0 -53
- package/dist/tools/tasks-list-completed.d.ts +0 -44
- package/dist/tools/tasks-list-completed.d.ts.map +0 -1
- package/dist/tools/tasks-list-completed.js +0 -49
- package/dist/tools/tasks-list-for-container.d.ts +0 -34
- package/dist/tools/tasks-list-for-container.d.ts.map +0 -1
- package/dist/tools/tasks-list-for-container.js +0 -48
- package/dist/tools/tasks-organize-multiple.d.ts +0 -37
- package/dist/tools/tasks-organize-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-organize-multiple.js +0 -34
- package/dist/tools/tasks-search.d.ts +0 -32
- package/dist/tools/tasks-search.d.ts.map +0 -1
- package/dist/tools/tasks-search.js +0 -30
- package/dist/tools/tasks-update-one.d.ts +0 -29
- package/dist/tools/tasks-update-one.d.ts.map +0 -1
- package/dist/tools/tasks-update-one.js +0 -63
- package/dist/tools/test-helpers.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const
|
|
3
|
-
name:
|
|
2
|
+
declare const addTasks: {
|
|
3
|
+
name: "add-tasks";
|
|
4
4
|
description: string;
|
|
5
5
|
parameters: {
|
|
6
6
|
projectId: z.ZodOptional<z.ZodString>;
|
|
@@ -38,18 +38,38 @@ declare const tasksAddMultiple: {
|
|
|
38
38
|
projectId?: string | undefined;
|
|
39
39
|
sectionId?: string | undefined;
|
|
40
40
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
content: {
|
|
42
|
+
type: "text";
|
|
43
|
+
text: string;
|
|
44
|
+
}[];
|
|
45
|
+
structuredContent: {
|
|
46
|
+
tasks: {
|
|
47
|
+
id: string;
|
|
48
|
+
content: string;
|
|
49
|
+
description: string;
|
|
50
|
+
dueDate: string | undefined;
|
|
51
|
+
recurring: string | boolean;
|
|
52
|
+
priority: number;
|
|
53
|
+
projectId: string;
|
|
54
|
+
sectionId: string | null;
|
|
55
|
+
parentId: string | null;
|
|
56
|
+
labels: string[];
|
|
57
|
+
duration: string | null;
|
|
58
|
+
}[];
|
|
59
|
+
totalCount: number;
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
content: ({
|
|
63
|
+
type: "text";
|
|
64
|
+
text: string;
|
|
65
|
+
mimeType?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
type: "text";
|
|
68
|
+
mimeType: string;
|
|
69
|
+
text: string;
|
|
70
|
+
})[];
|
|
71
|
+
structuredContent?: undefined;
|
|
72
|
+
}>;
|
|
53
73
|
};
|
|
54
|
-
export {
|
|
55
|
-
//# sourceMappingURL=
|
|
74
|
+
export { addTasks };
|
|
75
|
+
//# sourceMappingURL=add-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/add-tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAgCvB,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD4B,CAAA;AA8B1C,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { getToolOutput } from '../mcp-helpers.js';
|
|
2
3
|
import { mapTask } from '../tool-helpers.js';
|
|
3
4
|
import { DurationParseError, parseDuration } from '../utils/duration-parser.js';
|
|
5
|
+
import { generateTaskNextSteps, getDateString, summarizeTaskOperation, } from '../utils/response-builders.js';
|
|
6
|
+
import { ToolNames } from '../utils/tool-names.js';
|
|
4
7
|
const TaskSchema = z.object({
|
|
5
8
|
content: z.string().min(1).describe('The content of the task to create.'),
|
|
6
9
|
description: z.string().optional().describe('The description of the task.'),
|
|
@@ -17,8 +20,8 @@ const ArgsSchema = {
|
|
|
17
20
|
parentId: z.string().optional().describe('The parent task ID (for subtasks).'),
|
|
18
21
|
tasks: z.array(TaskSchema).min(1).describe('The array of tasks to add.'),
|
|
19
22
|
};
|
|
20
|
-
const
|
|
21
|
-
name:
|
|
23
|
+
const addTasks = {
|
|
24
|
+
name: ToolNames.ADD_TASKS,
|
|
22
25
|
description: 'Add one or more tasks to a project, section, or parent.',
|
|
23
26
|
parameters: ArgsSchema,
|
|
24
27
|
async execute(args, client) {
|
|
@@ -46,7 +49,39 @@ const tasksAddMultiple = {
|
|
|
46
49
|
}
|
|
47
50
|
newTasks.push(await client.addTask(taskArgs));
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
const mappedTasks = newTasks.map(mapTask);
|
|
53
|
+
const textContent = generateTextContent({
|
|
54
|
+
tasks: mappedTasks,
|
|
55
|
+
args,
|
|
56
|
+
});
|
|
57
|
+
return getToolOutput({
|
|
58
|
+
textContent,
|
|
59
|
+
structuredContent: {
|
|
60
|
+
tasks: mappedTasks,
|
|
61
|
+
totalCount: mappedTasks.length,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
50
64
|
},
|
|
51
65
|
};
|
|
52
|
-
|
|
66
|
+
function generateTextContent({ tasks, args, }) {
|
|
67
|
+
// Get context for smart next steps
|
|
68
|
+
const todayStr = getDateString();
|
|
69
|
+
const hasToday = tasks.some((task) => task.dueDate === todayStr);
|
|
70
|
+
// Generate context description without API calls
|
|
71
|
+
let projectContext = '';
|
|
72
|
+
if (args.projectId) {
|
|
73
|
+
projectContext = 'to specified project';
|
|
74
|
+
}
|
|
75
|
+
else if (args.sectionId) {
|
|
76
|
+
projectContext = 'to specified section';
|
|
77
|
+
}
|
|
78
|
+
else if (args.parentId) {
|
|
79
|
+
projectContext = 'as subtasks';
|
|
80
|
+
}
|
|
81
|
+
return summarizeTaskOperation('Added', tasks, {
|
|
82
|
+
context: projectContext,
|
|
83
|
+
nextSteps: generateTaskNextSteps('added', tasks, { hasToday }),
|
|
84
|
+
showDetails: true,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export { addTasks };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const completeTasks: {
|
|
3
|
+
name: "complete-tasks";
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
ids: z.ZodArray<z.ZodString, "many">;
|
|
7
|
+
};
|
|
8
|
+
execute(args: {
|
|
9
|
+
ids: string[];
|
|
10
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
structuredContent: {
|
|
16
|
+
completed: string[];
|
|
17
|
+
failures: {
|
|
18
|
+
item: string;
|
|
19
|
+
error: string;
|
|
20
|
+
code?: string;
|
|
21
|
+
}[];
|
|
22
|
+
totalRequested: number;
|
|
23
|
+
successCount: number;
|
|
24
|
+
failureCount: number;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
content: ({
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
mimeType?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
type: "text";
|
|
33
|
+
mimeType: string;
|
|
34
|
+
text: string;
|
|
35
|
+
})[];
|
|
36
|
+
structuredContent?: undefined;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
export { completeTasks };
|
|
40
|
+
//# sourceMappingURL=complete-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/complete-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;sBAMmB,MAAM;uBAAS,MAAM;uBAAS,MAAM;;;;;;;;;;;;;;;;;;CAgChC,CAAA;AAsC1C,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToolOutput } from '../mcp-helpers.js';
|
|
3
|
+
import { summarizeBatch } from '../utils/response-builders.js';
|
|
4
|
+
import { ToolNames } from '../utils/tool-names.js';
|
|
5
|
+
const ArgsSchema = {
|
|
6
|
+
ids: z.array(z.string().min(1)).min(1).describe('The IDs of the tasks to complete.'),
|
|
7
|
+
};
|
|
8
|
+
const completeTasks = {
|
|
9
|
+
name: ToolNames.COMPLETE_TASKS,
|
|
10
|
+
description: 'Complete one or more tasks by their IDs.',
|
|
11
|
+
parameters: ArgsSchema,
|
|
12
|
+
async execute(args, client) {
|
|
13
|
+
const completed = [];
|
|
14
|
+
const failures = [];
|
|
15
|
+
for (const id of args.ids) {
|
|
16
|
+
try {
|
|
17
|
+
await client.closeTask(id);
|
|
18
|
+
completed.push(id);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
22
|
+
failures.push({
|
|
23
|
+
item: id,
|
|
24
|
+
error: errorMessage,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const textContent = generateTextContent({
|
|
29
|
+
completed,
|
|
30
|
+
failures,
|
|
31
|
+
args,
|
|
32
|
+
});
|
|
33
|
+
return getToolOutput({
|
|
34
|
+
textContent,
|
|
35
|
+
structuredContent: {
|
|
36
|
+
completed,
|
|
37
|
+
failures,
|
|
38
|
+
totalRequested: args.ids.length,
|
|
39
|
+
successCount: completed.length,
|
|
40
|
+
failureCount: failures.length,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
function generateNextSteps(completed, failures) {
|
|
46
|
+
if (completed > 0) {
|
|
47
|
+
const moveResult = failures === 0
|
|
48
|
+
? "Use find-tasks-by-date('overdue') to tackle remaining overdue items."
|
|
49
|
+
: 'Review failed completions and retry if needed.';
|
|
50
|
+
return [moveResult];
|
|
51
|
+
}
|
|
52
|
+
if (failures > 0) {
|
|
53
|
+
return ['Check task IDs and permissions, then retry.'];
|
|
54
|
+
}
|
|
55
|
+
return ['No tasks were completed.'];
|
|
56
|
+
}
|
|
57
|
+
function generateTextContent({ completed, failures, args, }) {
|
|
58
|
+
const nextSteps = generateNextSteps(completed.length, failures.length);
|
|
59
|
+
return summarizeBatch({
|
|
60
|
+
action: 'Completed tasks',
|
|
61
|
+
success: completed.length,
|
|
62
|
+
total: args.ids.length,
|
|
63
|
+
successItems: completed,
|
|
64
|
+
failures,
|
|
65
|
+
nextSteps,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export { completeTasks };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const deleteObject: {
|
|
3
|
+
name: "delete-object";
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
type: z.ZodEnum<["project", "section", "task"]>;
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
};
|
|
9
|
+
execute(args: {
|
|
10
|
+
type: "task" | "project" | "section";
|
|
11
|
+
id: string;
|
|
12
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
13
|
+
content: {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
}[];
|
|
17
|
+
structuredContent: {
|
|
18
|
+
deletedEntity: {
|
|
19
|
+
type: "task" | "project" | "section";
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
success: boolean;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
content: ({
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
mimeType?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
type: "text";
|
|
31
|
+
mimeType: string;
|
|
32
|
+
text: string;
|
|
33
|
+
})[];
|
|
34
|
+
structuredContent?: undefined;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
export { deleteObject };
|
|
38
|
+
//# sourceMappingURL=delete-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-object.d.ts","sourceRoot":"","sources":["../../src/tools/delete-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCwB,CAAA;AAyC1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToolOutput } from '../mcp-helpers.js';
|
|
3
|
+
import { formatNextSteps } from '../utils/response-builders.js';
|
|
4
|
+
import { ToolNames } from '../utils/tool-names.js';
|
|
5
|
+
const { FIND_PROJECTS, GET_OVERVIEW, FIND_SECTIONS, FIND_TASKS, FIND_TASKS_BY_DATE } = ToolNames;
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
type: z.enum(['project', 'section', 'task']).describe('The type of entity to delete.'),
|
|
8
|
+
id: z.string().min(1).describe('The ID of the entity to delete.'),
|
|
9
|
+
};
|
|
10
|
+
const deleteObject = {
|
|
11
|
+
name: ToolNames.DELETE_OBJECT,
|
|
12
|
+
description: 'Delete a project, section, or task by its ID.',
|
|
13
|
+
parameters: ArgsSchema,
|
|
14
|
+
async execute(args, client) {
|
|
15
|
+
switch (args.type) {
|
|
16
|
+
case 'project':
|
|
17
|
+
await client.deleteProject(args.id);
|
|
18
|
+
break;
|
|
19
|
+
case 'section':
|
|
20
|
+
await client.deleteSection(args.id);
|
|
21
|
+
break;
|
|
22
|
+
case 'task':
|
|
23
|
+
await client.deleteTask(args.id);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
const textContent = generateTextContent({
|
|
27
|
+
type: args.type,
|
|
28
|
+
id: args.id,
|
|
29
|
+
});
|
|
30
|
+
return getToolOutput({
|
|
31
|
+
textContent,
|
|
32
|
+
structuredContent: {
|
|
33
|
+
deletedEntity: {
|
|
34
|
+
type: args.type,
|
|
35
|
+
id: args.id,
|
|
36
|
+
},
|
|
37
|
+
success: true,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
function generateTextContent({ type, id, }) {
|
|
43
|
+
const summary = `Deleted ${type}: id=${id}`;
|
|
44
|
+
// Recovery-focused next steps based on what was deleted
|
|
45
|
+
const nextSteps = [];
|
|
46
|
+
switch (type) {
|
|
47
|
+
case 'project':
|
|
48
|
+
// Help user understand impact and navigate remaining work
|
|
49
|
+
nextSteps.push(`Use ${FIND_PROJECTS} to see remaining projects`);
|
|
50
|
+
nextSteps.push('Note: All tasks and sections in this project were also deleted');
|
|
51
|
+
nextSteps.push(`Use ${GET_OVERVIEW} to review your updated project structure`);
|
|
52
|
+
break;
|
|
53
|
+
case 'section':
|
|
54
|
+
// Guide user to reorganize remaining sections and tasks
|
|
55
|
+
nextSteps.push(`Use ${FIND_SECTIONS} to see remaining sections in the project`);
|
|
56
|
+
nextSteps.push('Note: Tasks in this section were also deleted');
|
|
57
|
+
nextSteps.push(`Use ${FIND_TASKS} with projectId to see unorganized tasks`);
|
|
58
|
+
break;
|
|
59
|
+
case 'task':
|
|
60
|
+
// Help user stay focused on remaining work
|
|
61
|
+
nextSteps.push(`Use ${FIND_TASKS_BY_DATE} to see remaining tasks for today`);
|
|
62
|
+
nextSteps.push(`Use ${GET_OVERVIEW} to check if this affects any dependent tasks`);
|
|
63
|
+
nextSteps.push('Note: Any subtasks of this task were also deleted');
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
const next = formatNextSteps(nextSteps);
|
|
67
|
+
return `${summary}\n${next}`;
|
|
68
|
+
}
|
|
69
|
+
export { deleteObject };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const findCompletedTasks: {
|
|
3
|
+
name: "find-completed-tasks";
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
getBy: z.ZodDefault<z.ZodEnum<["completion", "due"]>>;
|
|
7
|
+
since: z.ZodString;
|
|
8
|
+
until: z.ZodString;
|
|
9
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
sectionId: z.ZodOptional<z.ZodString>;
|
|
12
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
15
|
+
};
|
|
16
|
+
execute(args: {
|
|
17
|
+
limit: number;
|
|
18
|
+
getBy: "completion" | "due";
|
|
19
|
+
since: string;
|
|
20
|
+
until: string;
|
|
21
|
+
parentId?: string | undefined;
|
|
22
|
+
workspaceId?: string | undefined;
|
|
23
|
+
projectId?: string | undefined;
|
|
24
|
+
sectionId?: string | undefined;
|
|
25
|
+
cursor?: string | undefined;
|
|
26
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
structuredContent: {
|
|
32
|
+
tasks: {
|
|
33
|
+
id: string;
|
|
34
|
+
content: string;
|
|
35
|
+
description: string;
|
|
36
|
+
dueDate: string | undefined;
|
|
37
|
+
recurring: string | boolean;
|
|
38
|
+
priority: number;
|
|
39
|
+
projectId: string;
|
|
40
|
+
sectionId: string | null;
|
|
41
|
+
parentId: string | null;
|
|
42
|
+
labels: string[];
|
|
43
|
+
duration: string | null;
|
|
44
|
+
}[];
|
|
45
|
+
nextCursor: string | null;
|
|
46
|
+
totalCount: number;
|
|
47
|
+
hasMore: boolean;
|
|
48
|
+
appliedFilters: {
|
|
49
|
+
limit: number;
|
|
50
|
+
getBy: "completion" | "due";
|
|
51
|
+
since: string;
|
|
52
|
+
until: string;
|
|
53
|
+
parentId?: string | undefined;
|
|
54
|
+
workspaceId?: string | undefined;
|
|
55
|
+
projectId?: string | undefined;
|
|
56
|
+
sectionId?: string | undefined;
|
|
57
|
+
cursor?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
content: ({
|
|
62
|
+
type: "text";
|
|
63
|
+
text: string;
|
|
64
|
+
mimeType?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
type: "text";
|
|
67
|
+
mimeType: string;
|
|
68
|
+
text: string;
|
|
69
|
+
})[];
|
|
70
|
+
structuredContent?: undefined;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
export { findCompletedTasks };
|
|
74
|
+
//# sourceMappingURL=find-completed-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-completed-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/find-completed-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA8CvB,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BkB,CAAA;AA2D1C,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getToolOutput } from '../mcp-helpers.js';
|
|
3
|
+
import { mapTask } from '../tool-helpers.js';
|
|
4
|
+
import { ApiLimits } from '../utils/constants.js';
|
|
5
|
+
import { previewTasks, summarizeList } from '../utils/response-builders.js';
|
|
6
|
+
import { ToolNames } from '../utils/tool-names.js';
|
|
7
|
+
const { FIND_TASKS_BY_DATE, GET_OVERVIEW } = ToolNames;
|
|
8
|
+
const ArgsSchema = {
|
|
9
|
+
getBy: z
|
|
10
|
+
.enum(['completion', 'due'])
|
|
11
|
+
.default('completion')
|
|
12
|
+
.describe('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).'),
|
|
13
|
+
since: z
|
|
14
|
+
.string()
|
|
15
|
+
.date()
|
|
16
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
17
|
+
.describe('The start date to get the tasks for. Format: YYYY-MM-DD.'),
|
|
18
|
+
until: z
|
|
19
|
+
.string()
|
|
20
|
+
.date()
|
|
21
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/)
|
|
22
|
+
.describe('The start date to get the tasks for. Format: YYYY-MM-DD.'),
|
|
23
|
+
workspaceId: z.string().optional().describe('The ID of the workspace to get the tasks for.'),
|
|
24
|
+
projectId: z.string().optional().describe('The ID of the project to get the tasks for.'),
|
|
25
|
+
sectionId: z.string().optional().describe('The ID of the section to get the tasks for.'),
|
|
26
|
+
parentId: z.string().optional().describe('The ID of the parent task to get the tasks for.'),
|
|
27
|
+
limit: z
|
|
28
|
+
.number()
|
|
29
|
+
.int()
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(ApiLimits.COMPLETED_TASKS_MAX)
|
|
32
|
+
.default(ApiLimits.COMPLETED_TASKS_DEFAULT)
|
|
33
|
+
.describe('The maximum number of tasks to return.'),
|
|
34
|
+
cursor: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters).'),
|
|
38
|
+
};
|
|
39
|
+
const findCompletedTasks = {
|
|
40
|
+
name: ToolNames.FIND_COMPLETED_TASKS,
|
|
41
|
+
description: 'Get completed tasks.',
|
|
42
|
+
parameters: ArgsSchema,
|
|
43
|
+
async execute(args, client) {
|
|
44
|
+
const { getBy, ...rest } = args;
|
|
45
|
+
const { items, nextCursor } = getBy === 'completion'
|
|
46
|
+
? await client.getCompletedTasksByCompletionDate(rest)
|
|
47
|
+
: await client.getCompletedTasksByDueDate(rest);
|
|
48
|
+
const mappedTasks = items.map(mapTask);
|
|
49
|
+
const textContent = generateTextContent({
|
|
50
|
+
tasks: mappedTasks,
|
|
51
|
+
args,
|
|
52
|
+
nextCursor,
|
|
53
|
+
});
|
|
54
|
+
return getToolOutput({
|
|
55
|
+
textContent,
|
|
56
|
+
structuredContent: {
|
|
57
|
+
tasks: mappedTasks,
|
|
58
|
+
nextCursor,
|
|
59
|
+
totalCount: mappedTasks.length,
|
|
60
|
+
hasMore: Boolean(nextCursor),
|
|
61
|
+
appliedFilters: args,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
function generateTextContent({ tasks, args, nextCursor, }) {
|
|
67
|
+
// Generate subject description
|
|
68
|
+
const getByText = args.getBy === 'completion' ? 'completed' : 'due';
|
|
69
|
+
const subject = `Completed tasks (by ${getByText} date)`;
|
|
70
|
+
// Generate filter hints
|
|
71
|
+
const filterHints = [];
|
|
72
|
+
filterHints.push(`${getByText} date: ${args.since} to ${args.until}`);
|
|
73
|
+
if (args.projectId)
|
|
74
|
+
filterHints.push(`project: ${args.projectId}`);
|
|
75
|
+
if (args.sectionId)
|
|
76
|
+
filterHints.push(`section: ${args.sectionId}`);
|
|
77
|
+
if (args.parentId)
|
|
78
|
+
filterHints.push(`parent: ${args.parentId}`);
|
|
79
|
+
if (args.workspaceId)
|
|
80
|
+
filterHints.push(`workspace: ${args.workspaceId}`);
|
|
81
|
+
// Generate helpful suggestions for empty results
|
|
82
|
+
const zeroReasonHints = [];
|
|
83
|
+
if (tasks.length === 0) {
|
|
84
|
+
zeroReasonHints.push('No tasks completed in this date range');
|
|
85
|
+
zeroReasonHints.push('Try expanding the date range');
|
|
86
|
+
if (args.projectId || args.sectionId || args.parentId) {
|
|
87
|
+
zeroReasonHints.push('Try removing project/section/parent filters');
|
|
88
|
+
}
|
|
89
|
+
if (args.getBy === 'due') {
|
|
90
|
+
zeroReasonHints.push('Try switching to "completion" date instead');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Generate contextual next steps
|
|
94
|
+
const nextSteps = [];
|
|
95
|
+
if (tasks.length > 0) {
|
|
96
|
+
nextSteps.push(`Use ${FIND_TASKS_BY_DATE} for active tasks or ${GET_OVERVIEW} for current productivity.`);
|
|
97
|
+
if (tasks.some((task) => task.recurring)) {
|
|
98
|
+
nextSteps.push('Recurring tasks will automatically create new instances.');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return summarizeList({
|
|
102
|
+
subject,
|
|
103
|
+
count: tasks.length,
|
|
104
|
+
limit: args.limit,
|
|
105
|
+
nextCursor: nextCursor ?? undefined,
|
|
106
|
+
filterHints,
|
|
107
|
+
previewLines: previewTasks(tasks),
|
|
108
|
+
zeroReasonHints,
|
|
109
|
+
nextSteps,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
export { findCompletedTasks };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const findProjects: {
|
|
3
|
+
name: "find-projects";
|
|
4
|
+
description: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
9
|
+
};
|
|
10
|
+
execute(args: {
|
|
11
|
+
limit: number;
|
|
12
|
+
cursor?: string | undefined;
|
|
13
|
+
search?: string | undefined;
|
|
14
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
structuredContent: {
|
|
20
|
+
projects: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
color: string;
|
|
24
|
+
isFavorite: boolean;
|
|
25
|
+
isShared: boolean;
|
|
26
|
+
parentId: string | null;
|
|
27
|
+
inboxProject: boolean;
|
|
28
|
+
viewStyle: string;
|
|
29
|
+
}[];
|
|
30
|
+
nextCursor: string | null;
|
|
31
|
+
totalCount: number;
|
|
32
|
+
hasMore: boolean;
|
|
33
|
+
appliedFilters: {
|
|
34
|
+
limit: number;
|
|
35
|
+
cursor?: string | undefined;
|
|
36
|
+
search?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
content: ({
|
|
41
|
+
type: "text";
|
|
42
|
+
text: string;
|
|
43
|
+
mimeType?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
type: "text";
|
|
46
|
+
mimeType: string;
|
|
47
|
+
text: string;
|
|
48
|
+
})[];
|
|
49
|
+
structuredContent?: undefined;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
export { findProjects };
|
|
53
|
+
//# sourceMappingURL=find-projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-projects.d.ts","sourceRoot":"","sources":["../../src/tools/find-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAgCvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BwB,CAAA;AA8D1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
|