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." }
        }
    }
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 mentions the output includes 'availability zones and available IP counts', which adds some behavioral context beyond a simple list. However, it doesn't disclose critical traits like whether this is a read-only operation, potential rate limits, authentication requirements, pagination behavior, or error conditions. For a tool with no annotations, this leaves significant gaps in understanding how it behaves.

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, efficient sentence that front-loads the core purpose ('Lists subnets') and adds clarifying details ('with availability zones and available IP counts'). There's no wasted verbiage or redundancy, making it highly concise and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one optional parameter, no output schema, no annotations), the description is minimally adequate. It specifies what data is returned, which helps contextualize the output. However, without annotations or an output schema, it lacks details on behavioral aspects like safety, performance, or error handling, leaving room for improvement in completeness for agent usage.

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 'vpc_id' documented as 'Optional: Filter by VPC ID.' The description doesn't add any parameter-specific information beyond what the schema provides. Since schema coverage is high, the baseline score of 3 is appropriate—the description doesn't compensate but doesn't need to given the schema's completeness.

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 verb ('Lists') and resource ('subnets'), and specifies what information is included ('with availability zones and available IP counts'). It distinguishes this from generic listing by mentioning the specific data fields returned, though it doesn't explicitly differentiate from sibling tools like 'list_vpcs' or 'list_security_groups' beyond the resource type.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or compare it to other listing tools in the sibling set (e.g., 'list_vpcs' for VPCs or 'list_security_groups' for security groups). The agent must infer usage based on the tool name alone.

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

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