list_lambda_functions
Retrieve and analyze all AWS Lambda functions in an account, with optional runtime filtering and performance metrics. Optimize function performance and track key insights using Lambda Performance MCP Server.
Instructions
List all Lambda functions in the account with basic performance info
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeMetrics | No | Include basic performance metrics (default: false) | |
| runtime | No | Filter by runtime (e.g., nodejs18.x, python3.9) |
Implementation Reference
- index.js:130-146 (registration)Tool registration in the ListToolsRequestSchema handler response, defining the name, description, and input schema for list_lambda_functions.{ name: 'list_lambda_functions', description: 'List all Lambda functions in the account with basic performance info', inputSchema: { type: 'object', properties: { runtime: { type: 'string', description: 'Filter by runtime (e.g., nodejs18.x, python3.9)' }, includeMetrics: { type: 'boolean', description: 'Include basic performance metrics (default: false)' } } } },
- index.js:380-407 (handler)The primary handler function for the list_lambda_functions tool. Extracts arguments, delegates to LambdaAnalyzer.listFunctions, and formats the markdown response.async listLambdaFunctions(args) { const { runtime, includeMetrics = false } = args; const functions = await this.lambdaAnalyzer.listFunctions(runtime, includeMetrics); return { content: [ { type: 'text', text: `# Lambda Functions\n\n` + `## Summary\n` + `- **Total Functions**: ${functions.length}\n` + `- **Runtimes**: ${[...new Set(functions.map(f => f.runtime))].join(', ')}\n\n` + `## Functions List\n` + `${functions.map(func => `### ${func.name}\n` + `- **Runtime**: ${func.runtime}\n` + `- **Memory**: ${func.memory}MB\n` + `- **Timeout**: ${func.timeout}s\n` + `- **Last Modified**: ${func.lastModified}\n` + `${includeMetrics ? `- **Avg Duration**: ${func.metrics?.avgDuration || 'N/A'}ms\n` + `- **Cold Start Rate**: ${func.metrics?.coldStartRate || 'N/A'}%\n` + `- **Error Rate**: ${func.metrics?.errorRate || 'N/A'}%\n` : ''}\n` ).join('')}` } ] };
- index.js:223-224 (handler)Dispatch case in the CallToolRequestSchema handler that routes to the listLambdaFunctions method.case 'list_lambda_functions': return await this.listLambdaFunctions(args);
- src/lambda-analyzer.js:127-164 (helper)Core helper function in LambdaAnalyzer class that executes AWS Lambda ListFunctionsCommand, filters by runtime, optionally fetches metrics via analyzeFunction, and structures the output.async listFunctions(runtime, includeMetrics) { const command = new ListFunctionsCommand({}); const response = await this.lambdaClient.send(command); let functions = response.Functions || []; if (runtime) { functions = functions.filter(func => func.Runtime === runtime); } const result = []; for (const func of functions) { const functionInfo = { name: func.FunctionName, runtime: func.Runtime, memory: func.MemorySize, timeout: func.Timeout, lastModified: func.LastModified }; if (includeMetrics) { try { const quickAnalysis = await this.analyzeFunction(func.FunctionName, '24h', false); functionInfo.metrics = { avgDuration: quickAnalysis.avgDuration, coldStartRate: quickAnalysis.coldStartRate, errorRate: quickAnalysis.errorRate }; } catch (error) { functionInfo.metrics = null; } } result.push(functionInfo); } return result; }