Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

list_nodes

Retrieve the status of all nodes in a CockroachDB cluster to monitor cluster health and availability.

Instructions

List all nodes in the CockroachDB cluster.

Returns:
    List of cluster nodes with their status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'list_nodes' registered with @mcp.tool(). Delegates to cluster.list_nodes() with error handling.
    @mcp.tool()
    async def list_nodes() -> dict[str, Any]:
        """List all nodes in the CockroachDB cluster.
    
        Returns:
            List of cluster nodes with their status.
        """
        try:
            return await cluster.list_nodes()
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • Core helper function that executes the SQL query on crdb_internal.gossip_nodes to retrieve and format the list of cluster nodes.
    async def list_nodes() -> dict[str, Any]:
        """List all nodes in the CockroachDB cluster.
    
        Returns:
            List of cluster nodes with their status.
        """
        conn = await connection_manager.ensure_connected()
    
        try:
            async with conn.cursor() as cur:
                await cur.execute("""
                    SELECT
                        node_id,
                        address,
                        locality,
                        is_live,
                        CASE WHEN is_live THEN 'live' ELSE 'dead' END as status
                    FROM crdb_internal.gossip_nodes
                    ORDER BY node_id
                """)
                rows = await cur.fetchall()
    
            nodes = []
            for row in rows:
                nodes.append(
                    {
                        "node_id": row.get("node_id"),
                        "address": row.get("address"),
                        "locality": row.get("locality"),
                        "is_live": row.get("is_live"),
                        "status": row.get("status"),
                    }
                )
    
            live_count = sum(1 for n in nodes if n["is_live"])
    
            return {
                "nodes": nodes,
                "total_count": len(nodes),
                "live_count": live_count,
                "dead_count": len(nodes) - live_count,
            }
        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 states what the tool returns ('List of cluster nodes with their status'), which is helpful, but doesn't mention other behavioral aspects like whether this requires specific permissions, how the data is formatted, or if there are any rate limits or constraints.

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 extremely concise with just two sentences: one stating the purpose and one describing the return value. It's front-loaded with the main action and wastes no words, making it easy to parse quickly.

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 that there's an output schema (which handles return values), 0 parameters, and no annotations, the description provides sufficient context for a simple read operation. It clearly states what the tool does and what it returns, though it could benefit from more behavioral details given the lack of annotations.

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 no parameter documentation is needed. The description appropriately focuses on the tool's purpose and output without unnecessary parameter details, earning a high score for this dimension.

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 verb ('List') and resource ('all nodes in the CockroachDB cluster'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'node_status' or 'cluster_status', which appear to have related functionality.

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?

No guidance is provided on when to use this tool versus alternatives. With sibling tools like 'node_status' and 'cluster_status' available, the description doesn't indicate whether this is the preferred method for node information or when other tools might be more appropriate.

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