Skip to main content
Glama
jghidalgo

Lambda Performance MCP Server

by jghidalgo

get_optimization_recommendations

Analyze AWS Lambda functions to identify performance bottlenecks and receive actionable optimization recommendations for cold starts, memory usage, duration, and cost reduction.

Instructions

Get performance optimization recommendations for Lambda functions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionNameYesName of the Lambda function
analysisTypeNoType of optimization analysis (default: all)

Implementation Reference

  • Input schema definition for the get_optimization_recommendations tool, registered in ListToolsRequestSchema handler.
    {
      name: 'get_optimization_recommendations',
      description: 'Get performance optimization recommendations for Lambda functions',
      inputSchema: {
        type: 'object',
        properties: {
          functionName: {
            type: 'string',
            description: 'Name of the Lambda function'
          },
          analysisType: {
            type: 'string',
            enum: ['cold-start', 'memory', 'duration', 'cost', 'all'],
            description: 'Type of optimization analysis (default: all)'
          }
        },
        required: ['functionName']
      }
    },
  • index.js:217-218 (registration)
    Tool registration and dispatching in the CallToolRequestSchema switch statement.
    case 'get_optimization_recommendations':
      return await this.getOptimizationRecommendations(args);
  • Main handler function for the tool that parses arguments, delegates to PerformanceOptimizer, and formats the markdown response.
    async getOptimizationRecommendations(args) {
      const { functionName, analysisType = 'all' } = args;
      
      const recommendations = await this.performanceOptimizer.getRecommendations(
        functionName, 
        analysisType
      );
    
      return {
        content: [
          {
            type: 'text',
            text: `# Optimization Recommendations: ${functionName}\n\n` +
                  `## Priority Recommendations\n` +
                  `${recommendations.priority.map((rec, i) => 
                    `${i + 1}. **${rec.title}** (Impact: ${rec.impact})\n` +
                    `   - ${rec.description}\n` +
                    `   - Implementation: ${rec.implementation}\n` +
                    `   - Expected Improvement: ${rec.expectedImprovement}\n`
                  ).join('\n')}\n` +
                  `## Additional Optimizations\n` +
                  `${recommendations.additional.map(rec => `- ${rec}`).join('\n')}\n\n` +
                  `## Configuration Recommendations\n` +
                  `- **Memory**: ${recommendations.config.memory}MB\n` +
                  `- **Timeout**: ${recommendations.config.timeout}s\n` +
                  `- **Runtime**: ${recommendations.config.runtime}\n` +
                  `- **Architecture**: ${recommendations.config.architecture}\n\n` +
                  `## Cost Impact\n` +
                  `- **Current Monthly Cost**: $${recommendations.cost.current}\n` +
                  `- **Optimized Monthly Cost**: $${recommendations.cost.optimized}\n` +
                  `- **Potential Savings**: $${recommendations.cost.savings} (${recommendations.cost.savingsPercent}%)`
          }
        ]
      };
    }
  • Core helper method in PerformanceOptimizer class that generates specific optimization recommendations based on analysis type and function metrics.
    async getRecommendations(functionName, analysisType) {
      // Get function analysis data
      const analysis = await this.analyzeFunction(functionName);
      
      // Generate recommendations based on analysis type
      const recommendations = {
        priority: [],
        additional: [],
        config: {},
        cost: {}
      };
    
      switch (analysisType) {
        case 'cold-start':
          recommendations.priority = await this.getColdStartOptimizations(analysis);
          break;
        case 'memory':
          recommendations.priority = await this.getMemoryOptimizations(analysis);
          break;
        case 'duration':
          recommendations.priority = await this.getDurationOptimizations(analysis);
          break;
        case 'cost':
          recommendations.priority = await this.getCostOptimizations(analysis);
          break;
        case 'all':
        default:
          recommendations.priority = await this.getAllOptimizations(analysis);
          break;
      }
    
      recommendations.additional = await this.getAdditionalOptimizations(analysis);
      recommendations.config = await this.getConfigurationRecommendations(analysis);
      recommendations.cost = await this.getCostImpactAnalysis(analysis, recommendations);
    
      return recommendations;
    }
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 states what the tool does but lacks critical details: it doesn't specify if this is a read-only operation, what permissions are required, whether it triggers any side effects, or how results are returned (e.g., format, pagination). For a tool with no annotations, this is a significant gap.

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 any fluff or redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse 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 lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like safety, permissions, or return format, which are crucial for a tool that likely interacts with cloud resources. For a tool with 2 parameters and no structured safety hints, more context is needed.

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 thoroughly (functionName and analysisType with enum values). The description doesn't add any meaningful parameter semantics beyond what's in the schema, such as explaining the implications of different analysisType values. Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Get' and the resource 'performance optimization recommendations for Lambda functions', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'analyze_lambda_performance' or 'get_cost_analysis', which appear to have overlapping domains.

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 like 'analyze_lambda_performance' or 'get_cost_analysis'. There's no mention of prerequisites, context, or exclusions, leaving the agent to infer usage based on tool names alone.

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