list_target_groups
Retrieve all AWS Target Groups to manage application traffic routing and load balancing configurations.
Instructions
Lists all Target Groups.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| load_balancer_arn | No | Optional: Filter by Load Balancer ARN. |
Implementation Reference
- src/index.ts:1940-1953 (handler)Handler implementation for the 'list_target_groups' tool. Calls AWS ELBv2 DescribeTargetGroupsCommand, optionally filtered by LoadBalancerArn, and maps the response to a simplified JSON output.if (name === "list_target_groups") { const lbArn = (args as any)?.load_balancer_arn; const command = new DescribeTargetGroupsCommand(lbArn ? { LoadBalancerArn: lbArn } : {}); const response = await elbv2Client.send(command); const tgs = response.TargetGroups?.map(tg => ({ TargetGroupName: tg.TargetGroupName, Protocol: tg.Protocol, Port: tg.Port, TargetType: tg.TargetType, TargetGroupArn: tg.TargetGroupArn, LoadBalancerArns: tg.LoadBalancerArns })) || []; return { content: [{ type: "text", text: JSON.stringify(tgs, null, 2) }] }; }
- src/index.ts:565-577 (registration)Tool registration in the ListTools handler, defining the tool name, description, and input schema for 'list_target_groups'.{ name: "list_target_groups", description: "Lists all Target Groups.", inputSchema: { type: "object", properties: { load_balancer_arn: { type: "string", description: "Optional: Filter by Load Balancer ARN." } } } },
- src/index.ts:565-577 (schema)Input schema definition for the 'list_target_groups' tool, specifying optional load_balancer_arn parameter.{ name: "list_target_groups", description: "Lists all Target Groups.", inputSchema: { type: "object", properties: { load_balancer_arn: { type: "string", description: "Optional: Filter by Load Balancer ARN." } } } },