Skip to main content
Glama

list_nat_gateways

Retrieve NAT Gateways with their state and public IP addresses to monitor network connectivity and manage AWS infrastructure. Optionally filter by VPC ID.

Instructions

Lists NAT Gateways with their state and public IP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vpc_idNoOptional: Filter by VPC ID.

Implementation Reference

  • Handler implementation for the 'list_nat_gateways' tool. It optionally filters by VPC ID, calls DescribeNatGatewaysCommand via ec2Client, maps the response to a simplified format including ID, VPC, subnet, state, public IP, and name tag, and returns as JSON.
    if (name === "list_nat_gateways") { const vpcId = (args as any)?.vpc_id; const input: any = {}; if (vpcId) input.Filter = [{ Name: "vpc-id", Values: [vpcId] }]; const command = new DescribeNatGatewaysCommand(input); const response = await ec2Client.send(command); const nats = response.NatGateways?.map(nat => ({ NatGatewayId: nat.NatGatewayId, VpcId: nat.VpcId, SubnetId: nat.SubnetId, State: nat.State, PublicIp: nat.NatGatewayAddresses?.[0]?.PublicIp, Name: nat.Tags?.find(t => t.Key === "Name")?.Value })) || []; return { content: [{ type: "text", text: JSON.stringify(nats, null, 2) }] }; }
  • src/index.ts:331-339 (registration)
    Tool registration in the ListTools response, including name, description, and input schema (optional vpc_id).
    name: "list_nat_gateways", description: "Lists NAT Gateways with their state and public IP.", inputSchema: { type: "object", properties: { vpc_id: { type: "string", description: "Optional: Filter by VPC ID." } } } },
  • Input schema definition for the 'list_nat_gateways' tool as part of its registration.
    name: "list_nat_gateways", description: "Lists NAT Gateways with their state and public IP.", inputSchema: { type: "object", properties: { vpc_id: { type: "string", description: "Optional: Filter by VPC ID." } } } },
  • Import of DescribeNatGatewaysCommand and EC2Client used by the handler.
    import { EC2Client, DescribeInstancesCommand, DescribeSecurityGroupsCommand, DescribeAddressesCommand, DescribeVolumesCommand, DescribeVpcsCommand, DescribeSubnetsCommand, DescribeRouteTablesCommand, DescribeInternetGatewaysCommand, DescribeNatGatewaysCommand } from "@aws-sdk/client-ec2";
  • Initialization of the shared EC2Client instance used by the list_nat_gateways handler.
    const ec2Client = new EC2Client({});

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/Bhavesh8890/MCP-server'

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