decide_set_task_due_date
Set due dates for tasks in the Decide realm to schedule work and manage deadlines within the ADD framework.
Instructions
Set due date for a task in Decide realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taskRecordName | Yes | Record name of the task | |
| endDate | Yes | Due date in ISO format |
Implementation Reference
- src/index.ts:454-463 (registration)Tool registration in the listTools response, including name, description, and input schema definition.name: 'decide_set_task_due_date', description: 'Set due date for a task in Decide realm.', inputSchema: { type: 'object', properties: { taskRecordName: { type: 'string', description: 'Record name of the task' }, endDate: { type: 'string', format: 'date-time', description: 'Due date in ISO format' } }, required: ['taskRecordName', 'endDate'] }
- src/index.ts:712-714 (handler)Dispatch handler in the CallToolRequestSchema switch statement that invokes the main setTaskDueDate method.case 'decide_set_task_due_date': this.validateArgs(args, ['taskRecordName', 'endDate']); return await this.setTaskDueDate(args.taskRecordName, args.endDate);
- src/index.ts:1021-1039 (handler)Primary handler function: validates task is in Decide realm (realmId=2), ensures due date is in future, then calls helper to update.if (!item) { throw new McpError(ErrorCode.InvalidParams, `Task ${taskRecordName} not found`); } if (item.realmId !== REALM_DECIDE_ID) { throw new McpError(ErrorCode.InvalidParams, `Task ${taskRecordName} must be in Decide realm to set due date. Current realm: ${item.realmId}`); } // Validate due date is in the future const dueDate = new Date(endDate); const now = new Date(); if (dueDate <= now) { throw new McpError(ErrorCode.InvalidParams, `Due date must be in the future. Provided: ${dueDate.toLocaleDateString()}`); } return this.setDueDateForItem(taskRecordName, 'Task', endDate); } private async setTaskAlert(taskRecordName: string, alertDateTime: string) { return this.setAlertForTask(taskRecordName, alertDateTime);
- src/index.ts:1000-1005 (helper)Shared helper function that performs the actual (mock) update of endDate field and returns success response.private async setDueDateForItem(itemRecordName: string, itemType: 'Task' | 'Project', endDateISO: string) { // Mock fetch & check realm (should be REALM_DECIDE_ID) const endDateTimestamp = new Date(endDateISO).getTime(); // Mock update: console.log('Mock CloudKit: Setting endDate', endDateTimestamp, 'for', itemType, itemRecordName); return { content: [{ type: 'text', text: `Due date (endDate) ${endDateISO} set for ${itemType} ${itemRecordName} in Decide realm.` }] }; }
- src/index.ts:1172-1198 (helper)Mock helper used by handler to fetch item data for realm validation (simulates CloudKit query).private async mockFetchItem(itemRecordName: string, itemType: 'Task' | 'Project'): Promise<any> { // Mock different scenarios based on record name patterns const baseItem = { recordName: itemRecordName, type: itemType, lastModified: new Date().toISOString() }; // Simulate different states for validation testing if (itemRecordName.includes('assess')) { return { ...baseItem, realmId: REALM_ASSESS_ID, contextRecordName: null, endDate: null }; } else if (itemRecordName.includes('undecided')) { return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: null, endDate: null }; } else if (itemRecordName.includes('stalled')) { const yesterday = new Date(Date.now() - 86400000).toISOString(); return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: 'context_work', endDate: yesterday }; } else if (itemRecordName.includes('ready')) { const tomorrow = new Date(Date.now() + 86400000).toISOString(); return { ...baseItem, realmId: REALM_DECIDE_ID, contextRecordName: 'context_work', endDate: tomorrow }; } else if (itemRecordName.includes('do')) { const today = new Date().toISOString(); return { ...baseItem, realmId: REALM_DO_ID, contextRecordName: 'context_work', endDate: today }; } else { // Default to Assess realm item return { ...baseItem, realmId: REALM_ASSESS_ID, contextRecordName: null, endDate: null }; } }