Skip to main content
Glama
eunyuljo

aws-helper MCP Server

by eunyuljo

get_ec2_summary

Retrieve summary information for EC2 instances in a specified AWS region to monitor resources and manage configurations.

Instructions

EC2 인스턴스 요약 정보를 제공합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoAWS 리전ap-northeast-2

Implementation Reference

  • The handler function that implements the get_ec2_summary tool. It creates an EC2 client, describes all instances, tallies counts by state (running, stopped, etc.) and by instance type, then returns a formatted markdown summary text.
    async function getEC2Summary(args: any) {
      const region = args?.region || 'ap-northeast-2';
      const client = new EC2Client({ region });
      
      const command = new DescribeInstancesCommand({});
      const response = await client.send(command);
      
      const summary = {
        total: 0,
        running: 0,
        stopped: 0,
        pending: 0,
        terminated: 0,
        byType: {} as Record<string, number>
      };
      
      for (const reservation of response.Reservations || []) {
        for (const instance of reservation.Instances || []) {
          summary.total++;
          
          const state = instance.State?.Name || 'unknown';
          if (state === 'running') summary.running++;
          else if (state === 'stopped') summary.stopped++;
          else if (state === 'pending') summary.pending++;
          else if (state === 'terminated') summary.terminated++;
          
          const type = instance.InstanceType || 'unknown';
          summary.byType[type] = (summary.byType[type] || 0) + 1;
        }
      }
      
      return {
        content: [
          {
            type: 'text',
            text: `📈 EC2 인스턴스 요약 (${region})\n\n` +
                  `**상태별 현황:**\n` +
                  `• 전체: ${summary.total}개\n` +
                  `• 실행 중: ${summary.running}개\n` +
                  `• 중지됨: ${summary.stopped}개\n` +
                  `• 시작 중: ${summary.pending}개\n` +
                  `• 종료됨: ${summary.terminated}개\n\n` +
                  `**인스턴스 타입별:**\n` +
                  Object.entries(summary.byType)
                    .sort(([,a], [,b]) => b - a)
                    .map(([type, count]) => `• ${type}: ${count}개`)
                    .join('\n')
          }
        ]
      };
    }
  • The input schema for the get_ec2_summary tool, defining an optional 'region' parameter with default 'ap-northeast-2'.
    inputSchema: {
      type: 'object',
      properties: {
        region: {
          type: 'string',
          description: 'AWS 리전',
          default: 'ap-northeast-2'
        }
      }
    }
  • src/index.ts:55-68 (registration)
    Registration of the get_ec2_summary tool in the ListToolsRequest handler response, specifying name, description, and input schema.
    {
      name: 'get_ec2_summary',
      description: 'EC2 인스턴스 요약 정보를 제공합니다',
      inputSchema: {
        type: 'object',
        properties: {
          region: {
            type: 'string',
            description: 'AWS 리전',
            default: 'ap-northeast-2'
          }
        }
      }
    },
  • src/index.ts:96-97 (registration)
    Registration/mapping of tool name to handler in the CallToolRequest switch dispatcher.
    case 'get_ec2_summary':
      return await getEC2Summary(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/eunyuljo/sample-mcp-server-with-claude-desktop'

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