get_cluster_health
Retrieve the health status of an OpenSearch cluster using natural language commands to monitor and manage cluster performance effectively.
Instructions
Get cluster health status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'get_cluster_health' tool. It uses the OpenSearch client to fetch cluster health status and returns it as TextContent.@mcp.tool(description="Get cluster health status") async def get_cluster_health() -> list[TextContent]: """ Get health status of the Opensearch cluster. Returns information about the number of nodes, shards, etc. """ self.logger.info("Getting cluster health") try: response = self.es_client.cluster.health() return [TextContent(type="text", text=str(response))] except Exception as e: self.logger.error(f"Error getting cluster health: {e}") return [TextContent(type="text", text=f"Error: {str(e)}")]
- src/opensearch_mcp_server/server.py:38-38 (registration)Registration of the ClusterTools instance, which defines and registers the get_cluster_health tool via its register_tools method.cluster_tools.register_tools(self.mcp)