get_tasks_today_in_do
Retrieve tasks due today in the Do realm using the addTaskManager MCP Server, helping users stay organized and focused on completing scheduled items.
Instructions
Find tasks due today in Do realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:619-622 (registration)Tool registration in MCP server's listTools handler, defining name, description, and empty input schema.name: 'get_tasks_today_in_do', description: 'Find tasks due today in Do realm.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:1705-1776 (handler)Primary tool handler method. Dispatches to production CloudKitService or mock implementation, formats response listing tasks due today in Do realm with context and priority.private async getTasksTodayInDo() { return this.withCloudKitOrMock( 'getTasksTodayInDo', async () => { // CloudKit production implementation const todaysTasks = await this.cloudKitService.getTasksInDoToday(); let response = `Today's items in Do realm (due: ${new Date().toLocaleDateString()}):\n`; if (todaysTasks.length === 0) { response += 'No tasks scheduled for today in Do realm! 🎉 Time to move some ready items from Decide realm?'; } else { response += todaysTasks.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'; return `- ${name} (${task.recordName}) - ${contextName} - ${priorityIcon}`; }).join('\n'); } return { content: [{ type: 'text', text: response }] }; }, async () => { // Mock implementation const today = new Date(); const todayStr = today.toISOString().split('T')[0]; const mockTasks = [ { recordName: 'task_today_1', taskName: 'Morning standup meeting', realmId: 3, endDate: todayStr, contextRecordName: 'context_work', priority: 1, timeEstimate: '30 minutes' }, { recordName: 'task_today_2', taskName: 'Pick up groceries', realmId: 3, endDate: todayStr, contextRecordName: 'context_errands', priority: 2, timeEstimate: '45 minutes' }, { recordName: 'project_today_1', projectName: 'Review quarterly goals', realmId: 3, endDate: todayStr, contextRecordName: 'context_work', priority: 1, timeEstimate: '2 hours' } ]; let response = `Today's items in Do realm (due: ${today.toLocaleDateString()}):\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'; return `- ${name} (${item.recordName}) - ${contextName} - ${priority} - ~${item.timeEstimate}`; }).join('\n'); return { content: [{ type: 'text', text: response }] }; } ); }
- src/services/CloudKitService.ts:342-355 (handler)Production handler in CloudKitService. Queries Tasks where realmId=3 (Do) and endDate within today, sorted by priority.async getTasksInDoToday(): Promise<ZenTaskticTask[]> { const today = new Date(); const startOfDay = new Date(today.setHours(0, 0, 0, 0)).getTime(); const endOfDay = new Date(today.setHours(23, 59, 59, 999)).getTime(); return this.queryRecords<ZenTaskticTask>('Task', { filterBy: [ { fieldName: 'realmId', fieldValue: 3, comparator: 'EQUALS' }, { fieldName: 'endDate', fieldValue: startOfDay, comparator: 'GREATER_THAN_OR_EQUALS' }, { fieldName: 'endDate', fieldValue: endOfDay, comparator: 'LESS_THAN_OR_EQUALS' } ], sortBy: [{ fieldName: 'taskPriority', ascending: true }] // High priority first }); }
- Core helper method used by getTasksInDoToday() to execute CloudKit query with filters and sorting.async queryRecords<T>(recordType: string, options?: QueryOptions): Promise<T[]> { this.ensureAuthenticated(); const query: any = { recordType, resultsLimit: options?.resultsLimit || 200, desiredKeys: options?.desiredKeys }; // Add filters if (options?.filterBy && options.filterBy.length > 0) { query.filterBy = options.filterBy.map(filter => ({ fieldName: filter.fieldName, fieldValue: { value: filter.fieldValue }, comparator: filter.comparator || 'EQUALS' })); } // Add sorting if (options?.sortBy && options.sortBy.length > 0) { query.sortBy = options.sortBy.map(sort => ({ fieldName: sort.fieldName, ascending: sort.ascending })); } // Add zone ID if specified if (options?.zoneID) { query.zoneID = options.zoneID; } try { const response: CloudKitResponse<T> = await this.database.performQuery(query); if (response.hasErrors) { const error = response.errors?.[0]; throw new Error(`CloudKit query failed: ${error?.reason} (${error?.serverErrorCode})`); } return response.records || []; } catch (error) { console.error('CloudKit query error:', error); throw error; } }