get_initiative_insights
Analyze initiatives using AI to generate actionable insights and recommendations for project management decisions.
Instructions
Get AI-powered insights and recommendations for an initiative
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| initiative_id | Yes | The unique identifier of the initiative |
Implementation Reference
- src/tools/initiatives.ts:400-408 (handler)Primary handler function for the 'get_initiative_insights' MCP tool. Validates input with Zod schema, logs the action, calls the supabaseService API, and returns insights.export const getInitiativeInsights = requireAuth(async (args: any) => { const { initiative_id } = GetInitiativeSchema.parse(args) logger.info('Getting initiative insights', { initiative_id }) const insights = await supabaseService.getInitiativeInsights(initiative_id) return { insights } })
- src/tools/initiatives.ts:384-398 (registration)MCPTool registration definition, including the tool name, description, and JSON schema for input validation (initiative_id as UUID).export const getInitiativeInsightsTool: MCPTool = { name: 'get_initiative_insights', description: 'Get AI-powered insights and recommendations for an initiative', inputSchema: { type: 'object', properties: { initiative_id: { type: 'string', format: 'uuid', description: 'The unique identifier of the initiative' } }, required: ['initiative_id'] } }
- src/tools/initiatives.ts:22-24 (schema)Zod runtime validation schema for tool input, ensuring initiative_id is a valid UUID. Used in the handler for parsing args.const GetInitiativeSchema = z.object({ initiative_id: z.string().uuid() })
- src/lib/api-client.ts:548-551 (helper)API client service method (supabaseService.getInitiativeInsights) called by the tool handler. Performs HTTP request to backend /insights endpoint.async getInitiativeInsights(initiativeId: string): Promise<any> { const response = await this.request<{ insights: any }>(`/api/mcp/initiatives/${initiativeId}/insights`) return response.insights }
- src/tools/initiatives.ts:630-642 (registration)Registration of the handler function in the initiativeHandlers object, mapping tool name to its executor for central tool dispatching.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 }