get_tasks_by_realm
Filter tasks by realm (Assess, Decide, Do) to organize and manage workflow stages within the ADD framework.
Instructions
Filter tasks by realm.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| realm | Yes | Realm to query (maps to realmId 1, 2, or 3) |
Implementation Reference
- src/index.ts:547-557 (registration)Tool registration in ListToolsRequestHandler, including the tool name, description, and input schema definition.{ name: 'get_tasks_by_realm', description: 'Filter tasks by realm.', inputSchema: { type: 'object', properties: { realm: { type: 'string', enum: ['assess', 'decide', 'do'], description: 'Realm to query (maps to realmId 1, 2, or 3)' } }, required: ['realm'] } },
- src/index.ts:740-742 (handler)Dispatch handler in CallToolRequestHandler switch statement that validates input and calls the tool implementation method.case 'get_tasks_by_realm': this.validateArgs(args, ['realm']); return await this.getTasksByRealm(args.realm as RealmString);
- src/index.ts:1446-1450 (handler)Primary MCP tool handler method that converts realm string to ID and returns a formatted text response with mock task data (production version intended to use CloudKitService).private async getTasksByRealm(realm: RealmString) { const realmId = realmStringToId(realm); const mockTasks = [{ recordName: 'task_123', taskName: 'Sample Task A', realmId }]; return { content: [{ type: 'text', text: `Tasks in ${realm} realm (ID: ${realmId}):\n${mockTasks.map(t => `- ${t.taskName} (${t.recordName})`).join('\n')}` }] }; }
- CloudKit service helper method that queries tasks filtered by realmId using the generic queryRecords method, intended for production use by the MCP tool handler.async getTasksByRealm(realmId: number): Promise<ZenTaskticTask[]> { return this.queryRecords<ZenTaskticTask>('Task', { filterBy: [{ fieldName: 'realmId', fieldValue: realmId, comparator: 'EQUALS' }], sortBy: [{ fieldName: 'lastModified', ascending: false }] }); }
- src/index.ts:36-41 (helper)Helper function to map realm string ('assess', 'decide', 'do') to numeric realmId (1,2,3) used in the tool handler.const realmStringToId = (realmStr: RealmString): number => { if (realmStr === 'assess') return REALM_ASSESS_ID; if (realmStr === 'decide') return REALM_DECIDE_ID; if (realmStr === 'do') return REALM_DO_ID; throw new McpError(ErrorCode.InvalidParams, `Invalid realm string: ${realmStr}`); };