@doist/todoist-ai 2.2.2 → 4.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 (202) hide show
  1. package/README.md +6 -14
  2. package/dist/index.d.ts +619 -250
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +45 -29
  5. package/dist/main.js +2 -1
  6. package/dist/mcp-helpers.d.ts +25 -3
  7. package/dist/mcp-helpers.d.ts.map +1 -1
  8. package/dist/mcp-helpers.js +37 -19
  9. package/dist/mcp-server.d.ts.map +1 -1
  10. package/dist/mcp-server.js +44 -28
  11. package/dist/tools/__tests__/add-comments.test.d.ts +2 -0
  12. package/dist/tools/__tests__/add-comments.test.d.ts.map +1 -0
  13. package/dist/tools/__tests__/add-comments.test.js +241 -0
  14. package/dist/tools/__tests__/add-projects.test.d.ts +2 -0
  15. package/dist/tools/__tests__/add-projects.test.d.ts.map +1 -0
  16. package/dist/tools/__tests__/add-projects.test.js +152 -0
  17. package/dist/tools/__tests__/add-sections.test.d.ts +2 -0
  18. package/dist/tools/__tests__/add-sections.test.d.ts.map +1 -0
  19. package/dist/tools/__tests__/add-sections.test.js +181 -0
  20. package/dist/tools/__tests__/add-tasks.test.d.ts +2 -0
  21. package/dist/tools/__tests__/add-tasks.test.d.ts.map +1 -0
  22. package/dist/tools/__tests__/{tasks-add-multiple.test.js → add-tasks.test.js} +89 -79
  23. package/dist/tools/__tests__/complete-tasks.test.d.ts +2 -0
  24. package/dist/tools/__tests__/complete-tasks.test.d.ts.map +1 -0
  25. package/dist/tools/__tests__/complete-tasks.test.js +206 -0
  26. package/dist/tools/__tests__/delete-object.test.d.ts +2 -0
  27. package/dist/tools/__tests__/delete-object.test.d.ts.map +1 -0
  28. package/dist/tools/__tests__/{delete-one.test.js → delete-object.test.js} +42 -22
  29. package/dist/tools/__tests__/find-comments.test.d.ts +2 -0
  30. package/dist/tools/__tests__/find-comments.test.d.ts.map +1 -0
  31. package/dist/tools/__tests__/find-comments.test.js +242 -0
  32. package/dist/tools/__tests__/find-completed-tasks.test.d.ts +2 -0
  33. package/dist/tools/__tests__/find-completed-tasks.test.d.ts.map +1 -0
  34. package/dist/tools/__tests__/{tasks-list-completed.test.js → find-completed-tasks.test.js} +13 -36
  35. package/dist/tools/__tests__/find-projects.test.d.ts +2 -0
  36. package/dist/tools/__tests__/find-projects.test.d.ts.map +1 -0
  37. package/dist/tools/__tests__/{projects-list.test.js → find-projects.test.js} +55 -39
  38. package/dist/tools/__tests__/find-sections.test.d.ts +2 -0
  39. package/dist/tools/__tests__/find-sections.test.d.ts.map +1 -0
  40. package/dist/tools/__tests__/{sections-search.test.js → find-sections.test.js} +64 -50
  41. package/dist/tools/__tests__/find-tasks-by-date.test.d.ts +2 -0
  42. package/dist/tools/__tests__/find-tasks-by-date.test.d.ts.map +1 -0
  43. package/dist/tools/__tests__/{tasks-list-by-date.test.js → find-tasks-by-date.test.js} +96 -14
  44. package/dist/tools/__tests__/find-tasks.test.d.ts +2 -0
  45. package/dist/tools/__tests__/find-tasks.test.d.ts.map +1 -0
  46. package/dist/tools/__tests__/find-tasks.test.js +334 -0
  47. package/dist/tools/__tests__/get-overview.test.d.ts +2 -0
  48. package/dist/tools/__tests__/get-overview.test.d.ts.map +1 -0
  49. package/dist/tools/__tests__/{overview.test.js → get-overview.test.js} +77 -13
  50. package/dist/tools/__tests__/update-comments.test.d.ts +2 -0
  51. package/dist/tools/__tests__/update-comments.test.d.ts.map +1 -0
  52. package/dist/tools/__tests__/update-comments.test.js +296 -0
  53. package/dist/tools/__tests__/update-projects.test.d.ts +2 -0
  54. package/dist/tools/__tests__/update-projects.test.d.ts.map +1 -0
  55. package/dist/tools/__tests__/update-projects.test.js +205 -0
  56. package/dist/tools/__tests__/update-sections.test.d.ts +2 -0
  57. package/dist/tools/__tests__/update-sections.test.d.ts.map +1 -0
  58. package/dist/tools/__tests__/update-sections.test.js +156 -0
  59. package/dist/tools/__tests__/update-tasks.test.d.ts +2 -0
  60. package/dist/tools/__tests__/update-tasks.test.d.ts.map +1 -0
  61. package/dist/tools/__tests__/update-tasks.test.js +645 -0
  62. package/dist/tools/add-comments.d.ts +51 -0
  63. package/dist/tools/add-comments.d.ts.map +1 -0
  64. package/dist/tools/add-comments.js +79 -0
  65. package/dist/tools/add-projects.d.ts +50 -0
  66. package/dist/tools/add-projects.d.ts.map +1 -0
  67. package/dist/tools/add-projects.js +59 -0
  68. package/dist/tools/add-sections.d.ts +46 -0
  69. package/dist/tools/add-sections.d.ts.map +1 -0
  70. package/dist/tools/add-sections.js +61 -0
  71. package/dist/tools/add-tasks.d.ts +82 -0
  72. package/dist/tools/add-tasks.d.ts.map +1 -0
  73. package/dist/tools/add-tasks.js +96 -0
  74. package/dist/tools/complete-tasks.d.ts +40 -0
  75. package/dist/tools/complete-tasks.d.ts.map +1 -0
  76. package/dist/tools/complete-tasks.js +68 -0
  77. package/dist/tools/delete-object.d.ts +38 -0
  78. package/dist/tools/delete-object.d.ts.map +1 -0
  79. package/dist/tools/delete-object.js +79 -0
  80. package/dist/tools/find-comments.d.ts +46 -0
  81. package/dist/tools/find-comments.d.ts.map +1 -0
  82. package/dist/tools/find-comments.js +143 -0
  83. package/dist/tools/find-completed-tasks.d.ts +74 -0
  84. package/dist/tools/find-completed-tasks.d.ts.map +1 -0
  85. package/dist/tools/find-completed-tasks.js +112 -0
  86. package/dist/tools/find-projects.d.ts +53 -0
  87. package/dist/tools/find-projects.d.ts.map +1 -0
  88. package/dist/tools/find-projects.js +101 -0
  89. package/dist/tools/find-sections.d.ts +42 -0
  90. package/dist/tools/find-sections.d.ts.map +1 -0
  91. package/dist/tools/find-sections.js +96 -0
  92. package/dist/tools/find-tasks-by-date.d.ts +59 -0
  93. package/dist/tools/find-tasks-by-date.d.ts.map +1 -0
  94. package/dist/tools/find-tasks-by-date.js +121 -0
  95. package/dist/tools/find-tasks.d.ts +65 -0
  96. package/dist/tools/find-tasks.d.ts.map +1 -0
  97. package/dist/tools/find-tasks.js +182 -0
  98. package/dist/tools/get-overview.d.ts +67 -0
  99. package/dist/tools/get-overview.d.ts.map +1 -0
  100. package/dist/tools/{overview.js → get-overview.js} +66 -19
  101. package/dist/tools/update-comments.d.ts +50 -0
  102. package/dist/tools/update-comments.d.ts.map +1 -0
  103. package/dist/tools/update-comments.js +82 -0
  104. package/dist/tools/update-projects.d.ts +59 -0
  105. package/dist/tools/update-projects.d.ts.map +1 -0
  106. package/dist/tools/update-projects.js +84 -0
  107. package/dist/tools/update-sections.d.ts +47 -0
  108. package/dist/tools/update-sections.d.ts.map +1 -0
  109. package/dist/tools/update-sections.js +70 -0
  110. package/dist/tools/update-tasks.d.ts +94 -0
  111. package/dist/tools/update-tasks.d.ts.map +1 -0
  112. package/dist/tools/update-tasks.js +120 -0
  113. package/dist/utils/constants.d.ts +39 -0
  114. package/dist/utils/constants.d.ts.map +1 -0
  115. package/dist/utils/constants.js +41 -0
  116. package/dist/utils/response-builders.d.ts +88 -0
  117. package/dist/utils/response-builders.d.ts.map +1 -0
  118. package/dist/utils/response-builders.js +202 -0
  119. package/dist/{tools → utils}/test-helpers.d.ts +16 -0
  120. package/dist/utils/test-helpers.d.ts.map +1 -0
  121. package/dist/{tools → utils}/test-helpers.js +51 -0
  122. package/dist/utils/tool-names.d.ts +28 -0
  123. package/dist/utils/tool-names.d.ts.map +1 -0
  124. package/dist/utils/tool-names.js +31 -0
  125. package/package.json +1 -1
  126. package/dist/tools/__tests__/delete-one.test.d.ts +0 -2
  127. package/dist/tools/__tests__/delete-one.test.d.ts.map +0 -1
  128. package/dist/tools/__tests__/overview.test.d.ts +0 -2
  129. package/dist/tools/__tests__/overview.test.d.ts.map +0 -1
  130. package/dist/tools/__tests__/projects-list.test.d.ts +0 -2
  131. package/dist/tools/__tests__/projects-list.test.d.ts.map +0 -1
  132. package/dist/tools/__tests__/projects-manage.test.d.ts +0 -2
  133. package/dist/tools/__tests__/projects-manage.test.d.ts.map +0 -1
  134. package/dist/tools/__tests__/projects-manage.test.js +0 -106
  135. package/dist/tools/__tests__/sections-manage.test.d.ts +0 -2
  136. package/dist/tools/__tests__/sections-manage.test.d.ts.map +0 -1
  137. package/dist/tools/__tests__/sections-manage.test.js +0 -138
  138. package/dist/tools/__tests__/sections-search.test.d.ts +0 -2
  139. package/dist/tools/__tests__/sections-search.test.d.ts.map +0 -1
  140. package/dist/tools/__tests__/tasks-add-multiple.test.d.ts +0 -2
  141. package/dist/tools/__tests__/tasks-add-multiple.test.d.ts.map +0 -1
  142. package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts +0 -2
  143. package/dist/tools/__tests__/tasks-complete-multiple.test.d.ts.map +0 -1
  144. package/dist/tools/__tests__/tasks-complete-multiple.test.js +0 -146
  145. package/dist/tools/__tests__/tasks-list-by-date.test.d.ts +0 -2
  146. package/dist/tools/__tests__/tasks-list-by-date.test.d.ts.map +0 -1
  147. package/dist/tools/__tests__/tasks-list-completed.test.d.ts +0 -2
  148. package/dist/tools/__tests__/tasks-list-completed.test.d.ts.map +0 -1
  149. package/dist/tools/__tests__/tasks-list-for-container.test.d.ts +0 -2
  150. package/dist/tools/__tests__/tasks-list-for-container.test.d.ts.map +0 -1
  151. package/dist/tools/__tests__/tasks-list-for-container.test.js +0 -232
  152. package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts +0 -2
  153. package/dist/tools/__tests__/tasks-organize-multiple.test.d.ts.map +0 -1
  154. package/dist/tools/__tests__/tasks-organize-multiple.test.js +0 -245
  155. package/dist/tools/__tests__/tasks-search.test.d.ts +0 -2
  156. package/dist/tools/__tests__/tasks-search.test.d.ts.map +0 -1
  157. package/dist/tools/__tests__/tasks-search.test.js +0 -106
  158. package/dist/tools/__tests__/tasks-update-one.test.d.ts +0 -2
  159. package/dist/tools/__tests__/tasks-update-one.test.d.ts.map +0 -1
  160. package/dist/tools/__tests__/tasks-update-one.test.js +0 -251
  161. package/dist/tools/delete-one.d.ts +0 -17
  162. package/dist/tools/delete-one.d.ts.map +0 -1
  163. package/dist/tools/delete-one.js +0 -25
  164. package/dist/tools/overview.d.ts +0 -14
  165. package/dist/tools/overview.d.ts.map +0 -1
  166. package/dist/tools/projects-list.d.ts +0 -29
  167. package/dist/tools/projects-list.d.ts.map +0 -1
  168. package/dist/tools/projects-list.js +0 -39
  169. package/dist/tools/projects-manage.d.ts +0 -24
  170. package/dist/tools/projects-manage.d.ts.map +0 -1
  171. package/dist/tools/projects-manage.js +0 -26
  172. package/dist/tools/sections-manage.d.ts +0 -23
  173. package/dist/tools/sections-manage.d.ts.map +0 -1
  174. package/dist/tools/sections-manage.js +0 -37
  175. package/dist/tools/sections-search.d.ts +0 -18
  176. package/dist/tools/sections-search.d.ts.map +0 -1
  177. package/dist/tools/sections-search.js +0 -27
  178. package/dist/tools/tasks-add-multiple.d.ts +0 -55
  179. package/dist/tools/tasks-add-multiple.d.ts.map +0 -1
  180. package/dist/tools/tasks-add-multiple.js +0 -52
  181. package/dist/tools/tasks-complete-multiple.d.ts +0 -16
  182. package/dist/tools/tasks-complete-multiple.d.ts.map +0 -1
  183. package/dist/tools/tasks-complete-multiple.js +0 -23
  184. package/dist/tools/tasks-list-by-date.d.ts +0 -34
  185. package/dist/tools/tasks-list-by-date.d.ts.map +0 -1
  186. package/dist/tools/tasks-list-by-date.js +0 -53
  187. package/dist/tools/tasks-list-completed.d.ts +0 -44
  188. package/dist/tools/tasks-list-completed.d.ts.map +0 -1
  189. package/dist/tools/tasks-list-completed.js +0 -49
  190. package/dist/tools/tasks-list-for-container.d.ts +0 -34
  191. package/dist/tools/tasks-list-for-container.d.ts.map +0 -1
  192. package/dist/tools/tasks-list-for-container.js +0 -48
  193. package/dist/tools/tasks-organize-multiple.d.ts +0 -37
  194. package/dist/tools/tasks-organize-multiple.d.ts.map +0 -1
  195. package/dist/tools/tasks-organize-multiple.js +0 -34
  196. package/dist/tools/tasks-search.d.ts +0 -32
  197. package/dist/tools/tasks-search.d.ts.map +0 -1
  198. package/dist/tools/tasks-search.js +0 -30
  199. package/dist/tools/tasks-update-one.d.ts +0 -29
  200. package/dist/tools/tasks-update-one.d.ts.map +0 -1
  201. package/dist/tools/tasks-update-one.js +0 -63
  202. package/dist/tools/test-helpers.d.ts.map +0 -1
@@ -1,251 +0,0 @@
1
- import { jest } from '@jest/globals';
2
- import { tasksUpdateOne } from '../tasks-update-one.js';
3
- import { createMockTask } from '../test-helpers.js';
4
- // Mock the Todoist API
5
- const mockTodoistApi = {
6
- updateTask: jest.fn(),
7
- moveTasks: jest.fn(),
8
- };
9
- describe('tasks-update-one tool', () => {
10
- beforeEach(() => {
11
- jest.clearAllMocks();
12
- });
13
- describe('updating task properties', () => {
14
- it('should update task content and description', async () => {
15
- // Mock API response extracted from recordings (Task type)
16
- const mockApiResponse = createMockTask({
17
- id: '8485093748',
18
- content: 'Updated task content',
19
- description: 'Updated task description',
20
- url: 'https://todoist.com/showTask?id=8485093748',
21
- addedAt: '2025-08-13T22:09:56.123456Z',
22
- });
23
- mockTodoistApi.updateTask.mockResolvedValue(mockApiResponse);
24
- const result = await tasksUpdateOne.execute({
25
- id: '8485093748',
26
- content: 'Updated task content',
27
- description: 'Updated task description',
28
- }, mockTodoistApi);
29
- // Verify API was called correctly
30
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093748', {
31
- content: 'Updated task content',
32
- description: 'Updated task description',
33
- });
34
- // Verify result matches API response
35
- expect(result).toEqual(mockApiResponse);
36
- });
37
- it('should update task priority and due date', async () => {
38
- const mockApiResponse = createMockTask({
39
- id: '8485093749',
40
- content: 'Original task content',
41
- labels: ['urgent'],
42
- priority: 3,
43
- url: 'https://todoist.com/showTask?id=8485093749',
44
- addedAt: '2025-08-13T22:09:56.123456Z',
45
- due: {
46
- date: '2025-08-20',
47
- isRecurring: false,
48
- lang: 'en',
49
- string: 'Aug 20',
50
- timezone: null,
51
- },
52
- });
53
- mockTodoistApi.updateTask.mockResolvedValue(mockApiResponse);
54
- const result = await tasksUpdateOne.execute({ id: '8485093749', priority: 3, dueString: 'Aug 20' }, mockTodoistApi);
55
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093749', {
56
- priority: 3,
57
- dueString: 'Aug 20',
58
- });
59
- expect(result).toEqual(mockApiResponse);
60
- });
61
- it('should move task to different project', async () => {
62
- const mockApiResponse = createMockTask({
63
- id: '8485093750',
64
- content: 'Task to move',
65
- projectId: 'new-project-id',
66
- url: 'https://todoist.com/showTask?id=8485093750',
67
- addedAt: '2025-08-13T22:09:56.123456Z',
68
- });
69
- mockTodoistApi.moveTasks.mockResolvedValue([mockApiResponse]);
70
- const result = await tasksUpdateOne.execute({ id: '8485093750', projectId: 'new-project-id' }, mockTodoistApi);
71
- expect(mockTodoistApi.moveTasks).toHaveBeenCalledWith(['8485093750'], {
72
- projectId: 'new-project-id',
73
- });
74
- expect(mockTodoistApi.updateTask).not.toHaveBeenCalled();
75
- expect(result).toEqual(mockApiResponse);
76
- });
77
- it('should update task parent (create subtask relationship)', async () => {
78
- const mockApiResponse = createMockTask({
79
- id: '8485093751',
80
- content: 'Subtask content',
81
- parentId: 'parent-task-123',
82
- url: 'https://todoist.com/showTask?id=8485093751',
83
- addedAt: '2025-08-13T22:09:56.123456Z',
84
- });
85
- mockTodoistApi.moveTasks.mockResolvedValue([mockApiResponse]);
86
- const result = await tasksUpdateOne.execute({ id: '8485093751', parentId: 'parent-task-123' }, mockTodoistApi);
87
- expect(mockTodoistApi.moveTasks).toHaveBeenCalledWith(['8485093751'], {
88
- parentId: 'parent-task-123',
89
- });
90
- expect(mockTodoistApi.updateTask).not.toHaveBeenCalled();
91
- expect(result).toEqual(mockApiResponse);
92
- });
93
- it('should move task and update properties at once', async () => {
94
- const movedTask = createMockTask({
95
- id: '8485093752',
96
- content: 'Task to move',
97
- projectId: 'different-project-id',
98
- });
99
- const updatedTask = createMockTask({
100
- id: '8485093752',
101
- content: 'Completely updated task',
102
- description: 'New description with details',
103
- priority: 4,
104
- projectId: 'different-project-id',
105
- url: 'https://todoist.com/showTask?id=8485093752',
106
- addedAt: '2025-08-13T22:09:56.123456Z',
107
- due: {
108
- date: '2025-08-25',
109
- isRecurring: true,
110
- lang: 'en',
111
- string: 'every Friday',
112
- timezone: null,
113
- },
114
- });
115
- mockTodoistApi.moveTasks.mockResolvedValue([movedTask]);
116
- mockTodoistApi.updateTask.mockResolvedValue(updatedTask);
117
- const result = await tasksUpdateOne.execute({
118
- id: '8485093752',
119
- content: 'Completely updated task',
120
- description: 'New description with details',
121
- priority: 4,
122
- dueString: 'every Friday',
123
- projectId: 'different-project-id',
124
- }, mockTodoistApi);
125
- // Should call moveTasks first for the projectId
126
- expect(mockTodoistApi.moveTasks).toHaveBeenCalledWith(['8485093752'], {
127
- projectId: 'different-project-id',
128
- });
129
- // Then call updateTask for the other properties
130
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093752', {
131
- content: 'Completely updated task',
132
- description: 'New description with details',
133
- priority: 4,
134
- dueString: 'every Friday',
135
- });
136
- expect(result).toEqual(updatedTask);
137
- });
138
- it('should update task duration', async () => {
139
- const mockApiResponse = createMockTask({
140
- id: '8485093753',
141
- content: 'Task with updated duration',
142
- duration: { amount: 150, unit: 'minute' },
143
- url: 'https://todoist.com/showTask?id=8485093753',
144
- addedAt: '2025-08-13T22:09:56.123456Z',
145
- });
146
- mockTodoistApi.updateTask.mockResolvedValue(mockApiResponse);
147
- const result = await tasksUpdateOne.execute({
148
- id: '8485093753',
149
- duration: '2h30m',
150
- }, mockTodoistApi);
151
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093753', {
152
- duration: 150,
153
- durationUnit: 'minute',
154
- });
155
- expect(result).toEqual(mockApiResponse);
156
- });
157
- it('should handle various duration formats', async () => {
158
- const mockApiResponse = createMockTask({
159
- id: '8485093754',
160
- content: 'Test task',
161
- duration: { amount: 120, unit: 'minute' },
162
- });
163
- mockTodoistApi.updateTask.mockResolvedValue(mockApiResponse);
164
- // Test different duration formats
165
- const testCases = [
166
- { input: '2h', expectedMinutes: 120 },
167
- { input: '90m', expectedMinutes: 90 },
168
- { input: '1.5h', expectedMinutes: 90 },
169
- { input: ' 2h 30m ', expectedMinutes: 150 },
170
- { input: '2H30M', expectedMinutes: 150 },
171
- ];
172
- for (const testCase of testCases) {
173
- mockTodoistApi.updateTask.mockClear();
174
- await tasksUpdateOne.execute({
175
- id: '8485093754',
176
- duration: testCase.input,
177
- }, mockTodoistApi);
178
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093754', expect.objectContaining({
179
- duration: testCase.expectedMinutes,
180
- durationUnit: 'minute',
181
- }));
182
- }
183
- });
184
- it('should update task with duration and move at once', async () => {
185
- const movedTask = createMockTask({
186
- id: '8485093755',
187
- content: 'Task to move and update',
188
- projectId: 'new-project-id',
189
- });
190
- const updatedTask = createMockTask({
191
- id: '8485093755',
192
- content: 'Updated task with duration',
193
- duration: { amount: 120, unit: 'minute' },
194
- projectId: 'new-project-id',
195
- });
196
- mockTodoistApi.moveTasks.mockResolvedValue([movedTask]);
197
- mockTodoistApi.updateTask.mockResolvedValue(updatedTask);
198
- const result = await tasksUpdateOne.execute({
199
- id: '8485093755',
200
- content: 'Updated task with duration',
201
- duration: '2h',
202
- projectId: 'new-project-id',
203
- }, mockTodoistApi);
204
- // Should call moveTasks first
205
- expect(mockTodoistApi.moveTasks).toHaveBeenCalledWith(['8485093755'], {
206
- projectId: 'new-project-id',
207
- });
208
- // Then call updateTask with duration
209
- expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('8485093755', {
210
- content: 'Updated task with duration',
211
- duration: 120,
212
- durationUnit: 'minute',
213
- });
214
- expect(result).toEqual(updatedTask);
215
- });
216
- });
217
- describe('error handling', () => {
218
- it('should throw error for invalid duration format', async () => {
219
- await expect(tasksUpdateOne.execute({
220
- id: '8485093756',
221
- duration: 'invalid',
222
- }, mockTodoistApi)).rejects.toThrow('Task 8485093756: Invalid duration format "invalid"');
223
- });
224
- it('should throw error for duration exceeding 24 hours', async () => {
225
- await expect(tasksUpdateOne.execute({
226
- id: '8485093757',
227
- duration: '25h',
228
- }, mockTodoistApi)).rejects.toThrow('Task 8485093757: Invalid duration format "25h": Duration cannot exceed 24 hours (1440 minutes)');
229
- });
230
- it('should throw error when multiple move parameters are provided', async () => {
231
- await expect(tasksUpdateOne.execute({ id: '8485093748', projectId: 'new-project', sectionId: 'new-section' }, mockTodoistApi)).rejects.toThrow('Only one of projectId, sectionId, or parentId can be specified at a time. ' +
232
- 'The Todoist API requires exactly one destination for move operations.');
233
- });
234
- it('should throw error when all three move parameters are provided', async () => {
235
- await expect(tasksUpdateOne.execute({ id: '8485093748', projectId: 'p1', sectionId: 's1', parentId: 't1' }, mockTodoistApi)).rejects.toThrow('Only one of projectId, sectionId, or parentId can be specified at a time');
236
- });
237
- it.each([
238
- {
239
- error: 'API Error: Task not found',
240
- params: { id: 'non-existent-task', content: 'Updated content' },
241
- },
242
- {
243
- error: 'API Error: Invalid priority value',
244
- params: { id: '8485093748', priority: 5 },
245
- },
246
- ])('should propagate $error', async ({ error, params }) => {
247
- mockTodoistApi.updateTask.mockRejectedValue(new Error(error));
248
- await expect(tasksUpdateOne.execute(params, mockTodoistApi)).rejects.toThrow(error);
249
- });
250
- });
251
- });
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- declare const deleteOne: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- type: z.ZodEnum<["project", "section", "task"]>;
7
- id: z.ZodString;
8
- };
9
- execute(args: {
10
- type: "project" | "section" | "task";
11
- id: string;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
13
- success: boolean;
14
- }>;
15
- };
16
- export { deleteOne };
17
- //# sourceMappingURL=delete-one.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,25 +0,0 @@
1
- import { z } from 'zod';
2
- const ArgsSchema = {
3
- type: z.enum(['project', 'section', 'task']).describe('The type of entity to delete.'),
4
- id: z.string().min(1).describe('The ID of the entity to delete.'),
5
- };
6
- const deleteOne = {
7
- name: 'delete-one',
8
- description: 'Delete a project, section, or task by its ID.',
9
- parameters: ArgsSchema,
10
- async execute(args, client) {
11
- switch (args.type) {
12
- case 'project':
13
- await client.deleteProject(args.id);
14
- break;
15
- case 'section':
16
- await client.deleteSection(args.id);
17
- break;
18
- case 'task':
19
- await client.deleteTask(args.id);
20
- break;
21
- }
22
- return { success: true };
23
- },
24
- };
25
- export { deleteOne };
@@ -1,14 +0,0 @@
1
- import type { TodoistApi } from '@doist/todoist-api-typescript';
2
- import { z } from 'zod';
3
- declare const overview: {
4
- name: string;
5
- description: string;
6
- parameters: {
7
- projectId: z.ZodOptional<z.ZodString>;
8
- };
9
- execute(args: {
10
- projectId?: string | undefined;
11
- }, client: TodoistApi): Promise<string>;
12
- };
13
- export { overview };
14
- //# sourceMappingURL=overview.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,29 +0,0 @@
1
- import { z } from 'zod';
2
- declare const projectsList: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- search: z.ZodOptional<z.ZodString>;
7
- limit: z.ZodDefault<z.ZodNumber>;
8
- cursor: z.ZodOptional<z.ZodString>;
9
- };
10
- execute(args: {
11
- limit: number;
12
- cursor?: string | undefined;
13
- search?: string | undefined;
14
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
15
- 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
- }[];
25
- nextCursor: string | null;
26
- }>;
27
- };
28
- export { projectsList };
29
- //# sourceMappingURL=projects-list.d.ts.map
@@ -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,CAAA;AA0BvB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;CAmBwB,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,39 +0,0 @@
1
- import { z } from 'zod';
2
- import { mapProject } from '../tool-helpers.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 projectsList = {
21
- name: 'projects-list',
22
- description: 'List all projects or search for projects by name. If search parameter is omitted, all projects are returned.',
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 { projectsList };
@@ -1,24 +0,0 @@
1
- import { z } from 'zod';
2
- declare const projectsManage: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- id: z.ZodOptional<z.ZodString>;
7
- name: z.ZodString;
8
- };
9
- execute(args: {
10
- name: string;
11
- id?: string | undefined;
12
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<import("@doist/todoist-api-typescript").WorkspaceProject | {
13
- id: string;
14
- name: string;
15
- color: string;
16
- isFavorite: boolean;
17
- isShared: boolean;
18
- parentId: string | null;
19
- inboxProject: boolean;
20
- viewStyle: string;
21
- }>;
22
- };
23
- export { projectsManage };
24
- //# sourceMappingURL=projects-manage.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- import { mapProject } from '../tool-helpers.js';
3
- const ArgsSchema = {
4
- id: z
5
- .string()
6
- .min(1)
7
- .optional()
8
- .describe('The ID of the project to update. If provided, updates the project. If omitted, creates a new project.'),
9
- name: z.string().min(1).describe('The name of the project.'),
10
- };
11
- const projectsManage = {
12
- name: 'projects-manage',
13
- 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.',
14
- parameters: ArgsSchema,
15
- async execute(args, client) {
16
- if (args.id) {
17
- // Update existing project
18
- const project = await client.updateProject(args.id, { name: args.name });
19
- return project;
20
- }
21
- // Create new project
22
- const project = await client.addProject({ name: args.name });
23
- return mapProject(project);
24
- },
25
- };
26
- export { projectsManage };
@@ -1,23 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,37 +0,0 @@
1
- import { z } from 'zod';
2
- import { errorContent } from '../mcp-helpers.js';
3
- const ArgsSchema = {
4
- id: z
5
- .string()
6
- .min(1)
7
- .optional()
8
- .describe('The ID of the section to update. If provided, updates the section. If omitted, creates a new section.'),
9
- name: z.string().min(1).describe('The name of the section.'),
10
- projectId: z
11
- .string()
12
- .min(1)
13
- .optional()
14
- .describe('The ID of the project to add the section to. Required when creating a new section (when id is not provided).'),
15
- };
16
- const sectionsManage = {
17
- name: 'sections-manage',
18
- 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).',
19
- parameters: ArgsSchema,
20
- async execute(args, client) {
21
- if (args.id) {
22
- // Update existing section
23
- const section = await client.updateSection(args.id, { name: args.name });
24
- return section;
25
- }
26
- // Create new section - projectId is required
27
- if (!args.projectId) {
28
- return errorContent('Error: projectId is required when creating a new section (when id is not provided).');
29
- }
30
- const section = await client.addSection({
31
- name: args.name,
32
- projectId: args.projectId,
33
- });
34
- return section;
35
- },
36
- };
37
- export { sectionsManage };
@@ -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,CAAA;AAavB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;CAiBsB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- const ArgsSchema = {
3
- projectId: z.string().min(1).describe('The ID of the project to search sections in.'),
4
- search: z
5
- .string()
6
- .optional()
7
- .describe('Search for a section by name (partial and case insensitive match). If omitted, all sections in the project are returned.'),
8
- };
9
- const sectionsSearch = {
10
- name: 'sections-search',
11
- description: 'Search for sections by name or other criteria in a project.',
12
- parameters: ArgsSchema,
13
- async execute(args, client) {
14
- const { results } = await client.getSections({
15
- projectId: args.projectId,
16
- });
17
- const searchLower = args.search ? args.search.toLowerCase() : undefined;
18
- const filtered = searchLower
19
- ? results.filter((section) => section.name.toLowerCase().includes(searchLower))
20
- : results;
21
- return filtered.map((section) => ({
22
- id: section.id,
23
- name: section.name,
24
- }));
25
- },
26
- };
27
- export { sectionsSearch };
@@ -1,55 +0,0 @@
1
- import { z } from 'zod';
2
- declare const tasksAddMultiple: {
3
- name: string;
4
- description: string;
5
- parameters: {
6
- projectId: z.ZodOptional<z.ZodString>;
7
- sectionId: z.ZodOptional<z.ZodString>;
8
- parentId: z.ZodOptional<z.ZodString>;
9
- tasks: z.ZodArray<z.ZodObject<{
10
- content: z.ZodString;
11
- description: z.ZodOptional<z.ZodString>;
12
- priority: z.ZodOptional<z.ZodNumber>;
13
- dueString: z.ZodOptional<z.ZodString>;
14
- duration: z.ZodOptional<z.ZodString>;
15
- }, "strip", z.ZodTypeAny, {
16
- content: string;
17
- description?: string | undefined;
18
- priority?: number | undefined;
19
- dueString?: string | undefined;
20
- duration?: string | undefined;
21
- }, {
22
- content: string;
23
- description?: string | undefined;
24
- priority?: number | undefined;
25
- dueString?: string | undefined;
26
- duration?: string | undefined;
27
- }>, "many">;
28
- };
29
- execute(args: {
30
- tasks: {
31
- content: string;
32
- description?: string | undefined;
33
- priority?: number | undefined;
34
- dueString?: string | undefined;
35
- duration?: string | undefined;
36
- }[];
37
- parentId?: string | undefined;
38
- projectId?: string | undefined;
39
- sectionId?: string | undefined;
40
- }, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
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
- duration: string | null;
52
- }[]>;
53
- };
54
- export { tasksAddMultiple };
55
- //# sourceMappingURL=tasks-add-multiple.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tasks-add-multiple.d.ts","sourceRoot":"","sources":["../../src/tools/tasks-add-multiple.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAyBvB,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCoB,CAAA;AAE1C,OAAO,EAAE,gBAAgB,EAAE,CAAA"}