do_mark_project_as_done
Mark a project as completed in the Do realm to track progress and maintain workflow organization within the ADD framework.
Instructions
Mark projects as completed in Do realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectRecordName | Yes | Project record name |
Implementation Reference
- src/index.ts:535-544 (registration)Tool registration in the listTools response, defining the tool name, description, and input schema.name: 'do_mark_project_as_done', description: 'Mark projects as completed in Do realm.', inputSchema: { type: 'object', properties: { projectRecordName: { type: 'string', description: 'Project record name' } }, required: ['projectRecordName'] } },
- src/index.ts:537-543 (schema)Input schema requiring 'projectRecordName' as a string.inputSchema: { type: 'object', properties: { projectRecordName: { type: 'string', description: 'Project record name' } }, required: ['projectRecordName'] }
- src/index.ts:1430-1443 (handler)Core handler function: validates project exists and is in Do realm (ID 3), simulates completion by setting endDate and moving to 'Done' (mock; production would update CloudKit record).private async markProjectAsDone(projectRecordName: string) { // Validate that project is in Do realm before marking as done const item = await this.mockFetchItem(projectRecordName, 'Project'); if (!item) { throw new McpError(ErrorCode.InvalidParams, `Project ${projectRecordName} not found`); } if (item.realmId !== REALM_DO_ID) { throw new McpError(ErrorCode.InvalidParams, `Project ${projectRecordName} must be in Do realm to mark as done. Current realm: ${item.realmId}. Move to Do realm first.`); } const completionTime = new Date().toISOString(); // Mock marking project as done via CloudKit - this would also mark all subtasks as done return { content: [{ type: 'text', text: `Project ${projectRecordName} and all subtasks marked as done at ${completionTime}. Moved to Done collection (realm 4).` }] }; }
- src/index.ts:735-738 (registration)Dispatch/registration in CallToolRequestSchema switch statement, validating args and calling the handler.case 'do_mark_project_as_done': this.validateArgs(args, ['projectRecordName']); return await this.markProjectAsDone(args.projectRecordName);
- src/index.ts:1172-1198 (helper)Helper function used by handler to fetch/mock project data for realm validation.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 }; } }