Skip to main content
Glama
jghidalgo

Lambda Performance MCP Server

by jghidalgo

monitor_real_time_performance

Monitor AWS Lambda function performance metrics and receive alerts in real-time to identify issues and optimize execution.

Instructions

Get real-time performance metrics and alerts for Lambda functions

Input Schema

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

Implementation Reference

  • Primary tool handler: destructures args, calls LambdaAnalyzer.monitorRealTime(), formats and returns the response content.
    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')}`
          }
        ]
      };
    }
  • Core implementation logic: fetches real-time metrics from CloudWatch, recent activity from logs, checks alerts, computes error rate and returns monitoring data.
    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
      };
    }
  • Tool schema definition including input schema with functionName (required) and optional duration.
    {
      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-233 (registration)
    Tool dispatch/registration in the CallToolRequestSchema switch statement.
    case 'monitor_real_time_performance':
      return await this.monitorRealTimePerformance(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'real-time performance metrics and alerts' but doesn't specify what metrics are included, how alerts are triggered, whether this is a read-only operation, or any rate limits. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of performance monitoring and the lack of annotations and output schema, the description is insufficient. It doesn't explain what metrics or alerts are returned, how the data is formatted, or any prerequisites like permissions. For a tool with no structured behavioral data, this leaves too much ambiguity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('functionName' and 'duration') with clear descriptions. The description doesn't add any additional meaning or context beyond what the schema provides, such as explaining the scope of 'real-time' or how 'duration' affects the output.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and target ('real-time performance metrics and alerts for Lambda functions'), making the purpose understandable. However, it doesn't differentiate from siblings like 'analyze_lambda_performance' or 'track_cold_starts', which might also involve performance monitoring aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'analyze_lambda_performance', 'track_cold_starts', and 'compare_lambda_performance', there's no indication of what makes this tool distinct or when it's preferred over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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