@doist/todoist-ai 1.1.0 → 2.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 (80) hide show
  1. package/README.md +1 -22
  2. package/dist/index.d.ts +53 -198
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +19 -45
  5. package/dist/mcp-helpers.d.ts +8 -1
  6. package/dist/mcp-helpers.d.ts.map +1 -1
  7. package/dist/mcp-helpers.js +1 -0
  8. package/dist/mcp-server.d.ts.map +1 -1
  9. package/dist/mcp-server.js +10 -28
  10. package/dist/{tools/shared.d.ts → tool-helpers.d.ts} +1 -1
  11. package/dist/tool-helpers.d.ts.map +1 -0
  12. package/dist/tool-helpers.test.d.ts +2 -0
  13. package/dist/tool-helpers.test.d.ts.map +1 -0
  14. package/dist/{tools/shared.test.js → tool-helpers.test.js} +9 -9
  15. package/dist/tools/{tasks-delete-one.d.ts → delete-one.d.ts} +5 -3
  16. package/dist/tools/delete-one.d.ts.map +1 -0
  17. package/dist/tools/delete-one.js +28 -0
  18. package/dist/tools/{project-overview.d.ts → overview.d.ts} +5 -5
  19. package/dist/tools/overview.d.ts.map +1 -0
  20. package/dist/tools/overview.js +205 -0
  21. package/dist/tools/projects-list.d.ts +12 -1
  22. package/dist/tools/projects-list.d.ts.map +1 -1
  23. package/dist/tools/projects-list.js +11 -2
  24. package/dist/tools/{projects-add-one.d.ts → projects-manage.d.ts} +6 -4
  25. package/dist/tools/projects-manage.d.ts.map +1 -0
  26. package/dist/tools/projects-manage.js +29 -0
  27. package/dist/tools/sections-manage.d.ts +23 -0
  28. package/dist/tools/sections-manage.d.ts.map +1 -0
  29. package/dist/tools/sections-manage.js +40 -0
  30. package/dist/tools/tasks-add-multiple.js +2 -2
  31. package/dist/tools/tasks-list-by-date.d.ts.map +1 -1
  32. package/dist/tools/tasks-list-by-date.js +18 -12
  33. package/dist/tools/tasks-list-completed.js +2 -2
  34. package/dist/tools/{tasks-list-for-project.d.ts → tasks-list-for-container.d.ts} +7 -5
  35. package/dist/tools/tasks-list-for-container.d.ts.map +1 -0
  36. package/dist/tools/tasks-list-for-container.js +51 -0
  37. package/dist/tools/tasks-search.js +2 -2
  38. package/package.json +15 -4
  39. package/dist/tools/account-overview.d.ts +0 -9
  40. package/dist/tools/account-overview.d.ts.map +0 -1
  41. package/dist/tools/account-overview.js +0 -98
  42. package/dist/tools/project-overview.d.ts.map +0 -1
  43. package/dist/tools/project-overview.js +0 -107
  44. package/dist/tools/projects-add-one.d.ts.map +0 -1
  45. package/dist/tools/projects-add-one.js +0 -18
  46. package/dist/tools/projects-delete-one.d.ts +0 -15
  47. package/dist/tools/projects-delete-one.d.ts.map +0 -1
  48. package/dist/tools/projects-delete-one.js +0 -17
  49. package/dist/tools/projects-search.d.ts +0 -29
  50. package/dist/tools/projects-search.d.ts.map +0 -1
  51. package/dist/tools/projects-search.js +0 -42
  52. package/dist/tools/projects-update-one.d.ts +0 -15
  53. package/dist/tools/projects-update-one.d.ts.map +0 -1
  54. package/dist/tools/projects-update-one.js +0 -19
  55. package/dist/tools/sections-add-one.d.ts +0 -15
  56. package/dist/tools/sections-add-one.d.ts.map +0 -1
  57. package/dist/tools/sections-add-one.js +0 -21
  58. package/dist/tools/sections-delete-one.d.ts +0 -15
  59. package/dist/tools/sections-delete-one.d.ts.map +0 -1
  60. package/dist/tools/sections-delete-one.js +0 -17
  61. package/dist/tools/sections-update-one.d.ts +0 -15
  62. package/dist/tools/sections-update-one.d.ts.map +0 -1
  63. package/dist/tools/sections-update-one.js +0 -19
  64. package/dist/tools/shared.d.ts.map +0 -1
  65. package/dist/tools/shared.test.d.ts +0 -2
  66. package/dist/tools/shared.test.d.ts.map +0 -1
  67. package/dist/tools/subtasks-list-for-parent-task.d.ts +0 -31
  68. package/dist/tools/subtasks-list-for-parent-task.d.ts.map +0 -1
  69. package/dist/tools/subtasks-list-for-parent-task.js +0 -37
  70. package/dist/tools/tasks-delete-one.d.ts.map +0 -1
  71. package/dist/tools/tasks-delete-one.js +0 -17
  72. package/dist/tools/tasks-list-for-project.d.ts.map +0 -1
  73. package/dist/tools/tasks-list-for-project.js +0 -37
  74. package/dist/tools/tasks-list-for-section.d.ts +0 -31
  75. package/dist/tools/tasks-list-for-section.d.ts.map +0 -1
  76. package/dist/tools/tasks-list-for-section.js +0 -37
  77. package/dist/tools/tasks-list-overdue.d.ts +0 -29
  78. package/dist/tools/tasks-list-overdue.d.ts.map +0 -1
  79. package/dist/tools/tasks-list-overdue.js +0 -32
  80. /package/dist/{tools/shared.js → tool-helpers.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const shared_1 = require("./shared");
3
+ const tool_helpers_1 = require("./tool-helpers");
4
4
  describe('shared utilities', () => {
5
5
  describe('mapTask', () => {
6
6
  it('should map a basic task correctly', () => {
@@ -21,7 +21,7 @@ describe('shared utilities', () => {
21
21
  timezone: 'UTC',
22
22
  },
23
23
  };
24
- const result = (0, shared_1.mapTask)(mockTask);
24
+ const result = (0, tool_helpers_1.mapTask)(mockTask);
25
25
  expect(result).toEqual({
26
26
  id: '123',
27
27
  content: 'Test task',
@@ -53,7 +53,7 @@ describe('shared utilities', () => {
53
53
  timezone: 'UTC',
54
54
  },
55
55
  };
56
- const result = (0, shared_1.mapTask)(mockTask);
56
+ const result = (0, tool_helpers_1.mapTask)(mockTask);
57
57
  expect(result.recurring).toBe('every day');
58
58
  });
59
59
  });
@@ -69,7 +69,7 @@ describe('shared utilities', () => {
69
69
  inboxProject: false,
70
70
  viewStyle: 'list',
71
71
  };
72
- const result = (0, shared_1.mapProject)(mockPersonalProject);
72
+ const result = (0, tool_helpers_1.mapProject)(mockPersonalProject);
73
73
  expect(result).toEqual({
74
74
  id: 'proj-1',
75
75
  name: 'Personal Project',
@@ -90,7 +90,7 @@ describe('shared utilities', () => {
90
90
  isShared: true,
91
91
  viewStyle: 'board',
92
92
  };
93
- const result = (0, shared_1.mapProject)(mockWorkspaceProject);
93
+ const result = (0, tool_helpers_1.mapProject)(mockWorkspaceProject);
94
94
  expect(result).toEqual({
95
95
  id: 'proj-2',
96
96
  name: 'Workspace Project',
@@ -115,8 +115,8 @@ describe('shared utilities', () => {
115
115
  inboxProject: true,
116
116
  viewStyle: 'list',
117
117
  };
118
- expect((0, shared_1.isPersonalProject)(personalProject)).toBe(true);
119
- expect((0, shared_1.isWorkspaceProject)(personalProject)).toBe(false);
118
+ expect((0, tool_helpers_1.isPersonalProject)(personalProject)).toBe(true);
119
+ expect((0, tool_helpers_1.isWorkspaceProject)(personalProject)).toBe(false);
120
120
  });
121
121
  it('should correctly identify workspace projects', () => {
122
122
  const workspaceProject = {
@@ -128,8 +128,8 @@ describe('shared utilities', () => {
128
128
  viewStyle: 'board',
129
129
  accessLevel: 'admin',
130
130
  };
131
- expect((0, shared_1.isWorkspaceProject)(workspaceProject)).toBe(true);
132
- expect((0, shared_1.isPersonalProject)(workspaceProject)).toBe(false);
131
+ expect((0, tool_helpers_1.isWorkspaceProject)(workspaceProject)).toBe(true);
132
+ expect((0, tool_helpers_1.isPersonalProject)(workspaceProject)).toBe(false);
133
133
  });
134
134
  });
135
135
  });
@@ -1,15 +1,17 @@
1
1
  import { z } from 'zod';
2
- declare const tasksDeleteOne: {
2
+ declare const deleteOne: {
3
3
  name: string;
4
4
  description: string;
5
5
  parameters: {
6
+ type: z.ZodEnum<["project", "section", "task"]>;
6
7
  id: z.ZodString;
7
8
  };
8
9
  execute(args: {
10
+ type: "project" | "section" | "task";
9
11
  id: string;
10
12
  }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
11
13
  success: boolean;
12
14
  }>;
13
15
  };
14
- export { tasksDeleteOne };
15
- //# sourceMappingURL=tasks-delete-one.d.ts.map
16
+ export { deleteOne };
17
+ //# sourceMappingURL=delete-one.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-one.d.ts","sourceRoot":"","sources":["../../src/tools/delete-one.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,QAAA,MAAM,SAAS;;;;;;;;;;;;;CAkB2B,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteOne = void 0;
4
+ const zod_1 = require("zod");
5
+ const ArgsSchema = {
6
+ type: zod_1.z.enum(['project', 'section', 'task']).describe('The type of entity to delete.'),
7
+ id: zod_1.z.string().min(1).describe('The ID of the entity to delete.'),
8
+ };
9
+ const deleteOne = {
10
+ name: 'delete-one',
11
+ description: 'Delete a project, section, or task by its ID.',
12
+ parameters: ArgsSchema,
13
+ async execute(args, client) {
14
+ switch (args.type) {
15
+ case 'project':
16
+ await client.deleteProject(args.id);
17
+ break;
18
+ case 'section':
19
+ await client.deleteSection(args.id);
20
+ break;
21
+ case 'task':
22
+ await client.deleteTask(args.id);
23
+ break;
24
+ }
25
+ return { success: true };
26
+ },
27
+ };
28
+ exports.deleteOne = deleteOne;
@@ -1,14 +1,14 @@
1
1
  import type { TodoistApi } from '@doist/todoist-api-typescript';
2
2
  import { z } from 'zod';
3
- declare const projectOverview: {
3
+ declare const overview: {
4
4
  name: string;
5
5
  description: string;
6
6
  parameters: {
7
- projectId: z.ZodString;
7
+ projectId: z.ZodOptional<z.ZodString>;
8
8
  };
9
9
  execute(args: {
10
- projectId: string;
10
+ projectId?: string | undefined;
11
11
  }, client: TodoistApi): Promise<string>;
12
12
  };
13
- export { projectOverview };
14
- //# sourceMappingURL=project-overview.d.ts.map
13
+ export { overview };
14
+ //# sourceMappingURL=overview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../src/tools/overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA+NvB,QAAA,MAAM,QAAQ;;;;;;;;;CAW4B,CAAA;AAE1C,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.overview = void 0;
4
+ const zod_1 = require("zod");
5
+ const tool_helpers_1 = require("../tool-helpers");
6
+ const ArgsSchema = {
7
+ projectId: zod_1.z
8
+ .string()
9
+ .min(1)
10
+ .optional()
11
+ .describe('Optional project ID. If provided, shows detailed overview of that project. If omitted, shows overview of all projects.'),
12
+ };
13
+ function buildProjectTree(projects) {
14
+ // Sort projects by childOrder, then build a tree
15
+ const byId = {};
16
+ for (const p of projects) {
17
+ byId[p.id] = {
18
+ ...p,
19
+ children: [],
20
+ childOrder: p.childOrder ?? 0,
21
+ };
22
+ }
23
+ const roots = [];
24
+ for (const p of projects) {
25
+ const current = byId[p.id];
26
+ if (!current)
27
+ continue;
28
+ if ((0, tool_helpers_1.isPersonalProject)(p) && p.parentId) {
29
+ const parent = byId[p.parentId];
30
+ if (parent) {
31
+ parent.children.push(current);
32
+ }
33
+ else {
34
+ roots.push(current);
35
+ }
36
+ }
37
+ else {
38
+ roots.push(current);
39
+ }
40
+ }
41
+ function sortTree(nodes) {
42
+ nodes.sort((a, b) => a.childOrder - b.childOrder);
43
+ for (const n of nodes) {
44
+ sortTree(n.children);
45
+ }
46
+ }
47
+ sortTree(roots);
48
+ return roots;
49
+ }
50
+ async function getSectionsByProject(client, projectIds) {
51
+ const result = {};
52
+ await Promise.all(projectIds.map(async (projectId) => {
53
+ const { results } = await client.getSections({ projectId });
54
+ result[projectId] = results;
55
+ }));
56
+ return result;
57
+ }
58
+ function renderProjectMarkdown(project, sectionsByProject, indent = '') {
59
+ const lines = [];
60
+ lines.push(`${indent}- Project: ${project.name} (id=${project.id})`);
61
+ const sections = sectionsByProject[project.id] || [];
62
+ for (const section of sections) {
63
+ lines.push(`${indent} - Section: ${section.name} (id=${section.id})`);
64
+ }
65
+ for (const child of project.children) {
66
+ lines.push(...renderProjectMarkdown(child, sectionsByProject, `${indent} `));
67
+ }
68
+ return lines;
69
+ }
70
+ function buildTaskTree(tasks) {
71
+ const byId = {};
72
+ for (const task of tasks) {
73
+ byId[task.id] = { ...task, children: [] };
74
+ }
75
+ const roots = [];
76
+ for (const task of tasks) {
77
+ const node = byId[task.id];
78
+ if (!node)
79
+ continue;
80
+ if (!task.parentId) {
81
+ roots.push(node);
82
+ continue;
83
+ }
84
+ const parent = byId[task.parentId];
85
+ if (parent) {
86
+ parent.children.push(node);
87
+ }
88
+ else {
89
+ roots.push(node);
90
+ }
91
+ }
92
+ return roots;
93
+ }
94
+ function renderTaskTreeMarkdown(tasks, indent = '') {
95
+ const lines = [];
96
+ for (const task of tasks) {
97
+ const idPart = `id=${task.id}`;
98
+ const duePart = task.dueDate ? `; due=${task.dueDate}` : '';
99
+ const contentPart = `; content=${task.content}`;
100
+ lines.push(`${indent}- ${idPart}${duePart}${contentPart}`);
101
+ if (task.children.length > 0) {
102
+ lines.push(...renderTaskTreeMarkdown(task.children, `${indent} `));
103
+ }
104
+ }
105
+ return lines;
106
+ }
107
+ async function getAllTasksForProject(client, projectId) {
108
+ let allTasks = [];
109
+ let cursor = undefined;
110
+ do {
111
+ const { results, nextCursor } = await client.getTasks({
112
+ projectId,
113
+ limit: 50,
114
+ cursor: cursor ?? undefined,
115
+ });
116
+ allTasks = allTasks.concat(results.map(tool_helpers_1.mapTask));
117
+ cursor = nextCursor ?? undefined;
118
+ } while (cursor);
119
+ return allTasks;
120
+ }
121
+ async function getProjectSections(client, projectId) {
122
+ const { results } = await client.getSections({ projectId });
123
+ return results;
124
+ }
125
+ // Account overview implementation
126
+ async function generateAccountOverview(client) {
127
+ const { results: projects } = await client.getProjects({});
128
+ const inbox = projects.find((p) => (0, tool_helpers_1.isPersonalProject)(p) && p.inboxProject === true);
129
+ const nonInbox = projects.filter((p) => !(0, tool_helpers_1.isPersonalProject)(p) || p.inboxProject !== true);
130
+ const tree = buildProjectTree(nonInbox);
131
+ const allProjectIds = projects.map((p) => p.id);
132
+ const sectionsByProject = await getSectionsByProject(client, allProjectIds);
133
+ const lines = ['# Personal Projects', ''];
134
+ if (inbox) {
135
+ lines.push(`- Inbox Project: ${inbox.name} (id=${inbox.id})`);
136
+ for (const section of sectionsByProject[inbox.id] || []) {
137
+ lines.push(` - Section: ${section.name} (id=${section.id})`);
138
+ }
139
+ }
140
+ if (tree.length) {
141
+ for (const project of tree) {
142
+ lines.push(...renderProjectMarkdown(project, sectionsByProject));
143
+ }
144
+ }
145
+ else {
146
+ lines.push('_No projects found._');
147
+ }
148
+ lines.push('');
149
+ // Add explanation about nesting if there are nested projects
150
+ const hasNested = tree.some((p) => p.children.length > 0);
151
+ if (hasNested) {
152
+ 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._', '');
153
+ }
154
+ return lines.join('\n');
155
+ }
156
+ // Project overview implementation
157
+ async function generateProjectOverview(client, projectId) {
158
+ const project = await client.getProject(projectId);
159
+ const sections = await getProjectSections(client, projectId);
160
+ const allTasks = await getAllTasksForProject(client, projectId);
161
+ // Group tasks by sectionId
162
+ const tasksBySection = {};
163
+ for (const section of sections) {
164
+ tasksBySection[section.id] = [];
165
+ }
166
+ const tasksWithoutSection = [];
167
+ for (const task of allTasks) {
168
+ if (task.sectionId && tasksBySection[task.sectionId]) {
169
+ // biome-ignore lint/style/noNonNullAssertion: the "if" above ensures that it is defined
170
+ tasksBySection[task.sectionId].push(task);
171
+ }
172
+ else {
173
+ tasksWithoutSection.push(task);
174
+ }
175
+ }
176
+ const lines = [`# ${project.name}`];
177
+ if (tasksWithoutSection.length > 0) {
178
+ lines.push('');
179
+ const tree = buildTaskTree(tasksWithoutSection);
180
+ lines.push(...renderTaskTreeMarkdown(tree));
181
+ }
182
+ for (const section of sections) {
183
+ lines.push('');
184
+ lines.push(`## ${section.name}`);
185
+ const sectionTasks = tasksBySection[section.id];
186
+ if (!sectionTasks?.length) {
187
+ continue;
188
+ }
189
+ const tree = buildTaskTree(sectionTasks);
190
+ lines.push(...renderTaskTreeMarkdown(tree));
191
+ }
192
+ return lines.join('\n');
193
+ }
194
+ const overview = {
195
+ name: 'overview',
196
+ description: 'Get a Markdown overview. If no projectId is provided, shows all projects with hierarchy and sections (useful for navigation). If projectId is provided, shows detailed overview of that specific project including all tasks grouped by sections.',
197
+ parameters: ArgsSchema,
198
+ async execute(args, client) {
199
+ if (args.projectId) {
200
+ return await generateProjectOverview(client, args.projectId);
201
+ }
202
+ return await generateAccountOverview(client);
203
+ },
204
+ };
205
+ exports.overview = overview;
@@ -3,14 +3,25 @@ declare const projectsList: {
3
3
  name: string;
4
4
  description: string;
5
5
  parameters: {
6
+ search: z.ZodOptional<z.ZodString>;
6
7
  limit: z.ZodDefault<z.ZodNumber>;
7
8
  cursor: z.ZodOptional<z.ZodString>;
8
9
  };
9
10
  execute(args: {
10
11
  limit: number;
11
12
  cursor?: string | undefined;
13
+ search?: string | undefined;
12
14
  }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
13
- projects: (import("@doist/todoist-api-typescript").PersonalProject | import("@doist/todoist-api-typescript").WorkspaceProject)[];
15
+ projects: {
16
+ id: string;
17
+ name: string;
18
+ color: string;
19
+ isFavorite: boolean;
20
+ isShared: boolean;
21
+ parentId: string | null;
22
+ inboxProject: boolean;
23
+ viewStyle: string;
24
+ }[];
14
25
  nextCursor: string | null;
15
26
  }>;
16
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"projects-list.d.ts","sourceRoot":"","sources":["../../src/tools/projects-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;CAcwB,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"projects-list.d.ts","sourceRoot":"","sources":["../../src/tools/projects-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA0BvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAmBwB,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -2,7 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectsList = void 0;
4
4
  const zod_1 = require("zod");
5
+ const tool_helpers_1 = require("../tool-helpers");
5
6
  const ArgsSchema = {
7
+ search: zod_1.z
8
+ .string()
9
+ .optional()
10
+ .describe('Search for a project by name (partial and case insensitive match). If omitted, all projects are returned.'),
6
11
  limit: zod_1.z
7
12
  .number()
8
13
  .int()
@@ -17,15 +22,19 @@ const ArgsSchema = {
17
22
  };
18
23
  const projectsList = {
19
24
  name: 'projects-list',
20
- description: 'List all projects for the user.',
25
+ description: 'List all projects or search for projects by name. If search parameter is omitted, all projects are returned.',
21
26
  parameters: ArgsSchema,
22
27
  async execute(args, client) {
23
28
  const { results, nextCursor } = await client.getProjects({
24
29
  limit: args.limit,
25
30
  cursor: args.cursor ?? null,
26
31
  });
32
+ const searchLower = args.search ? args.search.toLowerCase() : undefined;
33
+ const filtered = searchLower
34
+ ? results.filter((project) => project.name.toLowerCase().includes(searchLower))
35
+ : results;
27
36
  return {
28
- projects: results,
37
+ projects: filtered.map(tool_helpers_1.mapProject),
29
38
  nextCursor,
30
39
  };
31
40
  },
@@ -1,13 +1,15 @@
1
1
  import { z } from 'zod';
2
- declare const projectsAddOne: {
2
+ declare const projectsManage: {
3
3
  name: string;
4
4
  description: string;
5
5
  parameters: {
6
+ id: z.ZodOptional<z.ZodString>;
6
7
  name: z.ZodString;
7
8
  };
8
9
  execute(args: {
9
10
  name: string;
10
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
11
+ id?: string | undefined;
12
+ }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").WorkspaceProject | {
11
13
  id: string;
12
14
  name: string;
13
15
  color: string;
@@ -18,5 +20,5 @@ declare const projectsAddOne: {
18
20
  viewStyle: string;
19
21
  }>;
20
22
  };
21
- export { projectsAddOne };
22
- //# sourceMappingURL=projects-add-one.d.ts.map
23
+ export { projectsManage };
24
+ //# sourceMappingURL=projects-manage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects-manage.d.ts","sourceRoot":"","sources":["../../src/tools/projects-manage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAevB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;CAgBsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectsManage = void 0;
4
+ const zod_1 = require("zod");
5
+ const tool_helpers_1 = require("../tool-helpers");
6
+ const ArgsSchema = {
7
+ id: zod_1.z
8
+ .string()
9
+ .min(1)
10
+ .optional()
11
+ .describe('The ID of the project to update. If provided, updates the project. If omitted, creates a new project.'),
12
+ name: zod_1.z.string().min(1).describe('The name of the project.'),
13
+ };
14
+ const projectsManage = {
15
+ name: 'projects-manage',
16
+ description: 'Add a new project or update an existing project. If id is provided, updates the project. If id is omitted, creates a new project.',
17
+ parameters: ArgsSchema,
18
+ async execute(args, client) {
19
+ if (args.id) {
20
+ // Update existing project
21
+ const project = await client.updateProject(args.id, { name: args.name });
22
+ return project;
23
+ }
24
+ // Create new project
25
+ const project = await client.addProject({ name: args.name });
26
+ return (0, tool_helpers_1.mapProject)(project);
27
+ },
28
+ };
29
+ exports.projectsManage = projectsManage;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ declare const sectionsManage: {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ id: z.ZodOptional<z.ZodString>;
7
+ name: z.ZodString;
8
+ projectId: z.ZodOptional<z.ZodString>;
9
+ };
10
+ execute(args: {
11
+ name: string;
12
+ id?: string | undefined;
13
+ projectId?: string | undefined;
14
+ }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
15
+ isError: boolean;
16
+ content: {
17
+ type: "text";
18
+ text: string;
19
+ }[];
20
+ } | import("@doist/todoist-api-typescript").Section>;
21
+ };
22
+ export { sectionsManage };
23
+ //# sourceMappingURL=sections-manage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections-manage.d.ts","sourceRoot":"","sources":["../../src/tools/sections-manage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAsBvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CA0BsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sectionsManage = void 0;
4
+ const zod_1 = require("zod");
5
+ const mcp_helpers_1 = require("../mcp-helpers");
6
+ const ArgsSchema = {
7
+ id: zod_1.z
8
+ .string()
9
+ .min(1)
10
+ .optional()
11
+ .describe('The ID of the section to update. If provided, updates the section. If omitted, creates a new section.'),
12
+ name: zod_1.z.string().min(1).describe('The name of the section.'),
13
+ projectId: zod_1.z
14
+ .string()
15
+ .min(1)
16
+ .optional()
17
+ .describe('The ID of the project to add the section to. Required when creating a new section (when id is not provided).'),
18
+ };
19
+ const sectionsManage = {
20
+ name: 'sections-manage',
21
+ description: 'Add a new section to a project or update an existing section. If id is provided, updates the section. If id is omitted, creates a new section (requires projectId).',
22
+ parameters: ArgsSchema,
23
+ async execute(args, client) {
24
+ if (args.id) {
25
+ // Update existing section
26
+ const section = await client.updateSection(args.id, { name: args.name });
27
+ return section;
28
+ }
29
+ // Create new section - projectId is required
30
+ if (!args.projectId) {
31
+ return (0, mcp_helpers_1.errorContent)('Error: projectId is required when creating a new section (when id is not provided).');
32
+ }
33
+ const section = await client.addSection({
34
+ name: args.name,
35
+ projectId: args.projectId,
36
+ });
37
+ return section;
38
+ },
39
+ };
40
+ exports.sectionsManage = sectionsManage;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tasksAddMultiple = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_1 = require("./shared");
5
+ const tool_helpers_1 = require("../tool-helpers");
6
6
  const TaskSchema = zod_1.z.object({
7
7
  content: zod_1.z.string().min(1).describe('The content of the task to create.'),
8
8
  description: zod_1.z.string().optional().describe('The description of the task.'),
@@ -26,7 +26,7 @@ const tasksAddMultiple = {
26
26
  const taskArgs = { ...task, projectId, sectionId, parentId };
27
27
  newTasks.push(await client.addTask(taskArgs));
28
28
  }
29
- return newTasks.map(shared_1.mapTask);
29
+ return newTasks.map(tool_helpers_1.mapTask);
30
30
  },
31
31
  };
32
32
  exports.tasksAddMultiple = tasksAddMultiple;
@@ -1 +1 @@
1
- {"version":3,"file":"tasks-list-by-date.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-list-by-date.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA+BvB,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBqB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3,"file":"tasks-list-by-date.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-list-by-date.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmCvB,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BqB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tasksListByDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
5
  const zod_1 = require("zod");
6
- const shared_1 = require("./shared");
6
+ const tool_helpers_1 = require("../tool-helpers");
7
7
  const ArgsSchema = {
8
8
  startDate: zod_1.z
9
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'."),
10
+ .regex(/^(\d{4}-\d{2}-\d{2}|today|overdue)$/)
11
+ .describe("The start date to get the tasks for. Format: YYYY-MM-DD, 'today', or 'overdue'."),
12
12
  daysCount: zod_1.z
13
13
  .number()
14
14
  .int()
15
15
  .min(1)
16
16
  .max(30)
17
17
  .default(1)
18
- .describe('The number of days to get the tasks for, starting from the start date.'),
18
+ .describe("The number of days to get the tasks for, starting from the start date. Ignored when startDate is 'overdue'."),
19
19
  limit: zod_1.z
20
20
  .number()
21
21
  .int()
@@ -30,16 +30,22 @@ const ArgsSchema = {
30
30
  };
31
31
  const tasksListByDate = {
32
32
  name: 'tasks-list-by-date',
33
- description: 'Get tasks by date range.',
33
+ description: "Get tasks by date range or overdue tasks. Use startDate 'overdue' for overdue tasks, or provide a date/date range.",
34
34
  parameters: ArgsSchema,
35
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_1.getTasksByFilter)({
36
+ let query;
37
+ if (args.startDate === 'overdue') {
38
+ query = 'overdue';
39
+ }
40
+ else {
41
+ const startDate = args.startDate === 'today'
42
+ ? (0, date_fns_1.formatISO)(new Date(), { representation: 'date' })
43
+ : args.startDate;
44
+ const endDate = (0, date_fns_1.addDays)(startDate, args.daysCount + 1);
45
+ const endDateStr = (0, date_fns_1.formatISO)(endDate, { representation: 'date' });
46
+ query = `(due after: ${startDate} | due: ${startDate}) & due before: ${endDateStr}`;
47
+ }
48
+ return await (0, tool_helpers_1.getTasksByFilter)({
43
49
  client,
44
50
  query,
45
51
  cursor: args.cursor,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tasksListCompleted = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_1 = require("./shared");
5
+ const tool_helpers_1 = require("../tool-helpers");
6
6
  const ArgsSchema = {
7
7
  getBy: zod_1.z
8
8
  .enum(['completion', 'due'])
@@ -44,7 +44,7 @@ const tasksListCompleted = {
44
44
  ? await client.getCompletedTasksByCompletionDate(rest)
45
45
  : await client.getCompletedTasksByDueDate(rest);
46
46
  return {
47
- tasks: items.map(shared_1.mapTask),
47
+ tasks: items.map(tool_helpers_1.mapTask),
48
48
  nextCursor,
49
49
  };
50
50
  },