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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_vpcs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1342-1355 (handler)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: {} } }, - src/index.ts:297-300 (schema)Input schema for the 'list_vpcs' tool, which requires no parameters (empty properties).
inputSchema: { type: "object", properties: {} } - src/index.ts:19-19 (helper)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"; - src/index.ts:53-53 (helper)Initialization of the shared EC2Client instance used by the list_vpcs handler.
const ec2Client = new EC2Client({});