Skip to main content
Glama
jghidalgo

Lambda Performance MCP Server

by jghidalgo

monitor_real_time_performance

Track and analyze real-time performance metrics for AWS Lambda functions, including cold starts and memory usage, to optimize performance and reduce costs effectively.

Instructions

Get real-time performance metrics and alerts for Lambda functions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
durationNoMonitoring duration in minutes (default: 5)
functionNameYesName of the Lambda function

Implementation Reference

  • The main handler function for the monitor_real_time_performance tool, which delegates to LambdaAnalyzer.monitorRealTime and formats the MCP response.
    async monitorRealTimePerformance(args) { const { functionName, duration = 5 } = args; const monitoring = await this.lambdaAnalyzer.monitorRealTime( functionName, duration ); return { content: [ { type: 'text', text: `# Real-time Performance Monitoring: ${functionName}\n\n` + `## Live Metrics (Last ${duration} minutes)\n` + `- **Active Invocations**: ${monitoring.activeInvocations}\n` + `- **Recent Invocations**: ${monitoring.recentInvocations}\n` + `- **Average Duration**: ${monitoring.avgDuration}ms\n` + `- **Error Rate**: ${monitoring.errorRate}%\n` + `- **Cold Starts**: ${monitoring.coldStarts}\n\n` + `## Performance Alerts\n` + `${monitoring.alerts.length > 0 ? monitoring.alerts.map(alert => `${alert}`).join('\n') : 'No performance issues detected'}\n\n` + `## Recent Activity\n` + `${monitoring.recentActivity.map(activity => `- ${activity.timestamp}: ${activity.event} (${activity.duration}ms)` ).join('\n')}` } ] }; }
  • Schema definition for the tool input parameters in the ListTools response.
    { name: 'monitor_real_time_performance', description: 'Get real-time performance metrics and alerts for Lambda functions', inputSchema: { type: 'object', properties: { functionName: { type: 'string', description: 'Name of the Lambda function' }, duration: { type: 'number', description: 'Monitoring duration in minutes (default: 5)' } }, required: ['functionName'] } }
  • index.js:232-234 (registration)
    Tool dispatch registration in the central CallToolRequestSchema handler switch statement.
    case 'monitor_real_time_performance': return await this.monitorRealTimePerformance(args);
  • Supporting function implementing core real-time monitoring logic by querying CloudWatch metrics, logs, and generating alerts.
    async monitorRealTime(functionName, duration) { const endTime = new Date(); const startTime = new Date(endTime.getTime() - (duration * 60 * 1000)); // Get recent metrics const metrics = await this.getMetrics(functionName, startTime, endTime); // Get recent log events const recentActivity = await this.getRecentActivity(functionName, startTime, endTime); // Check for alerts const alerts = await this.checkPerformanceAlerts(functionName, metrics); return { activeInvocations: metrics.concurrentExecutions || 0, recentInvocations: metrics.invocations || 0, avgDuration: metrics.avgDuration || 0, errorRate: this.calculateErrorRate(metrics.errors, metrics.invocations), coldStarts: await this.getRecentColdStarts(functionName, startTime, endTime), alerts, recentActivity }; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jghidalgo/lambda-performance-mcp-nodejs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server