get_collections
Retrieve all task collections from the addTaskManager MCP Server, enabling users to manage and organize tasks, projects, and ideas efficiently using the ADD framework.
Instructions
Get all collections.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1381-1411 (handler)Main handler method for 'get_collections' tool. Uses withCloudKitOrMock to call CloudKitService.getCollections() in production or return mock data.private async getCollections() { return this.withCloudKitOrMock( 'getCollections', async () => { // CloudKit production implementation const collections = await this.cloudKitService.getCollections(); let response = `All collections:\n`; if (collections.length === 0) { response += 'No collections found. Create some to organize your tasks! 📋'; } else { response += collections.map((collection: any) => { const name = collection.fields?.collectionName?.value || 'Unnamed Collection'; return `- ${name} (${collection.recordName})`; }).join('\n'); } return { content: [{ type: 'text', text: response }] }; }, async () => { // Mock implementation const mockCollections = [ { recordName: 'collection_1', collectionName: 'Work Projects' }, { recordName: 'collection_2', collectionName: 'Personal Goals' }, { recordName: 'collection_3', collectionName: 'Done' } ]; return { content: [{ type: 'text', text: `All collections:\n${mockCollections.map(c => `- ${c.collectionName} (${c.recordName})`).join('\n')}` }] }; } ); }
- CloudKitService.getCollections() helper method that queries all 'Collections' records sorted by name.async getCollections(): Promise<any[]> { return this.queryRecords('Collections', { sortBy: [{ fieldName: 'collectionName', ascending: true }] }); }
- src/index.ts:588-591 (registration)Tool registration in ListToolsRequestSchema handler defining 'get_collections' tool with empty input schema.name: 'get_collections', description: 'Get all collections.', inputSchema: { type: 'object', properties: {} } },
- src/index.ts:165-179 (schema)ZenTaskticCollection interface defining the structure of CloudKit Collection records used by getCollections.interface ZenTaskticCollection { recordName?: string; recordType: 'Collections'; fields: { collectionName: { value: string }; // Collection name uniqueId: { value: string }; // UUID, max 58 chars creationDate?: { value: number }; // Timestamp lastModified: { value: number }; // Timestamp // References (relationships in Core Data) ideas?: { value: CKReference[] }; // List of references to Ideas records projects?: { value: CKReference[] }; // List of references to Projects records tasks?: { value: CKReference[] }; // List of references to Task records }; }