Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"prepare": "husky"
},
"dependencies": {
"@doist/todoist-api-typescript": "6.1.12",
"@doist/todoist-api-typescript": "6.2.0",
"@modelcontextprotocol/sdk": "1.22.0",
"date-fns": "4.1.0",
"dotenv": "17.2.3",
Expand Down
34 changes: 34 additions & 0 deletions src/tools/__tests__/add-tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -786,4 +786,38 @@ describe(`${ADD_TASKS} tool`, () => {
})
})
})

describe('isUncompletable parameter', () => {
it('should pass isUncompletable parameter to SDK', async () => {
// Mock API response - minimal mock just to prevent errors
const mockApiResponse: Task = createMockTask({
id: '8485093999',
content: 'Project Header',
})

mockTodoistApi.addTask.mockResolvedValueOnce(mockApiResponse)

await addTasks.execute(
{
tasks: [
{
content: 'Project Header',
isUncompletable: true,
},
],
},
mockTodoistApi,
)

// Verify the parameter was passed to the SDK - this is the key test
expect(mockTodoistApi.addTask).toHaveBeenCalledWith({
content: 'Project Header',
projectId: undefined,
sectionId: undefined,
parentId: undefined,
labels: undefined,
isUncompletable: true,
})
})
})
})
29 changes: 29 additions & 0 deletions src/tools/__tests__/update-tasks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1031,4 +1031,33 @@ describe(`${UPDATE_TASKS} tool`, () => {
})
})
})

describe('isUncompletable parameter', () => {
it('should pass isUncompletable parameter to SDK', async () => {
// Mock API response - minimal mock just to prevent errors
const mockUpdatedTask: Task = createMockTask({
id: 'task123',
content: 'Updated Header',
})

mockTodoistApi.updateTask.mockResolvedValueOnce(mockUpdatedTask)

await updateTasks.execute(
{
tasks: [
{
id: 'task123',
isUncompletable: true,
},
],
},
mockTodoistApi,
)

// Verify the parameter was passed to the SDK - this is the key test
expect(mockTodoistApi.updateTask).toHaveBeenCalledWith('task123', {
isUncompletable: true,
})
})
})
})
6 changes: 6 additions & 0 deletions src/tools/add-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const TaskSchema = z.object({
.describe(
'Assign task to this user. Can be a user ID, name, or email address. User must be a collaborator on the target project.',
),
isUncompletable: z
.boolean()
.optional()
.describe(
'Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed.',
),
})

const ArgsSchema = {
Expand Down
6 changes: 6 additions & 0 deletions src/tools/update-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ const TasksUpdateSchema = z.object({
.array(z.string())
.optional()
.describe('The new labels for the task. Replaces all existing labels.'),
isUncompletable: z
.boolean()
.optional()
.describe(
'Whether this task should be uncompletable (organizational header). Tasks with isUncompletable: true appear as organizational headers and cannot be completed.',
),
})

type TaskUpdate = z.infer<typeof TasksUpdateSchema>
Expand Down
4 changes: 4 additions & 0 deletions src/utils/output-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const TaskSchema = z.object({
.string()
.optional()
.describe('The UID of the user responsible for this task.'),
isUncompletable: z
.boolean()
.optional()
.describe('Whether the task is uncompletable (organizational header).'),
assignedByUid: z.string().optional().describe('The UID of the user who assigned this task.'),
checked: z.boolean().describe('Whether the task is checked/completed.'),
completedAt: z.string().optional().describe('When the task was completed (ISO 8601 format).'),
Expand Down
1 change: 1 addition & 0 deletions src/utils/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function createMockTask({
dayOrder: 0,
userId: '713437',
priority: convertPriorityToNumber(priority),
isUncompletable: false,
...overrides,
}
}
Expand Down
Loading