Skip to main content
Glama

list_subnets

Retrieve AWS subnet details including availability zones and available IP addresses to manage network resources and plan capacity.

Instructions

Lists subnets with availability zones and available IP counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vpc_idNoOptional: Filter by VPC ID.

Implementation Reference

  • Handler function for the 'list_subnets' tool. Uses EC2 DescribeSubnetsCommand to list subnets, optionally filtered by vpc_id, and formats the response with key details like SubnetId, AvailabilityZone, and available IPs.
    if (name === "list_subnets") { const vpcId = (args as any)?.vpc_id; const input: any = {}; if (vpcId) input.Filters = [{ Name: "vpc-id", Values: [vpcId] }]; const command = new DescribeSubnetsCommand(input); const response = await ec2Client.send(command); const subnets = response.Subnets?.map(s => ({ SubnetId: s.SubnetId, VpcId: s.VpcId, AvailabilityZone: s.AvailabilityZone, CidrBlock: s.CidrBlock, AvailableIpAddressCount: s.AvailableIpAddressCount, Name: s.Tags?.find(t => t.Key === "Name")?.Value })) || []; return { content: [{ type: "text", text: JSON.stringify(subnets, null, 2) }] }; }
  • src/index.ts:302-311 (registration)
    Registration of the 'list_subnets' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
    { name: "list_subnets", description: "Lists subnets with availability zones and available IP counts.", inputSchema: { type: "object", properties: { vpc_id: { type: "string", description: "Optional: Filter by VPC ID." } } } },
  • Input schema for the 'list_subnets' tool, defining optional vpc_id parameter.
    inputSchema: { type: "object", properties: { vpc_id: { type: "string", description: "Optional: Filter by VPC ID." } } }

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