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; }

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