list_ecs_clusters
Retrieve a list of Amazon ECS clusters with their current status and running task counts for monitoring and management.
Instructions
Lists ECS clusters with their status and running task counts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:2171-2191 (handler)The handler function that implements the list_ecs_clusters tool logic using ECSClient, ListClustersCommand, and DescribeClustersCommand to list clusters with status and task counts.
if (name === "list_ecs_clusters") { const command = new ListClustersCommand({}); const response = await ecsClient.send(command); // Detail describe to get task counts const clusters = response.clusterArns || []; if (clusters.length === 0) return { content: [{ type: "text", text: "[]" }] }; const descParams = { clusters: clusters }; const descCommand = new DescribeClustersCommand(descParams); const descResponse = await ecsClient.send(descCommand); const clusterDetails = descResponse.clusters?.map(c => ({ clusterName: c.clusterName, status: c.status, runningTasksCount: c.runningTasksCount, pendingTasksCount: c.pendingTasksCount, activeServicesCount: c.activeServicesCount })) || []; return { content: [{ type: "text", text: JSON.stringify(clusterDetails, null, 2) }] }; } - src/index.ts:716-719 (registration)Registration of the 'list_ecs_clusters' tool in the ListToolsRequestSchema handler, including its description and input schema (no parameters).
name: "list_ecs_clusters", description: "Lists ECS clusters with their status and running task counts.", inputSchema: { "type": "object", "properties": {} } }, - src/index.ts:718-718 (schema)Input schema definition for the list_ecs_clusters tool (empty object, no required parameters).
inputSchema: { "type": "object", "properties": {} } - src/index.ts:71-71 (helper)Initialization of the ECSClient instance used by the list_ecs_clusters handler.
const ecsClient = new ECSClient({}); - src/index.ts:38-38 (helper)Import of necessary AWS SDK classes for ECS operations, including those used by list_ecs_clusters.
import { ECSClient, ListClustersCommand, ListServicesCommand, DescribeClustersCommand, DescribeServicesCommand } from "@aws-sdk/client-ecs";