Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

aws_list_ec2_instances

Retrieve and display all Amazon EC2 instances in a specified AWS region to monitor and manage cloud infrastructure resources.

Instructions

List all EC2 instances in AWS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoAWS regionus-east-1

Implementation Reference

  • Tool handler logic: invokes AWSAdapter.listEC2Instances(), maps instances to simplified response format with total count and instance details.
    case 'aws_list_ec2_instances': {
      const instances = await adapter.listEC2Instances();
      return {
        total: instances.length,
        instances: instances.map((inst) => ({
          id: inst.id,
          name: inst.name,
          type: inst.instanceType,
          status: inst.status,
          privateIp: inst.privateIp,
          publicIp: inst.publicIp,
          region: inst.region,
        })),
      };
    }
  • Core AWS SDK implementation: initializes EC2 client with credentials, sends DescribeInstancesCommand, processes reservations and instances, maps AWS data to EC2Instance objects using helpers.
    async listEC2Instances(): Promise<EC2Instance[]> {
      await this.initializeClients();
      if (!this.ec2Client) throw new Error('EC2 client not initialized');
    
      try {
        const command = new DescribeInstancesCommand({});
        const response = await this.ec2Client.send(command);
    
        const instances: EC2Instance[] = [];
    
        for (const reservation of response.Reservations || []) {
          for (const instance of reservation.Instances || []) {
            instances.push({
              id: instance.InstanceId || '',
              type: 'instance',
              name: this.getInstanceName(instance.Tags),
              region: this.region,
              status: this.mapInstanceState(instance.State?.Name),
              instanceType: instance.InstanceType || '',
              imageId: instance.ImageId || '',
              privateIp: instance.PrivateIpAddress,
              publicIp: instance.PublicIpAddress,
              launchTime: instance.LaunchTime,
              tags: this.extractTags(instance.Tags),
            });
          }
        }
    
        return instances;
      } catch (error) {
        throw new Error(`Failed to list EC2 instances: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Tool definition including name, description, and input schema for optional AWS region parameter.
    {
      name: 'aws_list_ec2_instances',
      description: 'List all EC2 instances in AWS',
      inputSchema: {
        type: 'object',
        properties: {
          region: {
            type: 'string',
            description: 'AWS region',
            default: 'us-east-1',
          },
        },
      },
    },
  • src/server.ts:19-27 (registration)
    Registers the awsTools (including aws_list_ec2_instances) by spreading into the full allTools list provided to MCP server.
    const allTools = [
      ...awsTools,
      ...azureTools,
      ...gcpTools,
      ...resourceManagementTools,
      ...costAnalysisTools,
      ...monitoringTools,
      ...securityTools,
    ];
  • src/server.ts:64-65 (registration)
    Routes tool calls matching awsTools to the handleAWSTool dispatcher.
    if (awsTools.some((t) => t.name === name)) {
      result = await handleAWSTool(name, args || {});
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. It states the action ('List') but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires specific AWS permissions, potential rate limits, or the format of the returned data. This leaves significant gaps for an agent to understand how to use it effectively.

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, direct sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's purpose.

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 cover behavioral aspects like safety (read-only vs. destructive), authentication needs, or what the output looks like (e.g., list format, pagination). For a tool interacting with a cloud service, more context is needed for reliable agent use.

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?

The input schema has 100% description coverage, with the single parameter 'region' documented as 'AWS region' with a default value. The description doesn't add any semantic details beyond this, such as explaining region selection implications or listing behavior. Given the high schema coverage, a baseline score of 3 is appropriate.

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 action ('List') and resource ('EC2 instances in AWS'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'aws_list_rds_instances' or 'aws_list_s3_buckets' beyond the resource type, nor does it specify scope details like whether it lists all instances across all regions or just one region.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention when to choose this over 'list_resources' or other AWS-specific listing tools, nor does it specify prerequisites like authentication or region selection. The description is a simple statement without context.

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

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