Skip to main content
Glama
bpamiri

CockroachDB MCP Server

by bpamiri

show_regions

Display database regions in multi-region CockroachDB clusters to identify available geographic locations for data distribution and query routing.

Instructions

Show database regions for multi-region clusters.

Returns:
    Region information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'show_regions' tool using @mcp.tool() decorator. This handler delegates to the cluster module implementation.
    @mcp.tool()
    async def show_regions() -> dict[str, Any]:
        """Show database regions for multi-region clusters.
    
        Returns:
            Region information.
        """
        try:
            return await cluster.show_regions()
        except Exception as e:
            return {"status": "error", "error": str(e)}
  • Core implementation of show_regions that queries CockroachDB for database regions, primary/secondary regions, survival goal, and cluster regions using crdb_internal tables and SHOW REGIONS.
    async def show_regions() -> dict[str, Any]:
        """Show database regions for multi-region clusters.
    
        Returns:
            Region information.
        """
        conn = await connection_manager.ensure_connected()
    
        try:
            async with conn.cursor() as cur:
                # Get database regions
                await cur.execute("""
                    SELECT
                        database_name,
                        primary_region,
                        secondary_region,
                        regions,
                        survival_goal
                    FROM crdb_internal.databases
                    WHERE database_name = current_database()
                """)
                db_row = await cur.fetchone()
    
                if not db_row:
                    return {
                        "status": "success",
                        "database": connection_manager.current_database,
                        "is_multi_region": False,
                        "message": "Database is not configured for multi-region",
                    }
    
                # Get all regions in the cluster
                await cur.execute("SHOW REGIONS")
                region_rows = await cur.fetchall()
    
            regions = [row.get("region") for row in region_rows if row.get("region")]
    
            return {
                "status": "success",
                "database": db_row.get("database_name"),
                "primary_region": db_row.get("primary_region"),
                "secondary_region": db_row.get("secondary_region"),
                "regions": db_row.get("regions"),
                "survival_goal": db_row.get("survival_goal"),
                "cluster_regions": regions,
                "is_multi_region": bool(db_row.get("primary_region")),
            }
        except Exception as e:
            # Multi-region may not be enabled
            if "unknown function" in str(e).lower() or "regions" in str(e).lower():
                return {
                    "status": "success",
                    "is_multi_region": False,
                    "message": "Multi-region is not enabled for this cluster",
                }
            return {"status": "error", "error": str(e)}
Behavior2/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. It mentions the tool returns 'Region information,' but doesn't specify what that includes (e.g., region names, statuses, configurations), whether it's read-only, requires permissions, or has side effects. For a tool with zero annotation coverage, this is insufficient to inform safe and effective use.

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 brief with two sentences, but the second sentence 'Returns: Region information.' is redundant and adds little value beyond what might be inferred from the first. It could be more front-loaded or integrated into a single, more informative statement without losing clarity.

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

Completeness3/5

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

Given the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is minimally adequate. However, it lacks details on what 'Region information' entails, which could be important for understanding the tool's output. With no annotations and simple context, it meets the basic threshold but doesn't fully leverage the opportunity to clarify behavior.

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 the schema description coverage is 100% (though empty). The description doesn't need to add parameter details, so it meets the baseline for a parameterless tool. No additional semantic value is required or provided, aligning with the expected standard.

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: 'Show database regions for multi-region clusters.' It specifies the verb 'show' and the resource 'database regions' with the context 'for multi-region clusters.' However, it doesn't explicitly differentiate from sibling tools like 'cluster_status' or 'list_nodes' that might also provide region-related information, keeping it at a 4 rather than a 5.

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. It doesn't mention prerequisites, timing, or comparisons to siblings like 'cluster_status' or 'list_nodes' that might overlap in functionality. This lack of usage context leaves the agent without clear direction for tool selection.

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