get_ready_items_in_decide
Retrieve tasks and projects marked as ready in the Decide realm to streamline prioritization and execution within the addTaskManager MCP Server.
Instructions
Find ready to do items (tasks + projects) in Decide realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:613-617 (registration)Tool registration in the listTools response, including name, description, and empty input schema.{ name: 'get_ready_items_in_decide', description: 'Find ready to do items (tasks + projects) in Decide realm.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:1617-1702 (handler)Main handler function that dispatches to production CloudKit queries or mock data. In production, fetches ready tasks via CloudKitService.getTasksInDecideReady() and filters projects with context and future endDate.private async getReadyItemsInDecide() { return this.withCloudKitOrMock( 'getReadyItemsInDecide', async () => { // CloudKit production implementation const [readyTasks, allProjects] = await Promise.all([ this.cloudKitService.getTasksInDecideReady(), this.cloudKitService.getProjectsByRealm(2) ]); // Filter projects that have both context and future due date const now = new Date(); const readyProjects = allProjects.filter((project: any) => { const hasContext = project.fields?.context?.value?.recordName; const endDate = project.fields?.endDate?.value; const hasFutureEndDate = endDate && new Date(endDate) > now; return hasContext && hasFutureEndDate; }); const allReadyItems = [...readyTasks, ...readyProjects]; let response = `Ready items in Decide realm (context + future due date set):\n`; if (allReadyItems.length === 0) { response += 'No items are ready for Do realm. Check undecided and stalled items first! 📋'; } else { response += allReadyItems.map(item => { const isTask = item.recordType === 'Task'; const name = isTask ? item.fields?.taskName?.value : item.fields?.projectName?.value; const contextRecordName = item.fields?.context?.value?.recordName; const endDate = item.fields?.endDate?.value; const type = isTask ? 'Task' : 'Project'; const dueDate = new Date(endDate).toLocaleDateString(); const contextName = contextRecordName?.replace('context_', '') || 'Unknown'; return `- ${name} (${item.recordName}) - Due: ${dueDate}, Context: ${contextName} [${type}]`; }).join('\n'); } return { content: [{ type: 'text', text: response }] }; }, async () => { // Mock implementation const tomorrow = new Date(Date.now() + 86400000).toISOString(); const nextWeek = new Date(Date.now() + 7 * 86400000).toISOString(); const mockItems = [ { recordName: 'task_ready_1', taskName: 'Schedule dentist appointment', contextRecordName: 'context_personal', endDate: tomorrow, realmId: 2, readyStatus: 'Fully planned - ready for Do realm' }, { recordName: 'task_ready_2', taskName: 'Submit expense report', contextRecordName: 'context_work', endDate: nextWeek, realmId: 2, readyStatus: 'Context and deadline set' }, { recordName: 'project_ready_1', projectName: 'Plan weekend camping trip', contextRecordName: 'context_personal', endDate: nextWeek, realmId: 2, readyStatus: 'Timeline and context decided' } ]; let response = `Ready items in Decide realm (context + future due date set):\n`; response += mockItems.map(item => { const type = item.recordName.startsWith('task_') ? 'Task' : 'Project'; const name = item.taskName || (item as any).projectName; const dueDate = new Date(item.endDate).toLocaleDateString(); const contextName = item.contextRecordName?.replace('context_', '') || 'Unknown'; return `- ${name} (${item.recordName}) - Due: ${dueDate}, Context: ${contextName}`; }).join('\n'); return { content: [{ type: 'text', text: response }] }; } ); }
- Production helper in CloudKitService that queries Decide realm tasks with future endDate and filters those with context assigned.async getTasksInDecideReady(): Promise<ZenTaskticTask[]> { const now = new Date().getTime(); // Get tasks with future due dates first const tasksWithFutureDates = await this.queryRecords<ZenTaskticTask>('Task', { filterBy: [ { fieldName: 'realmId', fieldValue: 2, comparator: 'EQUALS' }, { fieldName: 'endDate', fieldValue: now, comparator: 'GREATER_THAN' } ] }); // Filter client-side for those that also have a context return tasksWithFutureDates.filter((task: any) => task.fields?.contextRecordName?.value != null ); }
- Helper method used to fetch all projects in Decide realm (realmId=2), which are then client-side filtered in the handler for ready status.async getProjectsByRealm(realmId: number): Promise<ZenTaskticProject[]> { return this.queryRecords<ZenTaskticProject>('Projects', { filterBy: [{ fieldName: 'realmId', fieldValue: realmId, comparator: 'EQUALS' }], sortBy: [{ fieldName: 'lastModified', ascending: false }] }); }
- src/index.ts:73-108 (schema)Type definition for ZenTaskticTask used in queries and responses for task records.export interface ZenTaskticTask { recordName?: string; // CloudKit record name (UUID string, typically) recordType: 'Task'; fields: { taskName: { value: string }; // Max 1000 chars, combines original title & body realmId: { value: number }; // 1 (Assess), 2 (Decide), 3 (Do) uniqueId: { value: string }; // UUID string, primary key in CoreData model // Core Data model fields taskId?: { value: number }; // Integer 16, default 0 contextId?: { value: number }; // Integer 16, default 0 (legacy field) taskAudioRecordId?: { value: number }; // Integer 16, default 0 taskPictureId?: { value: number }; // Integer 16, default 0 orderInParent?: { value: number }; // Integer 16, default 0 taskPriority?: { value: number }; // Integer 16, 1-5, default 3 // References (relationships in Core Data) context?: { value: CKReference }; // Reference to a Contexts record projects?: { value: CKReference }; // Reference to a Projects record (renamed from project) collection?: { value: CKReference }; // Reference to a Collections record ideas?: { value: CKReference }; // Reference to an Ideas record (if task derived from idea) realms?: { value: CKReference }; // Reference to Realms record // Dates startDate?: { value: number }; // Timestamp (milliseconds since epoch) endDate?: { value: number }; // Timestamp (due date, or completion date) lastModified: { value: number }; // Timestamp // Task-specific fields localNotification?: { value: string }; // Alert date/trigger (max 100 chars) taskParentId?: { value: string }; // UUID string of parent Task/Project/Idea taskParentType?: { value: string }; // 'Task', 'Project', 'Idea' // removed isCompleted, completion handled by setting endDate & potentially realm }; }