list_load_balancers
Retrieve all Application and Network Load Balancers from AWS to monitor and manage traffic distribution across your infrastructure.
Instructions
Lists all Application and Network Load Balancers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1925-1938 (handler)The handler function that implements the core logic of the 'list_load_balancers' tool by calling AWS Elastic Load Balancing v2 DescribeLoadBalancersCommand and formatting the load balancer details for output.
if (name === "list_load_balancers") { const command = new DescribeLoadBalancersCommand({}); const response = await elbv2Client.send(command); const lbs = response.LoadBalancers?.map(lb => ({ LoadBalancerName: lb.LoadBalancerName, DNSName: lb.DNSName, Type: lb.Type, Scheme: lb.Scheme, VpcId: lb.VpcId, State: lb.State?.Code, LoadBalancerArn: lb.LoadBalancerArn })) || []; return { content: [{ type: "text", text: JSON.stringify(lbs, null, 2) }] }; } - src/index.ts:558-564 (registration)The tool registration entry in the ListToolsRequestSchema handler, which defines the tool's name, description, and input schema (empty object).
name: "list_load_balancers", description: "Lists all Application and Network Load Balancers.", inputSchema: { type: "object", properties: {} } }, - src/index.ts:67-67 (helper)Initialization of the ElasticLoadBalancingV2Client used by the list_load_balancers handler.
const elbv2Client = new ElasticLoadBalancingV2Client({}); - src/index.ts:33-33 (helper)Import of the AWS SDK client and DescribeLoadBalancersCommand used in the tool implementation.
import { ElasticLoadBalancingV2Client, DescribeLoadBalancersCommand, DescribeTargetGroupsCommand, DescribeTargetHealthCommand, DescribeListenersCommand, DescribeRulesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";