Skip to main content
Glama

list_vpcs

Retrieve all Virtual Private Clouds (VPCs) in your current AWS region to manage network configurations and resources.

Instructions

Lists all VPCs in the current region.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_vpcs' tool. It sends a DescribeVpcsCommand to the EC2 client, maps the response to include key fields like VpcId, CidrBlock, IsDefault, State, and Name tag, then returns the formatted JSON.
    if (name === "list_vpcs") { const command = new DescribeVpcsCommand({}); const response = await ec2Client.send(command); const vpcs = response.Vpcs?.map(v => ({ VpcId: v.VpcId, CidrBlock: v.CidrBlock, IsDefault: v.IsDefault, State: v.State, Name: v.Tags?.find(t => t.Key === "Name")?.Value })) || []; return { content: [{ type: "text", text: JSON.stringify(vpcs, null, 2) }] }; }
  • src/index.ts:294-301 (registration)
    Registration of the 'list_vpcs' tool in the ListTools handler response, defining its name, description, and input schema (no parameters required).
    { name: "list_vpcs", description: "Lists all VPCs in the current region.", inputSchema: { type: "object", properties: {} } },
  • Input schema for the 'list_vpcs' tool, which requires no parameters (empty properties).
    inputSchema: { type: "object", properties: {} }
  • Import of DescribeVpcsCommand and EC2Client used by the list_vpcs 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_vpcs 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