list_route_tables
Retrieve AWS VPC route tables with their routes and associations to manage network traffic flow. Filter results by VPC ID for targeted analysis.
Instructions
Lists route tables with their routes and associations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vpc_id | No | Optional: Filter by VPC ID. |
Implementation Reference
- src/index.ts:1377-1403 (handler)Handler function for the 'list_route_tables' tool. Uses AWS EC2 DescribeRouteTablesCommand, optionally filtered by VPC ID, maps response to include routes, associations, and tags.if (name === "list_route_tables") { const vpcId = (args as any)?.vpc_id; const input: any = {}; if (vpcId) input.Filters = [{ Name: "vpc-id", Values: [vpcId] }]; const command = new DescribeRouteTablesCommand(input); const response = await ec2Client.send(command); const routeTables = response.RouteTables?.map(rt => ({ RouteTableId: rt.RouteTableId, VpcId: rt.VpcId, Routes: rt.Routes?.map(r => ({ DestinationCidrBlock: r.DestinationCidrBlock, GatewayId: r.GatewayId, NatGatewayId: r.NatGatewayId, State: r.State })), Associations: rt.Associations?.map(a => ({ RouteTableAssociationId: a.RouteTableAssociationId, SubnetId: a.SubnetId, Main: a.Main })), Name: rt.Tags?.find(t => t.Key === "Name")?.Value })) || []; return { content: [{ type: "text", text: JSON.stringify(routeTables, null, 2) }] }; }
- src/index.ts:313-321 (registration)Registration of the 'list_route_tables' tool in the ListTools response, including name, description, and input schema definition.name: "list_route_tables", description: "Lists route tables with their routes and associations.", inputSchema: { type: "object", properties: { vpc_id: { type: "string", description: "Optional: Filter by VPC ID." } } } },