Skip to content

Commit c97be7f

Browse files
fix: Remove nullable type from update_tasks to fix Gemini API compatibility (#181)
Co-authored-by: Claude <[email protected]>
1 parent a2fa992 commit c97be7f

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/tools/__tests__/assignment-integration.test.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,34 @@ describe('Assignment Integration Tests', () => {
230230
expect(extractTextContent(result)).toContain('Updated 1 task')
231231
})
232232

233-
it('should unassign task when responsibleUser is null', async () => {
233+
it('should unassign task when responsibleUser is "unassign"', async () => {
234234
await updateTasks.execute(
235235
{
236236
tasks: [
237237
{
238238
id: 'task-123',
239-
responsibleUser: null,
239+
responsibleUser: 'unassign',
240+
},
241+
],
242+
},
243+
mockTodoistApi,
244+
)
245+
246+
expect(mockTodoistApi.updateTask).toHaveBeenCalledWith(
247+
'task-123',
248+
expect.objectContaining({
249+
assigneeId: null,
250+
}),
251+
)
252+
})
253+
254+
it('should unassign task when responsibleUser is null (backward compatibility)', async () => {
255+
await updateTasks.execute(
256+
{
257+
tasks: [
258+
{
259+
id: 'task-123',
260+
responsibleUser: null as unknown as string,
240261
},
241262
],
242263
},
@@ -577,7 +598,7 @@ describe('Assignment Integration Tests', () => {
577598
tasks: [
578599
{
579600
id: 'task-123',
580-
responsibleUser: null,
601+
responsibleUser: null as unknown as string,
581602
},
582603
],
583604
},

src/tools/update-tasks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ const TasksUpdateSchema = z.object({
4444
),
4545
responsibleUser: z
4646
.string()
47-
.nullable()
4847
.optional()
4948
.describe(
50-
'Change task assignment. Use null to unassign. Can be user ID, name, or email. User must be a project collaborator.',
49+
'Change task assignment. Use "unassign" to remove assignment. Can be user ID, name, or email. User must be a project collaborator.',
5150
),
5251
labels: z
5352
.array(z.string())
@@ -113,7 +112,7 @@ const updateTasks = {
113112

114113
// Handle assignment changes if provided
115114
if (responsibleUser !== undefined) {
116-
if (responsibleUser === null) {
115+
if (responsibleUser === null || responsibleUser === 'unassign') {
117116
// Unassign task - no validation needed
118117
updateArgs = { ...updateArgs, assigneeId: null }
119118
} else {

0 commit comments

Comments
 (0)