smart-data-analysis
Analyze SAP data patterns, trends, and generate actionable business insights with AI-powered statistical analysis for automated data exploration and visualization.
Instructions
Analyze SAP data patterns, trends, and generate actionable business insights with AI-powered statistical analysis. Provides automated data exploration and visualization recommendations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysisType | Yes | Type of analysis to perform | |
| businessContext | No | Business context for the analysis | |
| data | Yes | Array of data records to analyze - each record is a key-value object | |
| entityType | Yes | Type of SAP entity being analyzed |
Implementation Reference
- src/tools/ai-enhanced-tools.ts:203-239 (handler)Core handler function that orchestrates AI-powered data analysis on SAP entity data, generating insights, recommendations, and confidence scores.async execute(params: any): Promise<any> { try { logger.info('Starting smart data analysis', { recordCount: params.data.length, analysisType: params.analysisType, entityType: params.entityType, }); const prompt = `Analyze this ${params.entityType} data for ${params.analysisType} patterns and business insights`; const analysis = await aiIntegration.analyzeData(prompt, params.data, params.analysisType); const insights = analysis.insights.map( (insight: any) => `${insight.title}: ${insight.description} (${insight.impact} impact)` ); const recommendations = analysis.recommendations.map( (rec: any) => `${rec.title}: ${rec.description} (Priority: ${rec.priority})` ); return { success: true, analysis, insights, recommendations, confidence: analysis.confidence, }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; logger.error('Smart data analysis failed', { error: errorMessage }); return { success: false, error: errorMessage, }; } }
- Input schema defining the parameters for data analysis: data array, analysis type (trend/anomaly/forecast/correlation), optional business context and entity type.inputSchema = { type: 'object' as const, properties: { data: { type: 'array' as const, description: 'Array of data records to analyze - each record is a key-value object', items: { type: 'object' as const, description: 'Data record with flexible schema for SAP entity analysis', additionalProperties: true, }, }, analysisType: { type: 'string' as const, enum: ['trend', 'anomaly', 'forecast', 'correlation'] as const, description: 'Type of analysis to perform', }, businessContext: { type: 'string' as const, description: 'Business context for the analysis', }, entityType: { type: 'string' as const, description: 'Type of SAP entity being analyzed', }, }, required: ['data', 'analysisType', 'entityType'], };
- src/tools/ai-enhanced-tools.ts:462-467 (registration)Instantiation of SmartDataAnalysisTool and inclusion in the aiEnhancedTools export array, which serves as the registry for AI-enhanced MCP tools.export const aiEnhancedTools = [ new NaturalQueryBuilderTool(), new SmartDataAnalysisTool(), new QueryPerformanceOptimizerTool(), new BusinessProcessInsightsTool(), ];
- src/tools/ai-enhanced-tools.ts:168-170 (handler)Class definition implementing the MCP Tool interface, including name and description.export class SmartDataAnalysisTool implements Tool { [key: string]: unknown; name = 'smart-data-analysis';