Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

cluster_status

Check CockroachDB cluster health status including node count and live nodes for monitoring and troubleshooting.

Instructions

Get the health status of the CockroachDB cluster.

Returns:
    Cluster health including node count and live nodes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler and registration for the 'cluster_status' tool. Thin wrapper that delegates to cluster.cluster_health() with error handling.
    @mcp.tool()
    async def cluster_status() -> dict[str, Any]:
        """Get the health status of the CockroachDB cluster.
    
        Returns:
            Cluster health including node count and live nodes.
        """
        try:
            return await cluster.cluster_health()
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • Core helper function implementing cluster health check by querying cluster organization, version, total nodes, live nodes, and determining status.
    async def cluster_health() -> dict[str, Any]:
        """Get the health status of the CockroachDB cluster.
    
        Returns:
            Cluster health information.
        """
        conn = await connection_manager.ensure_connected()
    
        try:
            result: dict[str, Any] = {"status": "healthy"}
    
            async with conn.cursor() as cur:
                # Get cluster settings
                await cur.execute("SHOW CLUSTER SETTING cluster.organization")
                org_row = await cur.fetchone()
                result["organization"] = org_row.get("cluster.organization") if org_row else None
    
                # Get version
                await cur.execute("SELECT version()")
                version_row = await cur.fetchone()
                result["version"] = version_row.get("version") if version_row else None
    
                # Get node count
                await cur.execute("SELECT count(*) as node_count FROM crdb_internal.gossip_nodes")
                node_row = await cur.fetchone()
                result["node_count"] = node_row.get("node_count") if node_row else 0
    
                # Get live node count
                await cur.execute("""
                    SELECT count(*) as live_nodes
                    FROM crdb_internal.gossip_nodes
                    WHERE is_live = true
                """)
                live_row = await cur.fetchone()
                result["live_nodes"] = live_row.get("live_nodes") if live_row else 0
    
                # Check if cluster is healthy
                if result["live_nodes"] < result["node_count"]:
                    result["status"] = "degraded"
                    result["message"] = (
                        f"{result['node_count'] - result['live_nodes']} node(s) are not live"
                    )
    
            return result
        except Exception as e:
            return {"status": "error", "error": str(e)}
Behavior3/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. It discloses that the tool returns cluster health information, including node count and live nodes, which is useful behavioral context. However, it doesn't mention potential limitations like authentication requirements, rate limits, or error conditions, leaving gaps for a read-only health check tool.

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

Conciseness5/5

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

The description is highly concise and well-structured, with two brief sentences that front-load the core purpose and then specify the return value. Every sentence adds clear value without any wasted words, making it efficient for an agent to parse.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, read-only health check) and the presence of an output schema, the description is largely complete. It explains what the tool does and what it returns, though it could benefit from slight elaboration on usage guidelines relative to siblings to achieve full completeness.

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 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The baseline for this scenario is 4, as the description appropriately avoids redundant information and focuses on the tool's purpose and output.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('health status of the CockroachDB cluster'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'node_status' or 'list_nodes', which also provide cluster-related information, preventing a perfect score.

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

Usage Guidelines2/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 sibling tools like 'node_status' and 'list_nodes' available, it fails to specify scenarios where this tool is preferred or excluded, leaving the agent to infer usage from context alone.

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/bpamiri/cockroachdb-mcp'

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