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
- Core handler function that executes the SQL queries to show zone configurations for a table or all.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)}
- src/cockroachdb_mcp/server.py:552-564 (registration)Tool registration using @mcp.tool() decorator. Delegates execution to the cluster module's 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)}