Skip to main content
Glama
seohyunjun

OpenSearch MCP Server

by seohyunjun

get_cluster_stats

Retrieve comprehensive cluster statistics from OpenSearch to monitor health, performance metrics, and resource utilization for effective cluster management.

Instructions

Get cluster statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that implements the get_cluster_stats tool. It calls self.es_client.cluster.stats() to retrieve cluster statistics and returns the response as a list of TextContent.
    @mcp.tool(description="Get cluster statistics") async def get_cluster_stats() -> list[TextContent]: """ Get statistics from a cluster wide perspective. The API returns basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins). https://opensearch.org/docs/latest/tuning-your-cluster/ """ self.logger.info("Getting cluster stats") try: response = self.es_client.cluster.stats() return [TextContent(type="text", text=str(response))] except Exception as e: self.logger.error(f"Error getting cluster stats: {e}") return [TextContent(type="text", text=f"Error: {str(e)}")]
  • Invocation of register_tools on the ClusterTools instance, which registers the get_cluster_stats tool (among others) with the MCP server instance.
    cluster_tools.register_tools(self.mcp)

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/seohyunjun/opensearch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server