get_undecided_items_in_decide
Identify tasks and projects awaiting decisions in the Decide realm to facilitate assignment of contexts and dates for the ADD framework workflow.
Instructions
Find undecided items (tasks + projects) in Decide realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:608-612 (registration)Tool registration entry defining the name, description, and input schema (empty object) for listTools response.{ name: 'get_undecided_items_in_decide', description: 'Find undecided items (tasks + projects) in Decide realm.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:765-765 (handler)Dispatch handler in CallToolRequestSchema switch statement calling the main implementation method.return await this.getUndecidedItemsInDecide();
- src/index.ts:1533-1614 (handler)Primary handler function implementing tool logic: queries CloudKitService for undecided tasks in Decide realm, filters projects lacking context or due date, formats human-readable response. Falls back to mock in development.private async getUndecidedItemsInDecide() { return this.withCloudKitOrMock( 'getUndecidedItemsInDecide', async () => { // CloudKit production implementation const [undecidedTasks, allProjects] = await Promise.all([ this.cloudKitService.getTasksInDecideUndecided(), this.cloudKitService.getProjectsByRealm(2) ]); // Filter projects that lack context or due date const undecidedProjects = allProjects.filter((project: any) => { const hasContext = project.fields?.context?.value?.recordName; const hasEndDate = project.fields?.endDate?.value; return !hasContext || !hasEndDate; }); const allUndecidedItems = [...undecidedTasks, ...undecidedProjects]; let response = `Undecided items in Decide realm (need context/timeline decisions):\n`; if (allUndecidedItems.length === 0) { response += 'All items in Decide realm have context and due dates set! ✅'; } else { response += allUndecidedItems.map(item => { const isTask = item.recordType === 'Task'; const name = isTask ? item.fields?.taskName?.value : item.fields?.projectName?.value; const hasContext = item.fields?.context?.value?.recordName; const hasEndDate = item.fields?.endDate?.value; const type = isTask ? 'Task' : 'Project'; const missing = []; if (!hasContext) missing.push('context'); if (!hasEndDate) missing.push('due date'); return `- ${name} (${item.recordName}) - needs: ${missing.join(' + ')} [${type}]`; }).join('\n'); } return { content: [{ type: 'text', text: response }] }; }, async () => { // Mock implementation const mockItems = [ { recordName: 'task_undecided_1', taskName: 'Research new marketing strategy', contextRecordName: null, endDate: null, realmId: 2, needsDecision: 'Context and timeline' }, { recordName: 'task_undecided_2', taskName: 'Call insurance company', contextRecordName: 'context_home', endDate: null, realmId: 2, needsDecision: 'Due date scheduling' }, { recordName: 'project_undecided_1', projectName: 'Organize home office', contextRecordName: null, endDate: null, realmId: 2, needsDecision: 'Context and timeline' } ]; let response = `Undecided items in Decide realm (need context/timeline decisions):\n`; response += mockItems.map(item => { const type = item.recordName.startsWith('task_') ? 'Task' : 'Project'; const name = item.taskName || (item as any).projectName; const missing = []; if (!item.contextRecordName) missing.push('context'); if (!item.endDate) missing.push('due date'); return `- ${name} (${item.recordName}) - needs: ${missing.join(' + ')}`; }).join('\n'); return { content: [{ type: 'text', text: response }] }; } );
- Core helper method fetching undecided tasks (no context OR no endDate) in Decide realm (realmId=2) via two CloudKit queries (OR not natively supported) + deduplication.async getTasksInDecideUndecided(): Promise<ZenTaskticTask[]> { // CloudKit doesn't support complex OR conditions directly // We'll need to make two queries and combine results const [noContext, noDueDate] = await Promise.all([ // Tasks with no context this.queryRecords<ZenTaskticTask>('Task', { filterBy: [ { fieldName: 'realmId', fieldValue: 2, comparator: 'EQUALS' }, { fieldName: 'contextRecordName', fieldValue: null, comparator: 'EQUALS' } ] }), // Tasks with no due date this.queryRecords<ZenTaskticTask>('Task', { filterBy: [ { fieldName: 'realmId', fieldValue: 2, comparator: 'EQUALS' }, { fieldName: 'endDate', fieldValue: null, comparator: 'EQUALS' } ] }) ]); // Combine and deduplicate by recordName const combined = [...noContext, ...noDueDate]; const uniqueRecords = new Map(); combined.forEach(task => { uniqueRecords.set((task as any).recordName, task); }); return Array.from(uniqueRecords.values()); }