get_performance_metrics
Analyze and retrieve detailed performance metrics within specified time ranges, enabling informed decision-making and continuous improvement through data-driven insights.
Instructions
Get detailed performance metrics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeRange | No | all |
Implementation Reference
- mcp-self-learning-server.js:1303-1325 (handler)The core handler function that implements the logic for the 'get_performance_metrics' MCP tool. It extracts metrics from the learning engine, applies time range filtering (placeholder), computes tool and error breakdowns, and returns structured metrics with recommendations.async handleGetPerformanceMetrics(args) { const { timeRange = 'all' } = args; const metrics = { ...this.learningEngine.metrics }; // Filter by time range if needed if (timeRange !== 'all') { // In production, would filter based on actual timestamps metrics.timeRange = timeRange; } // Add detailed breakdowns metrics.toolBreakdown = Array.from(metrics.toolUsageFrequency.entries()) .map(([tool, count]) => ({ tool, count, percentage: (count / metrics.totalInteractions * 100).toFixed(2) })); metrics.errorBreakdown = Array.from(metrics.errorPatterns.entries()) .map(([error, count]) => ({ error, count })); return { success: true, metrics, recommendations: this.learningEngine.generateGlobalRecommendations() }; }
- mcp-self-learning-server.js:1042-1055 (registration)The tool registration object in the listTools response handler, defining the name, description, and input schema for 'get_performance_metrics'.{ name: 'get_performance_metrics', description: 'Get detailed performance metrics', inputSchema: { type: 'object', properties: { timeRange: { type: 'string', enum: ['hour', 'day', 'week', 'all'], default: 'all' } } } }
- The input schema defining the parameters for the get_performance_metrics tool, specifically the optional timeRange parameter.inputSchema: { type: 'object', properties: { timeRange: { type: 'string', enum: ['hour', 'day', 'week', 'all'], default: 'all' } } }