Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

aws_list_lambda_functions

Retrieve all AWS Lambda functions in a specified region to manage serverless resources and monitor deployments.

Instructions

List all Lambda functions in AWS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoAWS regionus-east-1

Implementation Reference

  • Core handler implementation that initializes AWS LambdaClient, executes ListFunctionsCommand, maps AWS response to LambdaFunction objects, and handles errors.
    async listLambdaFunctions(): Promise<LambdaFunction[]> {
      await this.initializeClients();
      if (!this.lambdaClient) throw new Error('Lambda client not initialized');
    
      try {
        const command = new ListFunctionsCommand({});
        const response = await this.lambdaClient.send(command);
    
        const functions: LambdaFunction[] = [];
    
        for (const func of response.Functions || []) {
          functions.push({
            id: func.FunctionArn || '',
            type: 'function',
            name: func.FunctionName || '',
            region: this.region,
            status: 'running',
            functionName: func.FunctionName || '',
            runtime: func.Runtime || '',
            memorySize: func.MemorySize,
            timeout: func.Timeout,
            lastModified: func.LastModified ? new Date(func.LastModified) : undefined,
          });
        }
    
        return functions;
      } catch (error) {
        throw new Error(`Failed to list Lambda functions: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Tool-specific handler case within handleAWSTool that calls the AWS adapter and formats the response with total count and simplified function list.
    case 'aws_list_lambda_functions': {
      const functions = await adapter.listLambdaFunctions();
      return {
        total: functions.length,
        functions: functions.map((func) => ({
          id: func.id,
          name: func.functionName,
          runtime: func.runtime,
          memorySize: func.memorySize,
          timeout: func.timeout,
          region: func.region,
        })),
      };
    }
  • Tool registration entry in awsTools array, including name, description, and input schema for optional region parameter.
    {
      name: 'aws_list_lambda_functions',
      description: 'List all Lambda functions in AWS',
      inputSchema: {
        type: 'object',
        properties: {
          region: {
            type: 'string',
            description: 'AWS region',
            default: 'us-east-1',
          },
        },
      },
    },
  • TypeScript interface defining the structure of LambdaFunction objects returned by the tool.
    export interface LambdaFunction extends AWSResource {
      type: 'function';
      functionName: string;
      runtime: string;
      memorySize?: number;
      timeout?: number;
      lastModified?: Date;
    }
  • src/server.ts:64-65 (registration)
    Top-level MCP server dispatch logic that identifies AWS tools and routes calls to handleAWSTool.
    if (awsTools.some((t) => t.name === name)) {
      result = await handleAWSTool(name, args || {});

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/code-alchemist01/Cloud-mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server