smart-data-analysis
Analyze SAP data patterns, trends, and anomalies to generate actionable business insights using AI-powered statistical analysis and visualization recommendations.
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 |
|---|---|---|---|
| data | Yes | Array of data records to analyze - each record is a key-value object | |
| analysisType | Yes | Type of analysis to perform | |
| businessContext | No | Business context for the analysis | |
| entityType | Yes | Type of SAP entity being analyzed |
Implementation Reference
- src/tools/ai-enhanced-tools.ts:203-239 (handler)The execute method implements the core logic of the 'smart-data-analysis' tool. It uses an AI integration service to analyze provided SAP data based on the specified analysis type (trend, anomaly, forecast, correlation), 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, }; } }
- The inputSchema property defines the TypeScript schema for tool inputs, specifying required data array of SAP records, analysis type enum, 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)The SmartDataAnalysisTool instance is created and exported as part of the aiEnhancedTools array, which is used for registering AI-enhanced tools with the MCP server.export const aiEnhancedTools = [ new NaturalQueryBuilderTool(), new SmartDataAnalysisTool(), new QueryPerformanceOptimizerTool(), new BusinessProcessInsightsTool(), ];