@doist/todoist-ai 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/index.js +74 -0
- package/dist/cjs/main.js +28 -0
- package/dist/cjs/mcp-helpers.js +54 -0
- package/dist/cjs/mcp-server.js +68 -0
- package/dist/cjs/todoist-tool.js +2 -0
- package/dist/cjs/tools/account-overview.js +97 -0
- package/dist/cjs/tools/project-overview.js +110 -0
- package/dist/cjs/tools/projects-add-one.js +18 -0
- package/dist/cjs/tools/projects-delete-one.js +17 -0
- package/dist/cjs/tools/projects-list.js +33 -0
- package/dist/cjs/tools/projects-search.js +42 -0
- package/dist/cjs/tools/projects-update-one.js +19 -0
- package/dist/cjs/tools/sections-add-one.js +24 -0
- package/dist/cjs/tools/sections-delete-one.js +17 -0
- package/dist/cjs/tools/sections-search.js +33 -0
- package/dist/cjs/tools/sections-update-one.js +19 -0
- package/dist/cjs/tools/shared.js +78 -0
- package/dist/cjs/tools/subtasks-list-for-parent-task.js +40 -0
- package/dist/cjs/tools/tasks-add-multiple.js +50 -0
- package/dist/cjs/tools/tasks-by-date-range.js +50 -0
- package/dist/cjs/tools/tasks-by-project.js +40 -0
- package/dist/cjs/tools/tasks-complete-multiple.js +29 -0
- package/dist/cjs/tools/tasks-delete-one.js +17 -0
- package/dist/cjs/tools/tasks-list-for-section.js +40 -0
- package/dist/cjs/tools/tasks-list-overdue.js +32 -0
- package/dist/cjs/tools/tasks-organize-multiple.js +43 -0
- package/dist/cjs/tools/tasks-search.js +33 -0
- package/dist/cjs/tools/tasks-update-one.js +45 -0
- package/dist/esm/index.d.ts +477 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +49 -0
- package/dist/esm/main.d.ts.map +1 -0
- package/dist/esm/mcp-helpers.d.ts.map +1 -0
- package/dist/esm/mcp-server.d.ts.map +1 -0
- package/dist/esm/todoist-tool.d.ts.map +1 -0
- package/dist/esm/tools/account-overview.d.ts.map +1 -0
- package/dist/esm/tools/project-overview.d.ts.map +1 -0
- package/dist/esm/tools/projects-add-one.d.ts.map +1 -0
- package/dist/esm/tools/projects-delete-one.d.ts.map +1 -0
- package/dist/esm/tools/projects-list.d.ts.map +1 -0
- package/dist/esm/tools/projects-search.d.ts.map +1 -0
- package/dist/esm/tools/projects-update-one.d.ts.map +1 -0
- package/dist/esm/tools/sections-add-one.d.ts.map +1 -0
- package/dist/esm/tools/sections-delete-one.d.ts.map +1 -0
- package/dist/esm/tools/sections-search.d.ts.map +1 -0
- package/dist/esm/tools/sections-update-one.d.ts.map +1 -0
- package/dist/esm/tools/shared.d.ts.map +1 -0
- package/dist/esm/tools/subtasks-list-for-parent-task.d.ts.map +1 -0
- package/dist/esm/tools/tasks-add-multiple.d.ts.map +1 -0
- package/dist/esm/tools/tasks-by-date-range.d.ts.map +1 -0
- package/dist/esm/tools/tasks-by-project.d.ts.map +1 -0
- package/dist/esm/tools/tasks-complete-multiple.d.ts.map +1 -0
- package/dist/esm/tools/tasks-delete-one.d.ts.map +1 -0
- package/dist/esm/tools/tasks-list-for-section.d.ts.map +1 -0
- package/dist/esm/tools/tasks-list-overdue.d.ts.map +1 -0
- package/dist/esm/tools/tasks-organize-multiple.d.ts.map +1 -0
- package/dist/esm/tools/tasks-search.d.ts.map +1 -0
- package/dist/esm/tools/tasks-update-one.d.ts.map +1 -0
- package/dist/types/index.d.ts +476 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/mcp-helpers.d.ts +12 -0
- package/dist/types/mcp-server.d.ts +10 -0
- package/dist/types/todoist-tool.d.ts +34 -0
- package/dist/types/tools/account-overview.d.ts +8 -0
- package/dist/types/tools/project-overview.d.ts +13 -0
- package/dist/types/tools/projects-add-one.d.ts +21 -0
- package/dist/types/tools/projects-delete-one.d.ts +14 -0
- package/dist/types/tools/projects-list.d.ts +17 -0
- package/dist/types/tools/projects-search.d.ts +28 -0
- package/dist/types/tools/projects-update-one.d.ts +14 -0
- package/dist/types/tools/sections-add-one.d.ts +14 -0
- package/dist/types/tools/sections-delete-one.d.ts +14 -0
- package/dist/types/tools/sections-search.d.ts +17 -0
- package/dist/types/tools/sections-update-one.d.ts +14 -0
- package/dist/types/tools/shared.d.ts +54 -0
- package/dist/types/tools/subtasks-list-for-parent-task.d.ts +30 -0
- package/dist/types/tools/tasks-add-multiple.d.ts +49 -0
- package/dist/types/tools/tasks-by-date-range.d.ts +32 -0
- package/dist/types/tools/tasks-by-project.d.ts +30 -0
- package/dist/types/tools/tasks-complete-multiple.d.ts +15 -0
- package/dist/types/tools/tasks-delete-one.d.ts +14 -0
- package/dist/types/tools/tasks-list-for-section.d.ts +30 -0
- package/dist/types/tools/tasks-list-overdue.d.ts +28 -0
- package/dist/types/tools/tasks-organize-multiple.d.ts +36 -0
- package/dist/types/tools/tasks-search.d.ts +30 -0
- package/dist/types/tools/tasks-update-one.d.ts +26 -0
- package/package.json +20 -7
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/mcp-helpers.d.ts.map +0 -1
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/todoist-tool.d.ts.map +0 -1
- package/dist/tools/account-overview.d.ts.map +0 -1
- package/dist/tools/index.d.ts +0 -23
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -22
- package/dist/tools/project-overview.d.ts.map +0 -1
- package/dist/tools/projects-add-one.d.ts.map +0 -1
- package/dist/tools/projects-delete-one.d.ts.map +0 -1
- package/dist/tools/projects-list.d.ts.map +0 -1
- package/dist/tools/projects-search.d.ts.map +0 -1
- package/dist/tools/projects-update-one.d.ts.map +0 -1
- package/dist/tools/sections-add-one.d.ts.map +0 -1
- package/dist/tools/sections-delete-one.d.ts.map +0 -1
- package/dist/tools/sections-search.d.ts.map +0 -1
- package/dist/tools/sections-update-one.d.ts.map +0 -1
- package/dist/tools/shared.d.ts.map +0 -1
- package/dist/tools/subtasks-list-for-parent-task.d.ts.map +0 -1
- package/dist/tools/tasks-add-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-by-date-range.d.ts.map +0 -1
- package/dist/tools/tasks-by-project.d.ts.map +0 -1
- package/dist/tools/tasks-complete-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-delete-one.d.ts.map +0 -1
- package/dist/tools/tasks-list-for-section.d.ts.map +0 -1
- package/dist/tools/tasks-list-overdue.d.ts.map +0 -1
- package/dist/tools/tasks-organize-multiple.d.ts.map +0 -1
- package/dist/tools/tasks-search.d.ts.map +0 -1
- package/dist/tools/tasks-update-one.d.ts.map +0 -1
- package/src/index.ts +0 -1
- package/src/main.ts +0 -26
- package/src/mcp-helpers.ts +0 -76
- package/src/mcp-server.ts +0 -79
- package/src/todoist-tool.ts +0 -42
- package/src/tools/account-overview.ts +0 -130
- package/src/tools/index.ts +0 -26
- package/src/tools/project-overview.ts +0 -130
- package/src/tools/projects-add-one.ts +0 -19
- package/src/tools/projects-delete-one.ts +0 -18
- package/src/tools/projects-list.ts +0 -36
- package/src/tools/projects-search.ts +0 -49
- package/src/tools/projects-update-one.ts +0 -20
- package/src/tools/sections-add-one.ts +0 -25
- package/src/tools/sections-delete-one.ts +0 -18
- package/src/tools/sections-search.ts +0 -39
- package/src/tools/sections-update-one.ts +0 -20
- package/src/tools/shared.ts +0 -94
- package/src/tools/subtasks-list-for-parent-task.ts +0 -43
- package/src/tools/tasks-add-multiple.ts +0 -53
- package/src/tools/tasks-by-date-range.ts +0 -58
- package/src/tools/tasks-by-project.ts +0 -43
- package/src/tools/tasks-complete-multiple.ts +0 -29
- package/src/tools/tasks-delete-one.ts +0 -18
- package/src/tools/tasks-list-for-section.ts +0 -43
- package/src/tools/tasks-list-overdue.ts +0 -35
- package/src/tools/tasks-organize-multiple.ts +0 -45
- package/src/tools/tasks-search.ts +0 -36
- package/src/tools/tasks-update-one.ts +0 -48
- /package/dist/{main.d.ts → esm/main.d.ts} +0 -0
- /package/dist/{main.js → esm/main.js} +0 -0
- /package/dist/{mcp-helpers.d.ts → esm/mcp-helpers.d.ts} +0 -0
- /package/dist/{mcp-helpers.js → esm/mcp-helpers.js} +0 -0
- /package/dist/{mcp-server.d.ts → esm/mcp-server.d.ts} +0 -0
- /package/dist/{mcp-server.js → esm/mcp-server.js} +0 -0
- /package/dist/{todoist-tool.d.ts → esm/todoist-tool.d.ts} +0 -0
- /package/dist/{todoist-tool.js → esm/todoist-tool.js} +0 -0
- /package/dist/{tools → esm/tools}/account-overview.d.ts +0 -0
- /package/dist/{tools → esm/tools}/account-overview.js +0 -0
- /package/dist/{tools → esm/tools}/project-overview.d.ts +0 -0
- /package/dist/{tools → esm/tools}/project-overview.js +0 -0
- /package/dist/{tools → esm/tools}/projects-add-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/projects-add-one.js +0 -0
- /package/dist/{tools → esm/tools}/projects-delete-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/projects-delete-one.js +0 -0
- /package/dist/{tools → esm/tools}/projects-list.d.ts +0 -0
- /package/dist/{tools → esm/tools}/projects-list.js +0 -0
- /package/dist/{tools → esm/tools}/projects-search.d.ts +0 -0
- /package/dist/{tools → esm/tools}/projects-search.js +0 -0
- /package/dist/{tools → esm/tools}/projects-update-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/projects-update-one.js +0 -0
- /package/dist/{tools → esm/tools}/sections-add-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/sections-add-one.js +0 -0
- /package/dist/{tools → esm/tools}/sections-delete-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/sections-delete-one.js +0 -0
- /package/dist/{tools → esm/tools}/sections-search.d.ts +0 -0
- /package/dist/{tools → esm/tools}/sections-search.js +0 -0
- /package/dist/{tools → esm/tools}/sections-update-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/sections-update-one.js +0 -0
- /package/dist/{tools → esm/tools}/shared.d.ts +0 -0
- /package/dist/{tools → esm/tools}/shared.js +0 -0
- /package/dist/{tools → esm/tools}/subtasks-list-for-parent-task.d.ts +0 -0
- /package/dist/{tools → esm/tools}/subtasks-list-for-parent-task.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-add-multiple.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-add-multiple.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-by-date-range.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-by-date-range.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-by-project.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-by-project.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-complete-multiple.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-complete-multiple.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-delete-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-delete-one.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-list-for-section.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-list-for-section.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-list-overdue.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-list-overdue.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-organize-multiple.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-organize-multiple.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-search.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-search.js +0 -0
- /package/dist/{tools → esm/tools}/tasks-update-one.d.ts +0 -0
- /package/dist/{tools → esm/tools}/tasks-update-one.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sectionsUpdateOne = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ArgsSchema = {
|
|
6
|
+
id: zod_1.z.string().min(1).describe("The ID of the section to update."),
|
|
7
|
+
name: zod_1.z.string().min(1).describe("The new name for the section."),
|
|
8
|
+
};
|
|
9
|
+
const sectionsUpdateOne = {
|
|
10
|
+
name: "sections-update-one",
|
|
11
|
+
description: "Update a section's name by its ID.",
|
|
12
|
+
parameters: ArgsSchema,
|
|
13
|
+
async execute(args, client) {
|
|
14
|
+
const { id, name } = args;
|
|
15
|
+
const section = await client.updateSection(id, { name });
|
|
16
|
+
return section;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
exports.sectionsUpdateOne = sectionsUpdateOne;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getTasksByFilter = getTasksByFilter;
|
|
7
|
+
exports.mapTask = mapTask;
|
|
8
|
+
exports.mapProject = mapProject;
|
|
9
|
+
const todoist_api_typescript_1 = require("@doist/todoist-api-typescript");
|
|
10
|
+
const zod_1 = __importDefault(require("zod"));
|
|
11
|
+
/**
|
|
12
|
+
* Map a single Todoist task to a more structured format, for LLM consumption.
|
|
13
|
+
* @param task - The task to map.
|
|
14
|
+
* @returns The mapped task.
|
|
15
|
+
*/
|
|
16
|
+
function mapTask(task) {
|
|
17
|
+
return {
|
|
18
|
+
id: task.id,
|
|
19
|
+
content: (0, todoist_api_typescript_1.getSanitizedContent)(task.content),
|
|
20
|
+
description: (0, todoist_api_typescript_1.getSanitizedContent)(task.description),
|
|
21
|
+
dueDate: task.due?.date,
|
|
22
|
+
recurring: task.due?.isRecurring && task.due.string ? task.due.string : false,
|
|
23
|
+
priority: task.priority,
|
|
24
|
+
projectId: task.projectId,
|
|
25
|
+
sectionId: task.sectionId,
|
|
26
|
+
parentId: task.parentId,
|
|
27
|
+
labels: task.labels,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Map a single Todoist project to a more structured format, for LLM consumption.
|
|
32
|
+
* @param project - The project to map.
|
|
33
|
+
* @returns The mapped project.
|
|
34
|
+
*/
|
|
35
|
+
function mapProject(project) {
|
|
36
|
+
return {
|
|
37
|
+
id: project.id,
|
|
38
|
+
name: project.name,
|
|
39
|
+
color: project.color,
|
|
40
|
+
isFavorite: project.isFavorite,
|
|
41
|
+
isShared: project.isShared,
|
|
42
|
+
parentId: project.parentId ?? null,
|
|
43
|
+
inboxProject: project.isInboxProject ?? false,
|
|
44
|
+
viewStyle: project.viewStyle,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const ErrorSchema = zod_1.default.object({
|
|
48
|
+
httpStatusCode: zod_1.default.number(),
|
|
49
|
+
responseData: zod_1.default.object({
|
|
50
|
+
error: zod_1.default.string(),
|
|
51
|
+
errorCode: zod_1.default.number(),
|
|
52
|
+
errorTag: zod_1.default.string(),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
async function getTasksByFilter({ client, query, limit, cursor, }) {
|
|
56
|
+
try {
|
|
57
|
+
const { results, nextCursor } = await client.getTasksByFilter({
|
|
58
|
+
query,
|
|
59
|
+
cursor,
|
|
60
|
+
limit,
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
tasks: results.map(mapTask),
|
|
64
|
+
nextCursor,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const parsedError = ErrorSchema.safeParse(error);
|
|
69
|
+
if (!parsedError.success) {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
const { responseData } = parsedError.data;
|
|
73
|
+
if (responseData.errorTag === "INVALID_SEARCH_QUERY") {
|
|
74
|
+
throw new Error(`Invalid filter query: ${query}`);
|
|
75
|
+
}
|
|
76
|
+
throw new Error(`${responseData.error} (tag: ${responseData.errorTag}, code: ${responseData.errorCode})`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subtasksListForParentTask = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
parentId: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.describe("The ID of the parent task to get subtasks for."),
|
|
11
|
+
limit: zod_1.z
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.min(1)
|
|
15
|
+
.max(50)
|
|
16
|
+
.default(10)
|
|
17
|
+
.describe("The maximum number of subtasks to return."),
|
|
18
|
+
cursor: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("The cursor to get the next page of subtasks (from previous call)."),
|
|
22
|
+
};
|
|
23
|
+
const subtasksListForParentTask = {
|
|
24
|
+
name: "subtasks-list-for-parent-task",
|
|
25
|
+
description: "List subtasks for a given parent task.",
|
|
26
|
+
parameters: ArgsSchema,
|
|
27
|
+
async execute(args, client) {
|
|
28
|
+
const { parentId, limit, cursor } = args;
|
|
29
|
+
const { results, nextCursor } = await client.getTasks({
|
|
30
|
+
parentId,
|
|
31
|
+
limit,
|
|
32
|
+
cursor: cursor ?? null,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
tasks: results.map(shared_js_1.mapTask),
|
|
36
|
+
nextCursor,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.subtasksListForParentTask = subtasksListForParentTask;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksAddMultiple = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const TaskSchema = zod_1.z.object({
|
|
7
|
+
content: zod_1.z.string().min(1).describe("The content of the task to create."),
|
|
8
|
+
description: zod_1.z.string().optional().describe("The description of the task."),
|
|
9
|
+
priority: zod_1.z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(4)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("The priority of the task (1-4)."),
|
|
16
|
+
dueString: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("The due date for the task, in natural language."),
|
|
20
|
+
});
|
|
21
|
+
const ArgsSchema = {
|
|
22
|
+
projectId: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("The project ID to add the tasks to."),
|
|
26
|
+
sectionId: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("The section ID to add the tasks to."),
|
|
30
|
+
parentId: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("The parent task ID (for subtasks)."),
|
|
34
|
+
tasks: zod_1.z.array(TaskSchema).min(1).describe("The array of tasks to add."),
|
|
35
|
+
};
|
|
36
|
+
const tasksAddMultiple = {
|
|
37
|
+
name: "tasks-add-multiple",
|
|
38
|
+
description: "Add one or more tasks to a project, section, or parent.",
|
|
39
|
+
parameters: ArgsSchema,
|
|
40
|
+
async execute(args, client) {
|
|
41
|
+
const { projectId, sectionId, parentId, tasks } = args;
|
|
42
|
+
const newTasks = [];
|
|
43
|
+
for (const task of tasks) {
|
|
44
|
+
const taskArgs = { ...task, projectId, sectionId, parentId };
|
|
45
|
+
newTasks.push(await client.addTask(taskArgs));
|
|
46
|
+
}
|
|
47
|
+
return newTasks.map(shared_js_1.mapTask);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
exports.tasksAddMultiple = tasksAddMultiple;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksListByDate = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const shared_js_1 = require("./shared.js");
|
|
7
|
+
const ArgsSchema = {
|
|
8
|
+
startDate: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(/^(\d{4}-\d{2}-\d{2}|today)$/)
|
|
11
|
+
.describe("The start date to get the tasks for. Format: YYYY-MM-DD or 'today'."),
|
|
12
|
+
daysCount: zod_1.z
|
|
13
|
+
.number()
|
|
14
|
+
.int()
|
|
15
|
+
.min(1)
|
|
16
|
+
.max(30)
|
|
17
|
+
.default(1)
|
|
18
|
+
.describe("The number of days to get the tasks for, starting from the start date."),
|
|
19
|
+
limit: zod_1.z
|
|
20
|
+
.number()
|
|
21
|
+
.int()
|
|
22
|
+
.min(1)
|
|
23
|
+
.max(50)
|
|
24
|
+
.default(10)
|
|
25
|
+
.describe("The maximum number of tasks to return."),
|
|
26
|
+
cursor: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
30
|
+
};
|
|
31
|
+
const tasksListByDate = {
|
|
32
|
+
name: "tasks-list-by-date",
|
|
33
|
+
description: "Get tasks by date range.",
|
|
34
|
+
parameters: ArgsSchema,
|
|
35
|
+
async execute(args, client) {
|
|
36
|
+
const startDate = args.startDate === "today"
|
|
37
|
+
? (0, date_fns_1.formatISO)(new Date(), { representation: "date" })
|
|
38
|
+
: args.startDate;
|
|
39
|
+
const endDate = (0, date_fns_1.addDays)(startDate, args.daysCount + 1);
|
|
40
|
+
const endDateStr = (0, date_fns_1.formatISO)(endDate, { representation: "date" });
|
|
41
|
+
const query = `(due after: ${startDate} | due: ${startDate}) & due before: ${endDateStr}`;
|
|
42
|
+
return await (0, shared_js_1.getTasksByFilter)({
|
|
43
|
+
client,
|
|
44
|
+
query,
|
|
45
|
+
cursor: args.cursor,
|
|
46
|
+
limit: args.limit,
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
exports.tasksListByDate = tasksListByDate;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksListForProject = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
projectId: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.describe("The ID of the project to get tasks for."),
|
|
11
|
+
limit: zod_1.z
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.min(1)
|
|
15
|
+
.max(50)
|
|
16
|
+
.default(10)
|
|
17
|
+
.describe("The maximum number of tasks to return."),
|
|
18
|
+
cursor: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
22
|
+
};
|
|
23
|
+
const tasksListForProject = {
|
|
24
|
+
name: "tasks-list-for-project",
|
|
25
|
+
description: "Get tasks by project ID.",
|
|
26
|
+
parameters: ArgsSchema,
|
|
27
|
+
async execute(args, client) {
|
|
28
|
+
const { projectId, limit, cursor } = args;
|
|
29
|
+
const { results, nextCursor } = await client.getTasks({
|
|
30
|
+
projectId,
|
|
31
|
+
limit,
|
|
32
|
+
cursor: cursor ?? null,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
tasks: results.map(shared_js_1.mapTask),
|
|
36
|
+
nextCursor,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.tasksListForProject = tasksListForProject;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksCompleteMultiple = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ArgsSchema = {
|
|
6
|
+
ids: zod_1.z
|
|
7
|
+
.array(zod_1.z.string().min(1))
|
|
8
|
+
.min(1)
|
|
9
|
+
.describe("The IDs of the tasks to complete."),
|
|
10
|
+
};
|
|
11
|
+
const tasksCompleteMultiple = {
|
|
12
|
+
name: "tasks-complete-multiple",
|
|
13
|
+
description: "Complete one or more tasks by their IDs.",
|
|
14
|
+
parameters: ArgsSchema,
|
|
15
|
+
async execute(args, client) {
|
|
16
|
+
const completed = [];
|
|
17
|
+
for (const id of args.ids) {
|
|
18
|
+
try {
|
|
19
|
+
await client.closeTask(id);
|
|
20
|
+
completed.push(id);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Ignore errors for individual tasks, continue with others
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { success: true, completed };
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
exports.tasksCompleteMultiple = tasksCompleteMultiple;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksDeleteOne = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ArgsSchema = {
|
|
6
|
+
id: zod_1.z.string().min(1).describe("The ID of the task to delete."),
|
|
7
|
+
};
|
|
8
|
+
const tasksDeleteOne = {
|
|
9
|
+
name: "tasks-delete-one",
|
|
10
|
+
description: "Delete a task by its ID.",
|
|
11
|
+
parameters: ArgsSchema,
|
|
12
|
+
async execute(args, client) {
|
|
13
|
+
await client.deleteTask(args.id);
|
|
14
|
+
return { success: true };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
exports.tasksDeleteOne = tasksDeleteOne;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksListForSection = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
sectionId: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.describe("The ID of the section to get tasks for."),
|
|
11
|
+
limit: zod_1.z
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.min(1)
|
|
15
|
+
.max(50)
|
|
16
|
+
.default(10)
|
|
17
|
+
.describe("The maximum number of tasks to return."),
|
|
18
|
+
cursor: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("The cursor to get the next page of tasks (from previous call)."),
|
|
22
|
+
};
|
|
23
|
+
const tasksListForSection = {
|
|
24
|
+
name: "tasks-list-for-section",
|
|
25
|
+
description: "List tasks for a given section.",
|
|
26
|
+
parameters: ArgsSchema,
|
|
27
|
+
async execute(args, client) {
|
|
28
|
+
const { sectionId, limit, cursor } = args;
|
|
29
|
+
const { results, nextCursor } = await client.getTasks({
|
|
30
|
+
sectionId,
|
|
31
|
+
limit,
|
|
32
|
+
cursor: cursor ?? null,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
tasks: results.map(shared_js_1.mapTask),
|
|
36
|
+
nextCursor,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
exports.tasksListForSection = tasksListForSection;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksListOverdue = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
limit: zod_1.z
|
|
8
|
+
.number()
|
|
9
|
+
.int()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(50)
|
|
12
|
+
.default(10)
|
|
13
|
+
.describe("The maximum number of overdue tasks to return."),
|
|
14
|
+
cursor: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("The cursor to get the next page of overdue tasks (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
18
|
+
};
|
|
19
|
+
const tasksListOverdue = {
|
|
20
|
+
name: "tasks-list-overdue",
|
|
21
|
+
description: "Get overdue tasks.",
|
|
22
|
+
parameters: ArgsSchema,
|
|
23
|
+
async execute(args, client) {
|
|
24
|
+
return await (0, shared_js_1.getTasksByFilter)({
|
|
25
|
+
client,
|
|
26
|
+
query: "overdue",
|
|
27
|
+
cursor: args.cursor,
|
|
28
|
+
limit: args.limit,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
exports.tasksListOverdue = tasksListOverdue;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksOrganizeMultiple = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const TaskUpdateSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string().min(1).describe("The ID of the task to update."),
|
|
7
|
+
projectId: zod_1.z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe("The new project ID for the task."),
|
|
11
|
+
sectionId: zod_1.z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("The new section ID for the task."),
|
|
15
|
+
parentId: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("The new parent task ID (for subtasks)."),
|
|
19
|
+
order: zod_1.z
|
|
20
|
+
.number()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("The new order of the task within its parent/section."),
|
|
23
|
+
});
|
|
24
|
+
const ArgsSchema = {
|
|
25
|
+
tasks: zod_1.z
|
|
26
|
+
.array(TaskUpdateSchema)
|
|
27
|
+
.min(1)
|
|
28
|
+
.describe("Array of task updates to apply."),
|
|
29
|
+
};
|
|
30
|
+
const tasksOrganizeMultiple = {
|
|
31
|
+
name: "tasks-organize-multiple",
|
|
32
|
+
description: "Organize multiple tasks (move, reorder, etc.) in bulk.",
|
|
33
|
+
parameters: ArgsSchema,
|
|
34
|
+
async execute(args, client) {
|
|
35
|
+
const results = [];
|
|
36
|
+
for (const update of args.tasks) {
|
|
37
|
+
const { id, ...updateArgs } = update;
|
|
38
|
+
results.push(await client.updateTask(id, updateArgs));
|
|
39
|
+
}
|
|
40
|
+
return results;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.tasksOrganizeMultiple = tasksOrganizeMultiple;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksSearch = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_js_1 = require("./shared.js");
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
searchText: zod_1.z.string().min(1).describe("The text to search for in tasks."),
|
|
8
|
+
limit: zod_1.z
|
|
9
|
+
.number()
|
|
10
|
+
.int()
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(50)
|
|
13
|
+
.default(10)
|
|
14
|
+
.describe("The maximum number of tasks to return."),
|
|
15
|
+
cursor: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("The cursor to get the next page of tasks (cursor is obtained from the previous call to this tool, with the same parameters)."),
|
|
19
|
+
};
|
|
20
|
+
const tasksSearch = {
|
|
21
|
+
name: "tasks-search",
|
|
22
|
+
description: "Search tasks by text using Todoist's filter query.",
|
|
23
|
+
parameters: ArgsSchema,
|
|
24
|
+
async execute(args, client) {
|
|
25
|
+
return await (0, shared_js_1.getTasksByFilter)({
|
|
26
|
+
client,
|
|
27
|
+
query: `search: ${args.searchText}`,
|
|
28
|
+
cursor: args.cursor,
|
|
29
|
+
limit: args.limit,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
exports.tasksSearch = tasksSearch;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tasksUpdateOne = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ArgsSchema = {
|
|
6
|
+
id: zod_1.z.string().min(1).describe("The ID of the task to update."),
|
|
7
|
+
content: zod_1.z.string().optional().describe("The new content of the task."),
|
|
8
|
+
description: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("The new description of the task."),
|
|
12
|
+
projectId: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("The new project ID for the task."),
|
|
16
|
+
sectionId: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("The new section ID for the task."),
|
|
20
|
+
parentId: zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("The new parent task ID (for subtasks)."),
|
|
24
|
+
priority: zod_1.z
|
|
25
|
+
.number()
|
|
26
|
+
.int()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(4)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("The new priority of the task (1-4)."),
|
|
31
|
+
dueString: zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("The new due date for the task, in natural language (e.g., 'tomorrow at 5pm')."),
|
|
35
|
+
};
|
|
36
|
+
const tasksUpdateOne = {
|
|
37
|
+
name: "tasks-update-one",
|
|
38
|
+
description: "Update an existing task with new values.",
|
|
39
|
+
parameters: ArgsSchema,
|
|
40
|
+
async execute(args, client) {
|
|
41
|
+
const { id, ...updateArgs } = args;
|
|
42
|
+
return await client.updateTask(id, updateArgs);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
exports.tasksUpdateOne = tasksUpdateOne;
|