dbmole
v0.2.0PostgreSQL and MySQL with connections managed at runtime by the agent, SSH tunnels, readonly.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_connections
List database connections with the layer each comes from: project (.dbmole.json, found by walking up from the project dir) or global (user store). Also shows invalid entries and broken files. Secrets are omitted.
add_connection
Add a named postgres/mysql connection. scope "global" (default) saves it to the user store; "project" saves it to .dbmole.json in the project root. Supports an optional ssh tunnel and a readonly flag. Optional ssl: true or { rejectUnauthorized, ca } (ca = PEM or file path).
| Parameter | Type | Description |
|---|---|---|
host * | string | |
name * | string | |
type * | string | |
user * | string | |
database | string | |
password | string | |
port | integer | |
queryTimeoutMs | integer | |
readonly | boolean | |
scope | string | |
ssh | object | |
ssl |
update_connection
Patch a connection by name in the layer it lives in (project or global). Set a field to null to remove it (e.g. "ssh": null); an ssh object is merged field by field, e.g. { "ssh": { "hostKey": "SHA256:..." } }. queryTimeoutMs sets the per-statement timeout (null restores the 60 s default). ssl is replaced as a whole, not merged like ssh.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
patch * | object |
remove_connection
Remove a connection by name from the layer it lives in (invalid entries too) and drop its cached pools/tunnel.
| Parameter | Type | Description |
|---|---|---|
name * | string |
test_connection
Verify a connection works end to end (including ssh tunnel if configured). Reports server version and connect+query latency.
| Parameter | Type | Description |
|---|---|---|
name * | string |
execute_sql
Execute a single SQL statement on a named connection. SELECT returns columns/rows; DML returns rowCount (and lastInsertId for mysql). Use positional params: $1.. for postgres, ? for mysql.
| Parameter | Type | Description |
|---|---|---|
connection * | string | connection name, see list_connections |
sql * | string | |
database | string | database to run against; defaults to the connection default |
params | array | positional query parameters |
rowLimit | integer |
list_databases
List databases on a connection with size in bytes. Hides postgres template databases and mysql system schemas.
| Parameter | Type | Description |
|---|---|---|
connection * | string | connection name, see list_connections |
list_tables
List tables and views (type: table | view) with approximate row counts. For postgres, optionally filter by schema; for mysql, schema is the database.
| Parameter | Type | Description |
|---|---|---|
connection * | string | connection name, see list_connections |
database | string | |
schema | string |
describe_table
Describe a table or view: columns (type, nullable, default), primary key, indexes and foreign keys.
| Parameter | Type | Description |
|---|---|---|
connection * | string | connection name, see list_connections |
table * | string | table name; may be qualified: schema.table (postgres), db.table (mysql) |
database | string | |
schema | string | postgres schema, defaults to public |