get_performance_metrics
Retrieve detailed performance metrics from the self-learning server to analyze tool usage patterns and track system improvements over time.
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 get_performance_metrics tool. It extracts metrics from the learning engine, applies time range filtering (placeholder), computes detailed tool usage and error breakdowns, and includes 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() }; }
- Input schema defining the parameters for the tool, specifically an optional 'timeRange' with allowed values.inputSchema: { type: 'object', properties: { timeRange: { type: 'string', enum: ['hour', 'day', 'week', 'all'], default: 'all' } } }
- mcp-self-learning-server.js:1042-1055 (registration)Tool registration in the MCP server's tools array, specifying name, description, and input schema for MCP discovery.{ name: 'get_performance_metrics', description: 'Get detailed performance metrics', inputSchema: { type: 'object', properties: { timeRange: { type: 'string', enum: ['hour', 'day', 'week', 'all'], default: 'all' } } } }
- mcp-self-learning-server.js:1098-1100 (registration)Dispatch case in the MCP tool request handler that routes calls to get_performance_metrics to its handler function.case 'get_performance_metrics': result = await this.handleGetPerformanceMetrics(args); break;