Skip to main content
Glama
jghidalgo

Lambda Performance MCP Server

by jghidalgo

track_cold_starts

Analyze AWS Lambda cold start patterns to identify performance bottlenecks and optimize function initialization times. Specify a function name and time range to track cold start occurrences and durations.

Instructions

Track and analyze cold start patterns for Lambda functions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionNameYesName of the Lambda function
timeRangeNoTime range for cold start analysis (default: 24h)

Implementation Reference

  • index.js:64-82 (registration)
    Registration of the track_cold_starts tool in the ListTools response, including name, description, and input schema
    {
      name: 'track_cold_starts',
      description: 'Track and analyze cold start patterns for Lambda functions',
      inputSchema: {
        type: 'object',
        properties: {
          functionName: {
            type: 'string',
            description: 'Name of the Lambda function'
          },
          timeRange: {
            type: 'string',
            enum: ['1h', '6h', '24h', '7d'],
            description: 'Time range for cold start analysis (default: 24h)'
          }
        },
        required: ['functionName']
      }
    },
  • Input schema definition for track_cold_starts tool parameters
    inputSchema: {
      type: 'object',
      properties: {
        functionName: {
          type: 'string',
          description: 'Name of the Lambda function'
        },
        timeRange: {
          type: 'string',
          enum: ['1h', '6h', '24h', '7d'],
          description: 'Time range for cold start analysis (default: 24h)'
        }
      },
      required: ['functionName']
    }
  • Tool handler method that processes tool arguments, delegates to ColdStartTracker for analysis, formats the markdown response, and returns it
    async trackColdStarts(args) {
      const { functionName, timeRange = '24h' } = args;
      
      const coldStartData = await this.coldStartTracker.trackColdStarts(
        functionName, 
        timeRange
      );
    
      return {
        content: [
          {
            type: 'text',
            text: `# Cold Start Analysis: ${functionName}\n\n` +
                  `## Cold Start Statistics\n` +
                  `- **Total Cold Starts**: ${coldStartData.total}\n` +
                  `- **Cold Start Rate**: ${coldStartData.rate}%\n` +
                  `- **Average Cold Start Duration**: ${coldStartData.avgDuration}ms\n` +
                  `- **Longest Cold Start**: ${coldStartData.maxDuration}ms\n\n` +
                  `## Cold Start Patterns\n` +
                  `- **Peak Hours**: ${coldStartData.peakHours.join(', ')}\n` +
                  `- **Frequency**: ${coldStartData.frequency}\n` +
                  `- **Triggers**: ${coldStartData.triggers.join(', ')}\n\n` +
                  `## Optimization Opportunities\n` +
                  `${coldStartData.recommendations.map(rec => `- ${rec}`).join('\n')}\n\n` +
                  `## Timeline\n` +
                  `${this.formatColdStartTimeline(coldStartData.timeline)}`
          }
        ]
      };
    }
  • Core helper function in ColdStartTracker that fetches cold start events from CloudWatch Logs, performs analysis on patterns, statistics, and generates recommendations
    async trackColdStarts(functionName, timeRange) {
      const timeRangeMs = this.parseTimeRange(timeRange);
      const endTime = new Date();
      const startTime = new Date(endTime.getTime() - timeRangeMs);
      
      const logGroupName = `/aws/lambda/${functionName}`;
      
      try {
        // Get cold start events
        const coldStartEvents = await this.getColdStartEvents(logGroupName, startTime, endTime);
        
        // Get all invocation events for comparison
        const allInvocations = await this.getAllInvocations(logGroupName, startTime, endTime);
        
        // Analyze patterns
        const analysis = this.analyzeColdStartPatterns(coldStartEvents, allInvocations, timeRange);
        
        return {
          total: coldStartEvents.length,
          rate: this.calculateColdStartRate(coldStartEvents.length, allInvocations.length),
          avgDuration: analysis.avgDuration,
          maxDuration: analysis.maxDuration,
          minDuration: analysis.minDuration,
          peakHours: analysis.peakHours,
          frequency: analysis.frequency,
          triggers: analysis.triggers,
          recommendations: this.generateRecommendations(analysis),
          timeline: this.createTimeline(coldStartEvents, timeRange),
          patterns: analysis.patterns,
          statistics: analysis.statistics
        };
      } catch (error) {
        console.error('Error tracking cold starts:', error);
        return this.getEmptyResult();
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('track and analyze') but lacks details on what the analysis entails, output format, whether it's read-only or mutative, rate limits, or authentication needs. This is a significant gap for a tool with potential complexity in analyzing patterns.

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 front-loads the core purpose without unnecessary words. It uses clear terminology and avoids redundancy, making it appropriately sized for the tool's scope.

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 no annotations, no output schema, and a tool that involves analysis (implying potential complexity), the description is incomplete. It doesn't explain what 'track and analyze' yields, such as metrics, trends, or actionable insights, leaving gaps in understanding the tool's full behavior and output.

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 fully documents both parameters (functionName and timeRange with enum values). The description adds no additional parameter semantics beyond implying cold start analysis, which is already covered by the tool's purpose. This meets the baseline for high schema coverage.

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 verb ('track and analyze') and resource ('cold start patterns for Lambda functions'), making the purpose evident. It distinguishes from siblings by focusing specifically on cold starts rather than general performance, memory, cost, or listing functions. However, it doesn't explicitly differentiate from 'analyze_lambda_performance' which might overlap, preventing a perfect score.

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. It doesn't mention prerequisites, context, or exclusions, and fails to reference sibling tools like 'analyze_lambda_performance' or 'monitor_real_time_performance' that might be relevant for performance analysis. Usage is implied but not articulated.

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