@doist/todoist-ai 0.1.3 → 1.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.
Files changed (179) hide show
  1. package/README.md +27 -0
  2. package/dist/{esm/index.d.ts → index.d.ts} +34 -34
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +74 -0
  5. package/dist/main.d.ts.map +1 -0
  6. package/dist/{cjs/main.js → main.js} +7 -7
  7. package/dist/{types/mcp-helpers.d.ts → mcp-helpers.d.ts} +5 -4
  8. package/dist/mcp-helpers.d.ts.map +1 -0
  9. package/dist/{cjs/mcp-helpers.js → mcp-helpers.js} +5 -7
  10. package/dist/mcp-server.d.ts +13 -0
  11. package/dist/mcp-server.d.ts.map +1 -0
  12. package/dist/mcp-server.js +69 -0
  13. package/dist/{types/todoist-tool.d.ts → todoist-tool.d.ts} +3 -2
  14. package/dist/todoist-tool.d.ts.map +1 -0
  15. package/dist/{types/tools → tools}/account-overview.d.ts +2 -1
  16. package/dist/tools/account-overview.d.ts.map +1 -0
  17. package/dist/{cjs/tools → tools}/account-overview.js +12 -11
  18. package/dist/{esm/tools → tools}/project-overview.d.ts +2 -2
  19. package/dist/tools/project-overview.d.ts.map +1 -0
  20. package/dist/{cjs/tools → tools}/project-overview.js +9 -12
  21. package/dist/{esm/tools → tools}/projects-add-one.d.ts +1 -1
  22. package/dist/tools/projects-add-one.d.ts.map +1 -0
  23. package/dist/{cjs/tools → tools}/projects-add-one.js +5 -5
  24. package/dist/{types/tools → tools}/projects-delete-one.d.ts +2 -1
  25. package/dist/tools/projects-delete-one.d.ts.map +1 -0
  26. package/dist/{cjs/tools → tools}/projects-delete-one.js +3 -3
  27. package/dist/{esm/tools → tools}/projects-list.d.ts +2 -2
  28. package/dist/tools/projects-list.d.ts.map +1 -0
  29. package/dist/{cjs/tools → tools}/projects-list.js +4 -4
  30. package/dist/{esm/tools → tools}/projects-search.d.ts +1 -1
  31. package/dist/tools/projects-search.d.ts.map +1 -0
  32. package/dist/{cjs/tools → tools}/projects-search.js +7 -7
  33. package/dist/{types/tools → tools}/projects-update-one.d.ts +4 -3
  34. package/dist/tools/projects-update-one.d.ts.map +1 -0
  35. package/dist/{cjs/tools → tools}/projects-update-one.js +3 -3
  36. package/dist/{types/tools → tools}/sections-add-one.d.ts +2 -1
  37. package/dist/tools/sections-add-one.d.ts.map +1 -0
  38. package/dist/{cjs/tools → tools}/sections-add-one.js +4 -7
  39. package/dist/{esm/tools → tools}/sections-delete-one.d.ts +1 -1
  40. package/dist/tools/sections-delete-one.d.ts.map +1 -0
  41. package/dist/{cjs/tools → tools}/sections-delete-one.js +3 -3
  42. package/dist/{types/tools → tools}/sections-search.d.ts +2 -1
  43. package/dist/tools/sections-search.d.ts.map +1 -0
  44. package/dist/{cjs/tools → tools}/sections-search.js +4 -7
  45. package/dist/{esm/tools → tools}/sections-update-one.d.ts +2 -2
  46. package/dist/tools/sections-update-one.d.ts.map +1 -0
  47. package/dist/{cjs/tools → tools}/sections-update-one.js +3 -3
  48. package/dist/{types/tools → tools}/shared.d.ts +5 -1
  49. package/dist/tools/shared.d.ts.map +1 -0
  50. package/dist/{cjs/tools → tools}/shared.js +11 -3
  51. package/dist/tools/shared.test.d.ts +2 -0
  52. package/dist/tools/shared.test.d.ts.map +1 -0
  53. package/dist/tools/shared.test.js +135 -0
  54. package/dist/{types/tools → tools}/subtasks-list-for-parent-task.d.ts +3 -2
  55. package/dist/tools/subtasks-list-for-parent-task.d.ts.map +1 -0
  56. package/dist/{cjs/tools → tools}/subtasks-list-for-parent-task.js +7 -10
  57. package/dist/{types/tools → tools}/tasks-add-multiple.d.ts +3 -2
  58. package/dist/tools/tasks-add-multiple.d.ts.map +1 -0
  59. package/dist/tools/tasks-add-multiple.js +32 -0
  60. package/dist/{types/tools → tools}/tasks-complete-multiple.d.ts +2 -1
  61. package/dist/tools/tasks-complete-multiple.d.ts.map +1 -0
  62. package/dist/{cjs/tools → tools}/tasks-complete-multiple.js +3 -6
  63. package/dist/{types/tools → tools}/tasks-delete-one.d.ts +2 -1
  64. package/dist/tools/tasks-delete-one.d.ts.map +1 -0
  65. package/dist/{cjs/tools → tools}/tasks-delete-one.js +3 -3
  66. package/dist/{types/tools/tasks-by-date-range.d.ts → tools/tasks-list-by-date.d.ts} +2 -1
  67. package/dist/tools/tasks-list-by-date.d.ts.map +1 -0
  68. package/dist/{cjs/tools/tasks-by-date-range.js → tools/tasks-list-by-date.js} +10 -10
  69. package/dist/{types/tools/tasks-by-project.d.ts → tools/tasks-list-for-project.d.ts} +2 -1
  70. package/dist/tools/tasks-list-for-project.d.ts.map +1 -0
  71. package/dist/{cjs/tools/tasks-by-project.js → tools/tasks-list-for-project.js} +7 -10
  72. package/dist/{esm/tools → tools}/tasks-list-for-section.d.ts +1 -1
  73. package/dist/tools/tasks-list-for-section.d.ts.map +1 -0
  74. package/dist/{cjs/tools → tools}/tasks-list-for-section.js +7 -10
  75. package/dist/{types/tools → tools}/tasks-list-overdue.d.ts +2 -1
  76. package/dist/tools/tasks-list-overdue.d.ts.map +1 -0
  77. package/dist/{cjs/tools → tools}/tasks-list-overdue.js +7 -7
  78. package/dist/{esm/tools → tools}/tasks-organize-multiple.d.ts +4 -4
  79. package/dist/tools/tasks-organize-multiple.d.ts.map +1 -0
  80. package/dist/tools/tasks-organize-multiple.js +28 -0
  81. package/dist/{types/tools → tools}/tasks-search.d.ts +2 -1
  82. package/dist/tools/tasks-search.d.ts.map +1 -0
  83. package/dist/{cjs/tools → tools}/tasks-search.js +6 -6
  84. package/dist/{esm/tools → tools}/tasks-update-one.d.ts +3 -3
  85. package/dist/tools/tasks-update-one.d.ts.map +1 -0
  86. package/dist/tools/tasks-update-one.js +33 -0
  87. package/package.json +54 -76
  88. package/dist/cjs/index.js +0 -74
  89. package/dist/cjs/mcp-server.js +0 -68
  90. package/dist/cjs/tools/tasks-add-multiple.js +0 -50
  91. package/dist/cjs/tools/tasks-organize-multiple.js +0 -43
  92. package/dist/cjs/tools/tasks-update-one.js +0 -45
  93. package/dist/esm/index.d.ts.map +0 -1
  94. package/dist/esm/index.js +0 -49
  95. package/dist/esm/main.d.ts.map +0 -1
  96. package/dist/esm/main.js +0 -23
  97. package/dist/esm/mcp-helpers.d.ts +0 -13
  98. package/dist/esm/mcp-helpers.d.ts.map +0 -1
  99. package/dist/esm/mcp-helpers.js +0 -52
  100. package/dist/esm/mcp-server.d.ts +0 -11
  101. package/dist/esm/mcp-server.d.ts.map +0 -1
  102. package/dist/esm/mcp-server.js +0 -66
  103. package/dist/esm/todoist-tool.d.ts +0 -35
  104. package/dist/esm/todoist-tool.d.ts.map +0 -1
  105. package/dist/esm/todoist-tool.js +0 -1
  106. package/dist/esm/tools/account-overview.d.ts +0 -9
  107. package/dist/esm/tools/account-overview.d.ts.map +0 -1
  108. package/dist/esm/tools/account-overview.js +0 -94
  109. package/dist/esm/tools/project-overview.d.ts.map +0 -1
  110. package/dist/esm/tools/project-overview.js +0 -107
  111. package/dist/esm/tools/projects-add-one.d.ts.map +0 -1
  112. package/dist/esm/tools/projects-add-one.js +0 -15
  113. package/dist/esm/tools/projects-delete-one.d.ts +0 -15
  114. package/dist/esm/tools/projects-delete-one.d.ts.map +0 -1
  115. package/dist/esm/tools/projects-delete-one.js +0 -14
  116. package/dist/esm/tools/projects-list.d.ts.map +0 -1
  117. package/dist/esm/tools/projects-list.js +0 -30
  118. package/dist/esm/tools/projects-search.d.ts.map +0 -1
  119. package/dist/esm/tools/projects-search.js +0 -39
  120. package/dist/esm/tools/projects-update-one.d.ts +0 -15
  121. package/dist/esm/tools/projects-update-one.d.ts.map +0 -1
  122. package/dist/esm/tools/projects-update-one.js +0 -16
  123. package/dist/esm/tools/sections-add-one.d.ts +0 -15
  124. package/dist/esm/tools/sections-add-one.d.ts.map +0 -1
  125. package/dist/esm/tools/sections-add-one.js +0 -21
  126. package/dist/esm/tools/sections-delete-one.d.ts.map +0 -1
  127. package/dist/esm/tools/sections-delete-one.js +0 -14
  128. package/dist/esm/tools/sections-search.d.ts +0 -18
  129. package/dist/esm/tools/sections-search.d.ts.map +0 -1
  130. package/dist/esm/tools/sections-search.js +0 -30
  131. package/dist/esm/tools/sections-update-one.d.ts.map +0 -1
  132. package/dist/esm/tools/sections-update-one.js +0 -16
  133. package/dist/esm/tools/shared.d.ts +0 -55
  134. package/dist/esm/tools/shared.d.ts.map +0 -1
  135. package/dist/esm/tools/shared.js +0 -71
  136. package/dist/esm/tools/subtasks-list-for-parent-task.d.ts +0 -31
  137. package/dist/esm/tools/subtasks-list-for-parent-task.d.ts.map +0 -1
  138. package/dist/esm/tools/subtasks-list-for-parent-task.js +0 -37
  139. package/dist/esm/tools/tasks-add-multiple.d.ts +0 -50
  140. package/dist/esm/tools/tasks-add-multiple.d.ts.map +0 -1
  141. package/dist/esm/tools/tasks-add-multiple.js +0 -47
  142. package/dist/esm/tools/tasks-by-date-range.d.ts +0 -33
  143. package/dist/esm/tools/tasks-by-date-range.d.ts.map +0 -1
  144. package/dist/esm/tools/tasks-by-date-range.js +0 -47
  145. package/dist/esm/tools/tasks-by-project.d.ts +0 -31
  146. package/dist/esm/tools/tasks-by-project.d.ts.map +0 -1
  147. package/dist/esm/tools/tasks-by-project.js +0 -37
  148. package/dist/esm/tools/tasks-complete-multiple.d.ts +0 -16
  149. package/dist/esm/tools/tasks-complete-multiple.d.ts.map +0 -1
  150. package/dist/esm/tools/tasks-complete-multiple.js +0 -26
  151. package/dist/esm/tools/tasks-delete-one.d.ts +0 -15
  152. package/dist/esm/tools/tasks-delete-one.d.ts.map +0 -1
  153. package/dist/esm/tools/tasks-delete-one.js +0 -14
  154. package/dist/esm/tools/tasks-list-for-section.d.ts.map +0 -1
  155. package/dist/esm/tools/tasks-list-for-section.js +0 -37
  156. package/dist/esm/tools/tasks-list-overdue.d.ts +0 -29
  157. package/dist/esm/tools/tasks-list-overdue.d.ts.map +0 -1
  158. package/dist/esm/tools/tasks-list-overdue.js +0 -29
  159. package/dist/esm/tools/tasks-organize-multiple.d.ts.map +0 -1
  160. package/dist/esm/tools/tasks-organize-multiple.js +0 -40
  161. package/dist/esm/tools/tasks-search.d.ts +0 -31
  162. package/dist/esm/tools/tasks-search.d.ts.map +0 -1
  163. package/dist/esm/tools/tasks-search.js +0 -30
  164. package/dist/esm/tools/tasks-update-one.d.ts.map +0 -1
  165. package/dist/esm/tools/tasks-update-one.js +0 -42
  166. package/dist/types/index.d.ts +0 -476
  167. package/dist/types/main.d.ts +0 -1
  168. package/dist/types/mcp-server.d.ts +0 -10
  169. package/dist/types/tools/project-overview.d.ts +0 -13
  170. package/dist/types/tools/projects-add-one.d.ts +0 -21
  171. package/dist/types/tools/projects-list.d.ts +0 -17
  172. package/dist/types/tools/projects-search.d.ts +0 -28
  173. package/dist/types/tools/sections-delete-one.d.ts +0 -14
  174. package/dist/types/tools/sections-update-one.d.ts +0 -14
  175. package/dist/types/tools/tasks-list-for-section.d.ts +0 -30
  176. package/dist/types/tools/tasks-organize-multiple.d.ts +0 -36
  177. package/dist/types/tools/tasks-update-one.d.ts +0 -26
  178. /package/dist/{esm/main.d.ts → main.d.ts} +0 -0
  179. /package/dist/{cjs/todoist-tool.js → todoist-tool.js} +0 -0
@@ -1,94 +0,0 @@
1
- const ArgsSchema = {};
2
- function buildProjectTree(projects) {
3
- // Sort projects by childOrder, then build a tree
4
- const byId = {};
5
- for (const p of projects) {
6
- byId[p.id] = {
7
- ...p,
8
- children: [],
9
- childOrder: p.childOrder ?? 0,
10
- };
11
- }
12
- const roots = [];
13
- for (const p of projects) {
14
- const current = byId[p.id];
15
- if (!current)
16
- continue;
17
- if (p.parentId) {
18
- const parent = byId[p.parentId];
19
- if (parent) {
20
- parent.children.push(current);
21
- }
22
- else {
23
- roots.push(current);
24
- }
25
- }
26
- else {
27
- roots.push(current);
28
- }
29
- }
30
- function sortTree(nodes) {
31
- nodes.sort((a, b) => a.childOrder - b.childOrder);
32
- for (const n of nodes) {
33
- sortTree(n.children);
34
- }
35
- }
36
- sortTree(roots);
37
- return roots;
38
- }
39
- async function getSectionsByProject(client, projectIds) {
40
- const result = {};
41
- await Promise.all(projectIds.map(async (projectId) => {
42
- const { results } = await client.getSections({ projectId });
43
- result[projectId] = results;
44
- }));
45
- return result;
46
- }
47
- function renderProjectMarkdown(project, sectionsByProject, indent = "") {
48
- const lines = [];
49
- lines.push(`${indent}- Project: ${project.name} (id=${project.id})`);
50
- const sections = sectionsByProject[project.id] || [];
51
- for (const section of sections) {
52
- lines.push(`${indent} - Section: ${section.name} (id=${section.id})`);
53
- }
54
- for (const child of project.children) {
55
- lines.push(...renderProjectMarkdown(child, sectionsByProject, `${indent} `));
56
- }
57
- return lines;
58
- }
59
- const accountOverview = {
60
- name: "account-overview",
61
- description: "Get a Markdown overview of all projects (with hierarchy and sections) and the inbox project. Useful in almost any context before engaging with Todoist further.",
62
- parameters: ArgsSchema,
63
- async execute(_args, client) {
64
- const { results: projects } = await client.getProjects({});
65
- const inbox = projects.find((p) => p.isInboxProject === true);
66
- const nonInbox = projects.filter((p) => p.isInboxProject !== true);
67
- const tree = buildProjectTree(nonInbox);
68
- const allProjectIds = projects.map((p) => p.id);
69
- const sectionsByProject = await getSectionsByProject(client, allProjectIds);
70
- const lines = ["# Personal Projects", ""];
71
- if (inbox) {
72
- lines.push(`- Inbox Project: ${inbox.name} (id=${inbox.id})`);
73
- for (const section of sectionsByProject[inbox.id] || []) {
74
- lines.push(` - Section: ${section.name} (id=${section.id})`);
75
- }
76
- }
77
- if (tree.length) {
78
- for (const project of tree) {
79
- lines.push(...renderProjectMarkdown(project, sectionsByProject));
80
- }
81
- }
82
- else {
83
- lines.push("_No projects found._");
84
- }
85
- lines.push("");
86
- // Add explanation about nesting if there are nested projects
87
- const hasNested = tree.some((p) => p.children.length > 0);
88
- if (hasNested) {
89
- lines.push("_Note: Indentation indicates that a project is a sub-project of the one above it. This allows for organizing projects hierarchically, with parent projects containing related sub-projects._", "");
90
- }
91
- return lines.join("\n");
92
- },
93
- };
94
- export { accountOverview };
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-overview.d.ts","sourceRoot":"","sources":["../../../src/tools/project-overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,UAAU,EACV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8ExB,QAAA,MAAM,eAAe;;;;;;;;;CA4CqB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,107 +0,0 @@
1
- import { z } from "zod";
2
- import { mapTask } from "./shared.js";
3
- const ArgsSchema = {
4
- projectId: z
5
- .string()
6
- .min(1)
7
- .describe("The ID of the project to get an overview for."),
8
- };
9
- function buildTaskTree(tasks) {
10
- const byId = {};
11
- for (const task of tasks) {
12
- byId[task.id] = { ...task, children: [] };
13
- }
14
- const roots = [];
15
- for (const task of tasks) {
16
- const node = byId[task.id];
17
- if (!node)
18
- continue;
19
- if (!task.parentId) {
20
- roots.push(node);
21
- continue;
22
- }
23
- const parent = byId[task.parentId];
24
- if (parent) {
25
- parent.children.push(node);
26
- }
27
- else {
28
- roots.push(node);
29
- }
30
- }
31
- return roots;
32
- }
33
- function renderTaskTreeMarkdown(tasks, indent = "") {
34
- const lines = [];
35
- for (const task of tasks) {
36
- const idPart = `id=${task.id}`;
37
- const duePart = task.dueDate ? `; due=${task.dueDate}` : "";
38
- const contentPart = `; content=${task.content}`;
39
- lines.push(`${indent}- ${idPart}${duePart}${contentPart}`);
40
- if (task.children.length > 0) {
41
- lines.push(...renderTaskTreeMarkdown(task.children, `${indent} `));
42
- }
43
- }
44
- return lines;
45
- }
46
- async function getAllTasksForProject(client, projectId) {
47
- let allTasks = [];
48
- let cursor = undefined;
49
- do {
50
- const { results, nextCursor } = await client.getTasks({
51
- projectId,
52
- limit: 50,
53
- cursor: cursor ?? undefined,
54
- });
55
- allTasks = allTasks.concat(results.map(mapTask));
56
- cursor = nextCursor ?? undefined;
57
- } while (cursor);
58
- return allTasks;
59
- }
60
- async function getProjectSections(client, projectId) {
61
- const { results } = await client.getSections({ projectId });
62
- return results;
63
- }
64
- const projectOverview = {
65
- name: "project-overview",
66
- description: "Get a Markdown overview of a single project, including its sections and all tasks. Tasks are grouped by section, with tasks not in any section listed first. Each task is listed as '- id=TASKID; due=YYYY-MM-DD; content=TASK CONTENT' (omit due if not present). Subtasks are nested as indented list items.",
67
- parameters: ArgsSchema,
68
- async execute(args, client) {
69
- const { projectId } = args;
70
- const project = await client.getProject(projectId);
71
- const sections = await getProjectSections(client, projectId);
72
- const allTasks = await getAllTasksForProject(client, projectId);
73
- // Group tasks by sectionId
74
- const tasksBySection = {};
75
- for (const section of sections) {
76
- tasksBySection[section.id] = [];
77
- }
78
- const tasksWithoutSection = [];
79
- for (const task of allTasks) {
80
- if (task.sectionId && tasksBySection[task.sectionId]) {
81
- // biome-ignore lint/style/noNonNullAssertion: the "if" above ensures that it is defined
82
- tasksBySection[task.sectionId].push(task);
83
- }
84
- else {
85
- tasksWithoutSection.push(task);
86
- }
87
- }
88
- const lines = [`# ${project.name}`];
89
- if (tasksWithoutSection.length > 0) {
90
- lines.push("");
91
- const tree = buildTaskTree(tasksWithoutSection);
92
- lines.push(...renderTaskTreeMarkdown(tree));
93
- }
94
- for (const section of sections) {
95
- lines.push("");
96
- lines.push(`## ${section.name}`);
97
- const sectionTasks = tasksBySection[section.id];
98
- if (!sectionTasks?.length) {
99
- continue;
100
- }
101
- const tree = buildTaskTree(sectionTasks);
102
- lines.push(...renderTaskTreeMarkdown(tree));
103
- }
104
- return lines.join("\n");
105
- },
106
- };
107
- export { projectOverview };
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-add-one.d.ts","sourceRoot":"","sources":["../../../src/tools/projects-add-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;CAQsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- import { mapProject } from "./shared.js";
3
- const ArgsSchema = {
4
- name: z.string().min(1).describe("The name of the project to add."),
5
- };
6
- const projectsAddOne = {
7
- name: "projects-add-one",
8
- description: "Add a new project.",
9
- parameters: ArgsSchema,
10
- async execute(args, client) {
11
- const project = await client.addProject({ name: args.name });
12
- return mapProject(project);
13
- },
14
- };
15
- export { projectsAddOne };
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- declare const projectsDeleteOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- id: z.ZodString;
7
- };
8
- execute(args: {
9
- id: string;
10
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
11
- success: boolean;
12
- }>;
13
- };
14
- export { projectsDeleteOne };
15
- //# sourceMappingURL=projects-delete-one.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-delete-one.d.ts","sourceRoot":"","sources":["../../../src/tools/projects-delete-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CAQmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- id: z.string().min(1).describe("The ID of the project to delete."),
4
- };
5
- const projectsDeleteOne = {
6
- name: "projects-delete-one",
7
- description: "Delete a project by its ID.",
8
- parameters: ArgsSchema,
9
- async execute(args, client) {
10
- await client.deleteProject(args.id);
11
- return { success: true };
12
- },
13
- };
14
- export { projectsDeleteOne };
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-list.d.ts","sourceRoot":"","sources":["../../../src/tools/projects-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;CAcwB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,30 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- limit: z
4
- .number()
5
- .int()
6
- .min(1)
7
- .max(100)
8
- .default(50)
9
- .describe("The maximum number of projects to return."),
10
- cursor: z
11
- .string()
12
- .optional()
13
- .describe("The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."),
14
- };
15
- const projectsList = {
16
- name: "projects-list",
17
- description: "List all projects for the user.",
18
- parameters: ArgsSchema,
19
- async execute(args, client) {
20
- const { results, nextCursor } = await client.getProjects({
21
- limit: args.limit,
22
- cursor: args.cursor ?? null,
23
- });
24
- return {
25
- projects: results,
26
- nextCursor,
27
- };
28
- },
29
- };
30
- export { projectsList };
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-search.d.ts","sourceRoot":"","sources":["../../../src/tools/projects-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAoBsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,39 +0,0 @@
1
- import { z } from "zod";
2
- import { mapProject } from "./shared.js";
3
- const ArgsSchema = {
4
- search: z
5
- .string()
6
- .optional()
7
- .describe("Search for a project by name (partial and case insensitive match). If omitted, all projects are returned."),
8
- limit: z
9
- .number()
10
- .int()
11
- .min(1)
12
- .max(100)
13
- .default(50)
14
- .describe("The maximum number of projects to return."),
15
- cursor: z
16
- .string()
17
- .optional()
18
- .describe("The cursor to get the next page of projects (cursor is obtained from the previous call to this tool, with the same parameters)."),
19
- };
20
- const projectsSearch = {
21
- name: "projects-search",
22
- description: "Search for projects by name or other criteria.",
23
- parameters: ArgsSchema,
24
- async execute(args, client) {
25
- const { results, nextCursor } = await client.getProjects({
26
- limit: args.limit,
27
- cursor: args.cursor ?? null,
28
- });
29
- const searchLower = args.search ? args.search.toLowerCase() : undefined;
30
- const filtered = searchLower
31
- ? results.filter((project) => project.name.toLowerCase().includes(searchLower))
32
- : results;
33
- return {
34
- projects: filtered.map(mapProject),
35
- nextCursor,
36
- };
37
- },
38
- };
39
- export { projectsSearch };
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- declare const projectsUpdateOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- id: z.ZodString;
7
- name: z.ZodString;
8
- };
9
- execute(args: {
10
- name: string;
11
- id: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Project>;
13
- };
14
- export { projectsUpdateOne };
15
- //# sourceMappingURL=projects-update-one.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"projects-update-one.d.ts","sourceRoot":"","sources":["../../../src/tools/projects-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CASmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- id: z.string().min(1).describe("The ID of the project to update."),
4
- name: z.string().min(1).describe("The new name for the project."),
5
- };
6
- const projectsUpdateOne = {
7
- name: "projects-update-one",
8
- description: "Update a project's name by its ID.",
9
- parameters: ArgsSchema,
10
- async execute(args, client) {
11
- const { id, name } = args;
12
- const project = await client.updateProject(id, { name });
13
- return project;
14
- },
15
- };
16
- export { projectsUpdateOne };
@@ -1,15 +0,0 @@
1
- import { z } from "zod";
2
- declare const sectionsAddOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- name: z.ZodString;
7
- projectId: z.ZodString;
8
- };
9
- execute(args: {
10
- name: string;
11
- projectId: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").Section>;
13
- };
14
- export { sectionsAddOne };
15
- //# sourceMappingURL=sections-add-one.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sections-add-one.d.ts","sourceRoot":"","sources":["../../../src/tools/sections-add-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,cAAc;;;;;;;;;;;CAWsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,21 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- name: z.string().min(1).describe("The name of the section to add."),
4
- projectId: z
5
- .string()
6
- .min(1)
7
- .describe("The ID of the project to add the section to."),
8
- };
9
- const sectionsAddOne = {
10
- name: "sections-add-one",
11
- description: "Add a new section to a project.",
12
- parameters: ArgsSchema,
13
- async execute(args, client) {
14
- const section = await client.addSection({
15
- name: args.name,
16
- projectId: args.projectId,
17
- });
18
- return section;
19
- },
20
- };
21
- export { sectionsAddOne };
@@ -1 +0,0 @@
1
- {"version":3,"file":"sections-delete-one.d.ts","sourceRoot":"","sources":["../../../src/tools/sections-delete-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CAQmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,14 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- id: z.string().min(1).describe("The ID of the section to delete."),
4
- };
5
- const sectionsDeleteOne = {
6
- name: "sections-delete-one",
7
- description: "Delete a section by its ID.",
8
- parameters: ArgsSchema,
9
- async execute(args, client) {
10
- await client.deleteSection(args.id);
11
- return { success: true };
12
- },
13
- };
14
- export { sectionsDeleteOne };
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- declare const sectionsSearch: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- projectId: z.ZodString;
7
- search: z.ZodOptional<z.ZodString>;
8
- };
9
- execute(args: {
10
- projectId: string;
11
- search?: string | undefined;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
13
- id: string;
14
- name: string;
15
- }[]>;
16
- };
17
- export { sectionsSearch };
18
- //# sourceMappingURL=sections-search.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sections-search.d.ts","sourceRoot":"","sources":["../../../src/tools/sections-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;CAmBsB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,30 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- projectId: z
4
- .string()
5
- .min(1)
6
- .describe("The ID of the project to search sections in."),
7
- search: z
8
- .string()
9
- .optional()
10
- .describe("Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned."),
11
- };
12
- const sectionsSearch = {
13
- name: "sections-search",
14
- description: "Search for sections by name or other criteria in a project.",
15
- parameters: ArgsSchema,
16
- async execute(args, client) {
17
- const { results } = await client.getSections({
18
- projectId: args.projectId,
19
- });
20
- const searchLower = args.search ? args.search.toLowerCase() : undefined;
21
- const filtered = searchLower
22
- ? results.filter((section) => section.name.toLowerCase().includes(searchLower))
23
- : results;
24
- return filtered.map((section) => ({
25
- id: section.id,
26
- name: section.name,
27
- }));
28
- },
29
- };
30
- export { sectionsSearch };
@@ -1 +0,0 @@
1
- {"version":3,"file":"sections-update-one.d.ts","sourceRoot":"","sources":["../../../src/tools/sections-update-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,QAAA,MAAM,iBAAiB;;;;;;;;;;;CASmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
- const ArgsSchema = {
3
- id: z.string().min(1).describe("The ID of the section to update."),
4
- name: z.string().min(1).describe("The new name for the section."),
5
- };
6
- const sectionsUpdateOne = {
7
- name: "sections-update-one",
8
- description: "Update a section's name by its ID.",
9
- parameters: ArgsSchema,
10
- async execute(args, client) {
11
- const { id, name } = args;
12
- const section = await client.updateSection(id, { name });
13
- return section;
14
- },
15
- };
16
- export { sectionsUpdateOne };
@@ -1,55 +0,0 @@
1
- import { type Project, type Task, type TodoistApi } from "@doist/todoist-api-typescript";
2
- /**
3
- * Map a single Todoist task to a more structured format, for LLM consumption.
4
- * @param task - The task to map.
5
- * @returns The mapped task.
6
- */
7
- declare function mapTask(task: Task): {
8
- id: string;
9
- content: string;
10
- description: string;
11
- dueDate: string | undefined;
12
- recurring: string | boolean;
13
- priority: number;
14
- projectId: string;
15
- sectionId: string | null;
16
- parentId: string | null;
17
- labels: string[];
18
- };
19
- /**
20
- * Map a single Todoist project to a more structured format, for LLM consumption.
21
- * @param project - The project to map.
22
- * @returns The mapped project.
23
- */
24
- declare function mapProject(project: Project): {
25
- id: string;
26
- name: string;
27
- color: string;
28
- isFavorite: boolean;
29
- isShared: boolean;
30
- parentId: string | null;
31
- inboxProject: boolean;
32
- viewStyle: string;
33
- };
34
- declare function getTasksByFilter({ client, query, limit, cursor, }: {
35
- client: TodoistApi;
36
- query: string;
37
- limit: number | undefined;
38
- cursor: string | undefined;
39
- }): Promise<{
40
- tasks: {
41
- id: string;
42
- content: string;
43
- description: string;
44
- dueDate: string | undefined;
45
- recurring: string | boolean;
46
- priority: number;
47
- projectId: string;
48
- sectionId: string | null;
49
- parentId: string | null;
50
- labels: string[];
51
- }[];
52
- nextCursor: string | null;
53
- }>;
54
- export { getTasksByFilter, mapTask, mapProject };
55
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/tools/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,UAAU,EAEf,MAAM,+BAA+B,CAAC;AAGvC;;;;GAIG;AACH,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI;;;;;;;;;;;EAc1B;AAED;;;;GAIG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,OAAO;;;;;;;;;EAWnC;AAWD,iBAAe,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAM,GACN,EAAE;IACF,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;;;;;;;;;;;;;;GAyBA;AAED,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,71 +0,0 @@
1
- import { getSanitizedContent, } from "@doist/todoist-api-typescript";
2
- import z from "zod";
3
- /**
4
- * Map a single Todoist task to a more structured format, for LLM consumption.
5
- * @param task - The task to map.
6
- * @returns The mapped task.
7
- */
8
- function mapTask(task) {
9
- return {
10
- id: task.id,
11
- content: getSanitizedContent(task.content),
12
- description: getSanitizedContent(task.description),
13
- dueDate: task.due?.date,
14
- recurring: task.due?.isRecurring && task.due.string ? task.due.string : false,
15
- priority: task.priority,
16
- projectId: task.projectId,
17
- sectionId: task.sectionId,
18
- parentId: task.parentId,
19
- labels: task.labels,
20
- };
21
- }
22
- /**
23
- * Map a single Todoist project to a more structured format, for LLM consumption.
24
- * @param project - The project to map.
25
- * @returns The mapped project.
26
- */
27
- function mapProject(project) {
28
- return {
29
- id: project.id,
30
- name: project.name,
31
- color: project.color,
32
- isFavorite: project.isFavorite,
33
- isShared: project.isShared,
34
- parentId: project.parentId ?? null,
35
- inboxProject: project.isInboxProject ?? false,
36
- viewStyle: project.viewStyle,
37
- };
38
- }
39
- const ErrorSchema = z.object({
40
- httpStatusCode: z.number(),
41
- responseData: z.object({
42
- error: z.string(),
43
- errorCode: z.number(),
44
- errorTag: z.string(),
45
- }),
46
- });
47
- async function getTasksByFilter({ client, query, limit, cursor, }) {
48
- try {
49
- const { results, nextCursor } = await client.getTasksByFilter({
50
- query,
51
- cursor,
52
- limit,
53
- });
54
- return {
55
- tasks: results.map(mapTask),
56
- nextCursor,
57
- };
58
- }
59
- catch (error) {
60
- const parsedError = ErrorSchema.safeParse(error);
61
- if (!parsedError.success) {
62
- throw error;
63
- }
64
- const { responseData } = parsedError.data;
65
- if (responseData.errorTag === "INVALID_SEARCH_QUERY") {
66
- throw new Error(`Invalid filter query: ${query}`);
67
- }
68
- throw new Error(`${responseData.error} (tag: ${responseData.errorTag}, code: ${responseData.errorCode})`);
69
- }
70
- }
71
- export { getTasksByFilter, mapTask, mapProject };