Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CRDB_HOST | Yes | CockroachDB host | |
| CRDB_PORT | No | Database port | 26257 |
| CRDB_USER | Yes | Database username | |
| CRDB_CLUSTER | No | Cloud cluster ID | |
| CRDB_SSLMODE | No | SSL mode | require |
| CRDB_DATABASE | Yes | Database name | |
| CRDB_MAX_ROWS | No | Max rows per query | 1000 |
| CRDB_PASSWORD | No | Database password | |
| CRDB_READ_ONLY | No | Block write operations | false |
| CRDB_BLOCKED_COMMANDS | No | Commands to block |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| connect | Connect to the CockroachDB cluster. Uses configuration from environment variables (CRDB_HOST, CRDB_USER, etc.).
Returns:
Connection status and cluster information. |
| disconnect | Disconnect from the CockroachDB cluster. Returns:
Disconnection status. |
| cluster_status | Get the health status of the CockroachDB cluster. Returns:
Cluster health including node count and live nodes. |
| execute_query | Execute a SQL query. Args:
sql: SQL statement to execute.
max_rows: Maximum rows to return (default: from config).
Returns:
Query results with columns and rows. |
| validate_query | Check if a query is safe to execute without running it. Args:
sql: SQL statement to validate.
Returns:
Validation result with any issues found. |
| explain_query | Get the execution plan for a query. Args:
sql: SQL query to explain.
analyze: If True, actually execute to get runtime stats.
Returns:
Query execution plan. |
| list_databases | List all databases in the cluster. Args:
include_system: Include system databases (postgres, defaultdb, etc.).
Returns:
List of databases. |
| list_schemas | List schemas in the current database. Returns:
List of schemas. |
| list_tables | List all tables in the database. Args:
schema: Filter by schema name (default: all user schemas).
include_views: Include views in results.
include_system: Include system tables.
Returns:
List of tables with schema, name, and type. |
| describe_table | Get detailed column information for a table. Args:
table: Table name (schema.table or just table for public schema).
Returns:
Table structure with columns, indexes, and primary key. |
| get_table_stats | Get statistics for a table. Args:
table: Table name (schema.table or just table).
Returns:
Table statistics including row count and size. |
| get_foreign_keys | Get foreign key constraints for a table. Args:
table: Table name (schema.table or just table).
Returns:
Foreign key information. |
| read_rows | Read rows from a table. Args:
table: Table name (schema.table or just table).
id_value: Primary key value for single row lookup.
id_column: Name of the ID column (default: 'id').
where: WHERE clause (without 'WHERE').
columns: List of columns to return (default: all).
order_by: ORDER BY clause (without 'ORDER BY').
limit: Maximum rows to return.
Returns:
Query results. |
| insert_row | Insert a new row into a table. Args:
table: Table name (schema.table or just table).
data: Column names and values to insert.
returning: Columns to return from inserted row.
Returns:
Insert result. |
| update_row | Update an existing row by primary key. Args:
table: Table name (schema.table or just table).
id_value: Primary key value.
data: Column names and new values.
id_column: Name of the ID column (default: 'id').
returning: Columns to return from updated row.
Returns:
Update result. |
| delete_row | Delete a row by primary key. Args:
table: Table name (schema.table or just table).
id_value: Primary key value.
id_column: Name of the ID column (default: 'id').
Returns:
Delete result. |
| upsert_row | Insert or update a row (UPSERT). Args:
table: Table name (schema.table or just table).
data: Column names and values.
conflict_columns: Columns to check for conflicts (usually primary key).
update_columns: Columns to update on conflict (default: all except conflict columns).
returning: Columns to return.
Returns:
Upsert result. |
| switch_database | Switch the active database context. Args:
database_name: Database to switch to.
Returns:
Switch status. |
| begin_transaction | Begin a database transaction. Returns:
Transaction status. |
| commit_transaction | Commit the current transaction. Returns:
Commit status. |
| rollback_transaction | Rollback the current transaction. Returns:
Rollback status. |
| list_nodes | List all nodes in the CockroachDB cluster. Returns:
List of cluster nodes with their status. |
| node_status | Get detailed status for a node. Args:
node_id: Specific node ID (optional, returns all if not specified).
Returns:
Node status information. |
| show_regions | Show database regions for multi-region clusters. Returns:
Region information. |
| show_jobs | Show background jobs in the cluster. Args:
job_type: Filter by job type (BACKUP, RESTORE, IMPORT, etc.).
status: Filter by status (running, succeeded, failed, etc.).
limit: Maximum jobs to return.
Returns:
List of jobs. |
| show_sessions | Show active sessions in the cluster. Args:
active_only: Only show sessions with active queries.
Returns:
List of sessions. |
| show_statements | Show active statements in the cluster. Args:
limit: Maximum statements to return.
Returns:
List of active statements. |
| cancel_query | Cancel a running query. Args:
query_id: The query ID to cancel.
Returns:
Cancellation result. |
| show_ranges | Show range distribution in the cluster. Args:
table: Optional table to filter ranges.
limit: Maximum ranges to return.
Returns:
Range distribution information. |
| show_zone_config | Show zone configurations. Args:
table: Optional table to get zone config for.
Returns:
Zone configuration. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |