list_initiatives
Retrieve and filter project initiatives by status, priority, or search terms to manage organizational goals and track progress effectively.
Instructions
List all initiatives with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Filter by project | |
| status | No | Filter by status | |
| priority | No | Filter by priority | |
| search | No | Search initiatives by name or objective | |
| limit | No | Maximum number of initiatives to return |
Implementation Reference
- src/tools/initiatives.ts:93-110 (handler)The main handler function for the 'list_initiatives' tool. It validates input using ListInitiativesSchema, logs the request, fetches initiatives from supabaseService.getInitiatives with filters and sorting, and returns the list along with total count and applied filters.export const listInitiatives = requireAuth(async (args: any) => { const { project_id, status, priority, search, limit } = ListInitiativesSchema.parse(args) logger.info('Listing initiatives', { project_id, status, priority, search, limit }) const initiatives = await supabaseService.getInitiatives( { project_id, status, priority, search }, { limit }, { field: 'updated_at', order: 'desc' } ) // The API already returns enriched initiatives with counts return { initiatives: initiatives, total: initiatives.length, filters_applied: { project_id, status, priority, search } } })
- src/tools/initiatives.ts:14-20 (schema)Zod schema used for input validation in the list_initiatives handler, defining optional filters for project_id, status, priority, search, and limit.const ListInitiativesSchema = z.object({ project_id: z.string().uuid().optional(), status: z.enum(['planning', 'active', 'on_hold', 'completed', 'cancelled']).optional(), priority: z.enum(['critical', 'high', 'medium', 'low']).optional(), search: z.string().optional(), limit: z.number().int().positive().max(100).default(20) })
- src/tools/initiatives.ts:57-91 (registration)MCPTool object registering the 'list_initiatives' tool with name, description, and JSON schema for input validation.export const listInitiativesTool: MCPTool = { name: 'list_initiatives', description: 'List all initiatives with optional filtering', inputSchema: { type: 'object', properties: { project_id: { type: 'string', format: 'uuid', description: 'Filter by project' }, status: { type: 'string', enum: ['planning', 'active', 'on_hold', 'completed', 'cancelled'], description: 'Filter by status' }, priority: { type: 'string', enum: ['critical', 'high', 'medium', 'low'], description: 'Filter by priority' }, search: { type: 'string', description: 'Search initiatives by name or objective' }, limit: { type: 'number', minimum: 1, maximum: 100, default: 20, description: 'Maximum number of initiatives to return' } } } }
- src/tools/initiatives.ts:630-642 (registration)Export of all initiative handlers including 'list_initiatives', likely imported elsewhere for central tool registration.export const initiativeHandlers = { list_initiatives: listInitiatives, get_initiative: getInitiative, create_initiative: createInitiative, update_initiative: updateInitiative, get_initiative_context: getInitiativeContext, get_initiative_insights: getInitiativeInsights, search_workspace: searchWorkspace, get_enhanced_project_context: getEnhancedProjectContext, get_workspace_context: getWorkspaceContext, associate_document_with_initiative: associateDocumentWithInitiative, disassociate_document_from_initiative: disassociateDocumentFromInitiative }