get_tasks_soon_in_do
Retrieve upcoming tasks from the Do realm to prioritize completion within the ADD framework's structured workflow.
Instructions
Find tasks due soon in Do realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:628-632 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).{ name: 'get_tasks_soon_in_do', description: 'Find tasks due soon in Do realm.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:772-773 (handler)Dispatch in CallToolRequestSchema switch statement that invokes the main handler method.case 'get_tasks_soon_in_do': return await this.getTasksSoonInDo();
- src/index.ts:1842-1911 (handler)Primary MCP tool handler. In production, delegates to CloudKitService.getTasksInDoSoon() and formats response. In development/mock mode, returns simulated data with tasks due in 2-7 days.private async getTasksSoonInDo() { return this.withCloudKitOrMock( 'getTasksSoonInDo', async () => { // CloudKit production implementation const soonTasks = await this.cloudKitService.getTasksInDoSoon(); let response = `Soon items in Do realm (due within next 2-7 days):\n`; if (soonTasks.length === 0) { response += 'No tasks due soon in Do realm! š Good planning ahead!'; } else { response += soonTasks.map((task: any) => { const name = task.fields?.taskName?.value || 'Unnamed Task'; const contextRecordName = task.fields?.context?.value?.recordName; const contextName = contextRecordName?.replace('context_', '') || 'No context'; const priority = task.fields?.taskPriority?.value || 3; const priorityIcon = priority === 1 ? 'š“ High' : priority === 2 ? 'š” Medium' : 'š¢ Low'; const endDate = task.fields?.endDate?.value; const dueDate = new Date(endDate).toLocaleDateString(); const daysUntil = Math.ceil((new Date(endDate).getTime() - Date.now()) / (24 * 60 * 60 * 1000)); return `- ${name} (${task.recordName}) - Due: ${dueDate} (${daysUntil} days) - ${contextName} - ${priorityIcon}`; }).join('\n'); } return { content: [{ type: 'text', text: response }] }; }, async () => { // Mock implementation const now = new Date(); const threeDays = new Date(now.getTime() + 3 * 86400000); const sevenDays = new Date(now.getTime() + 7 * 86400000); const mockTasks = [ { recordName: 'task_soon_1', taskName: 'Submit tax documents', realmId: 3, endDate: threeDays.toISOString().split('T')[0], contextRecordName: 'context_personal', priority: 1, timeEstimate: '2 hours', daysUntilDue: 3 }, { recordName: 'project_soon_1', projectName: 'Plan team offsite', realmId: 3, endDate: sevenDays.toISOString().split('T')[0], contextRecordName: 'context_work', priority: 2, timeEstimate: '5 hours', daysUntilDue: 7 } ]; let response = `Soon items in Do realm (due within next 2-7 days):\n`; response += mockTasks.map(item => { const type = item.recordName.startsWith('task_') ? 'Task' : 'Project'; const name = item.taskName || (item as any).projectName; const contextName = item.contextRecordName?.replace('context_', '') || 'No context'; const priority = item.priority === 1 ? 'š“ High' : item.priority === 2 ? 'š” Medium' : 'š¢ Low'; const dueDate = new Date(item.endDate).toLocaleDateString(); return `- ${name} (${item.recordName}) - Due: ${dueDate} (${item.daysUntilDue} days) - ${contextName} - ${priority}`; }).join('\n'); return { content: [{ type: 'text', text: response }] }; } ); }
- src/services/CloudKitService.ts:378-393 (handler)Production CloudKit query implementation: fetches Tasks in Do realm (realmId=3) with endDate between +2 and +7 days from now, sorted by endDate ascending.async getTasksInDoSoon(): Promise<ZenTaskticTask[]> { const twoDaysFromNow = new Date(); twoDaysFromNow.setDate(twoDaysFromNow.getDate() + 2); const sevenDaysFromNow = new Date(); sevenDaysFromNow.setDate(sevenDaysFromNow.getDate() + 7); return this.queryRecords<ZenTaskticTask>('Task', { filterBy: [ { fieldName: 'realmId', fieldValue: 3, comparator: 'EQUALS' }, { fieldName: 'endDate', fieldValue: twoDaysFromNow.getTime(), comparator: 'GREATER_THAN_OR_EQUALS' }, { fieldName: 'endDate', fieldValue: sevenDaysFromNow.getTime(), comparator: 'LESS_THAN_OR_EQUALS' } ], sortBy: [{ fieldName: 'endDate', ascending: true }] }); }