do_mark_project_as_done
Use this tool to mark projects as completed in the Do realm of addTaskManager MCP Server, ensuring task management aligns with 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:1430-1443 (handler)The main handler function for the 'do_mark_project_as_done' tool. Validates that the project is in the Do realm (ID 3), then simulates marking it as done by setting a completion timestamp and noting movement to a 'Done' collection (mock; production would use CloudKitService). Calls helper mockFetchItem for validation.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:535-544 (schema)Tool schema definition including name, description, and input schema (requires projectRecordName string) for registration in ListToolsRequestSchema response.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:736-738 (registration)Tool registration in the CallToolRequestSchema switch statement, validating arguments and delegating to the markProjectAsDone handler.this.validateArgs(args, ['projectRecordName']); return await this.markProjectAsDone(args.projectRecordName);
- src/index.ts:1172-1198 (helper)Helper function mockFetchItem simulates fetching item data from CloudKit to validate the project's realm before marking as done. Used by the handler.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 }; } }