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)
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get cluster statistics' provides no information about whether this is a read-only operation, what permissions might be required, whether it has rate limits, what format the statistics are returned in, or any other behavioral characteristics. The description is minimal and fails to disclose any meaningful behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise ('Get cluster statistics') - just three words. While this avoids unnecessary verbosity, it's arguably under-specified rather than appropriately concise. For a tool with no parameters and no annotations, more context would be helpful. The structure is simple but lacks the front-loaded completeness that would make it truly effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations, no output schema, and the presence of multiple similar sibling tools, the description is incomplete. 'Get cluster statistics' doesn't explain what statistics are returned, how they differ from other cluster monitoring tools, or what the agent can expect from using this tool. For a tool in what appears to be an Elasticsearch/OpenSearch monitoring context with many alternatives, this minimal description leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the input schema has 100% description coverage (though it's empty). With no parameters to document, the description doesn't need to add parameter semantics beyond what the schema provides. The baseline for zero parameters is 4, as there's no parameter information that could be missing or inadequately described.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get cluster statistics' is a tautology that essentially restates the tool name 'get_cluster_stats'. While it correctly identifies the verb ('Get') and resource ('cluster statistics'), it doesn't provide any specific details about what kind of statistics are retrieved or how this differs from sibling tools like 'get_cluster_health' or 'get_shard_allocation'. The purpose is stated but lacks differentiation from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools that appear related to cluster monitoring (e.g., 'get_cluster_health', 'get_hot_threads', 'get_recovery_status'), there's no indication of what specific statistics this tool provides or when it should be preferred over other cluster-related tools. The description is completely silent on usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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