Skip to main content
Glama

get_target_health

Retrieve health status of targets in an AWS Target Group to monitor application availability and troubleshoot load balancing issues.

Instructions

Retrieves the health of targets in a specified Target Group.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_group_arnYesThe ARN of the Target Group.

Implementation Reference

  • Handler implementation for the 'get_target_health' tool. It takes a target group ARN, calls DescribeTargetHealthCommand using the ELBv2 client, processes the target health descriptions, and returns a JSON-formatted list of target health statuses.
    if (name === "get_target_health") { const tgArn = (args as any)?.target_group_arn; const command = new DescribeTargetHealthCommand({ TargetGroupArn: tgArn }); const response = await elbv2Client.send(command); const healths = response.TargetHealthDescriptions?.map(th => ({ Target: { Id: th.Target?.Id, Port: th.Target?.Port }, State: th.TargetHealth?.State, Reason: th.TargetHealth?.Reason, Description: th.TargetHealth?.Description })) || []; return { content: [{ type: "text", text: JSON.stringify(healths, null, 2) }] }; }
  • src/index.ts:592-605 (registration)
    Registration of the 'get_target_health' tool in the ListTools response, including name, description, and input schema.
    { name: "get_target_health", description: "Retrieves the health of targets in a specified Target Group.", inputSchema: { type: "object", properties: { target_group_arn: { type: "string", description: "The ARN of the Target Group." } }, required: ["target_group_arn"] } },
  • Input schema definition for the 'get_target_health' tool, specifying the required target_group_arn parameter.
    inputSchema: { type: "object", properties: { target_group_arn: { type: "string", description: "The ARN of the Target Group." } }, required: ["target_group_arn"] }
  • Initialization of the ELBv2 client used by the get_target_health handler.
    const elbv2Client = new ElasticLoadBalancingV2Client({});
  • Import of ElasticLoadBalancingV2Client and DescribeTargetHealthCommand (among others) required for the tool implementation.
    import { ElasticLoadBalancingV2Client, DescribeLoadBalancersCommand, DescribeTargetGroupsCommand, DescribeTargetHealthCommand, DescribeListenersCommand, DescribeRulesCommand } from "@aws-sdk/client-elastic-load-balancing-v2";

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