show_zone_config
Retrieve zone configuration settings for CockroachDB tables to manage data distribution, replication, and storage policies across cluster nodes.
Instructions
Show zone configurations.
Args:
table: Optional table to get zone config for.
Returns:
Zone configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | No |
Implementation Reference
- src/cockroachdb_mcp/server.py:552-564 (registration)Tool registration using @mcp.tool() decorator. This is the entry point handler for the MCP tool, which delegates to the cluster implementation.async def show_zone_config(table: str | None = None) -> dict[str, Any]: """Show zone configurations. Args: table: Optional table to get zone config for. Returns: Zone configuration. """ try: return await cluster.show_zone_config(table) except Exception as e: return {"status": "error", "error": str(e)}
- Core implementation of the tool logic: executes SQL SHOW ZONE CONFIGURATION queries, processes results into structured dictionary.async def show_zone_config(table: str | None = None) -> dict[str, Any]: """Show zone configurations. Args: table: Optional table to get zone config for. Returns: Zone configuration. """ conn = await connection_manager.ensure_connected() try: if table: query = f"SHOW ZONE CONFIGURATION FOR TABLE {table}" else: query = "SHOW ZONE CONFIGURATIONS" async with conn.cursor() as cur: await cur.execute(query) rows = await cur.fetchall() configs = [] for row in rows: configs.append( { "target": row.get("target"), "raw_config_sql": row.get("raw_config_sql"), } ) return {"zone_configs": configs, "count": len(configs), "table_filter": table} except Exception as e: return {"status": "error", "error": str(e)}