dbhawk
v0.4.2Secure access to DBHawk datasources: browse schemas, run governed queries, DBHawk AI text-to-SQL.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_permissions Get MCP permissions
What the current user may do over MCP: their MCP tier(s), the allowed operations (with the SQL keywords that classify a statement as each operation), the row cap, and which operations need the user's confirmation. Call this before writing SQL that changes data or schema.
list_datasources List datasources
List the datasources assigned to the current user. Returns name, dbType, readOnly, requiresDbLogin, aiEnabled.
get_datasource Get datasource
Get capabilities of one datasource (dbType, readOnly, whether it needs a DB login, whether DBHawk AI is enabled).
| Parameter | Type | Description |
|---|---|---|
datasource * | string | Datasource name, e.g. 'Oracle-OVH' |
list_catalogs List catalogs
List the catalogs (databases) of a datasource, for DB types that have a catalog level above the schema (MSSQL, Snowflake). Returns an empty list for databases with no catalog concept (Oracle, MySQL, MongoDB) - for those, skip the catalog argument on list_schemas/list_objects/list_columns.
| Parameter | Type | Description |
|---|---|---|
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
list_schemas List schemas
List the schemas of a datasource.
| Parameter | Type | Description |
|---|---|---|
catalog | string | Catalog / database name, if the DB uses one |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
list_objects List objects
List database objects (tables/views/etc) in a schema. Access control of the calling user applies.
| Parameter | Type | Description |
|---|---|---|
schema * | string | Schema name |
catalog | string | Catalog / database name, if the DB uses one |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
query | string | Case-insensitive name filter |
type | string | JDBC object types, comma separated (e.g. 'TABLE,VIEW'). Defaults to TABLE. |
list_columns List columns
List the columns of a table/view: name, type, nullable.
| Parameter | Type | Description |
|---|---|---|
object * | string | Table or view name |
schema * | string | Schema name |
catalog | string | Catalog / database name, if the DB uses one |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
run_query Run read-only query
Run a READ-ONLY SQL statement (SELECT, WITH, SHOW ...) against a datasource. For execution plans use explain_plan instead. Anything that changes data or schema is refused here - use execute_statement for that. Rows are capped (default 200, the MCP tier may lower the max of 5000); the result reports { rows, rowCount, truncated }. Access control and column masking of the user apply.
| Parameter | Type | Description |
|---|---|---|
query * | string | A single read-only SQL statement |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
maxRows | integer | Row cap for this call (<= 5000) |
explain_plan Explain plan
Show the execution plan of ONE SQL statement. DBHawk builds and reads the plan in a single call on one database connection (Oracle EXPLAIN PLAN + DBMS_XPLAN, SQL Server SHOWPLAN, EXPLAIN on PostgreSQL, MySQL, Snowflake, Redshift ...), and never executes the statement. Send the plain statement, without EXPLAIN. Use this tool for plans: do NOT run EXPLAIN PLAN FOR and DBMS_XPLAN.DISPLAY through run_query - every call uses its own connection, so the plan is lost between the two calls. Returns planText (single-column plans) and the plan rows. Needs the explain_plan operation in the user's MCP tier…
| Parameter | Type | Description |
|---|---|---|
query * | string | The single SQL statement to explain, e.g. SELECT * FROM orders WHERE id = 1 |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
execute_statement Execute data / schema change
Execute ONE SQL statement that changes data or schema (INSERT, UPDATE, DELETE, MERGE, CREATE, ALTER, DROP...). Only works when the user's MCP tier allows that operation - see get_permissions. Workflow: 1) show the exact statement to the user; 2) call this tool without confirm - if the tier requires confirmation, DBHawk returns { confirmationRequired: true, executed: false } and runs nothing; 3) only after the user explicitly approves THIS statement, call again with the same statement and confirm=true. Never set confirm=true on your own initiative. Returns the affected row count.
| Parameter | Type | Description |
|---|---|---|
statement * | string | A single SQL statement that changes data or schema |
confirm | boolean | true only after the user explicitly approved this exact statement |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
list_sessions List database sessions
List the active sessions of the datasource's database: sessionId, user, status, program, machine, logonTime, secondsInCall and the current SQL (first 200 characters; omitted when DBHawk does not share data with AI models). The same sessions DBHawk's Session Manager shows. Works for Oracle, SQL Server, PostgreSQL, Redshift and MySQL / MariaDB. Needs the active_sessions operation in the user's MCP tier - see get_permissions.
| Parameter | Type | Description |
|---|---|---|
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
kill_session End a database session
End ONE database session, by a sessionId returned by list_sessions (Oracle: 'sid,serial#', e.g. '123,4567'; other databases: a number). Its open transaction is rolled back. DBHawk builds the command itself - do not send KILL / ALTER SYSTEM statements through execute_statement for this. Workflow: 1) show the session (user, program, SQL) to the user; 2) call without confirm - if the tier requires confirmation DBHawk returns { confirmationRequired: true, executed: false, session } and ends nothing; 3) only after the user explicitly approves ending THIS session, call again with confirm=true. Never…
| Parameter | Type | Description |
|---|---|---|
sessionId * | string | Session id from list_sessions, e.g. '123,4567' (Oracle) or '55' |
confirm | boolean | true only after the user explicitly approved ending this session |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
text_to_sql Text to SQL
DBHawk AI text-to-SQL: turn a natural-language question into a SQL statement for the datasource. Only works when the datasource has aiEnabled=true. It only generates statement types the user's MCP tier allows. It does not execute anything: run the result with run_query, or execute_statement for a change.
| Parameter | Type | Description |
|---|---|---|
prompt * | string | The natural-language question |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
sessionId | string | Optional conversation id to keep context across calls |
optimize_sql Optimize SQL
DBHawk AI SQL optimization suggestions for a given statement. Does not execute anything.
| Parameter | Type | Description |
|---|---|---|
sql * | string | The SQL statement to optimize |
datasource | string | Datasource name; defaults to DBHAWK_DEFAULT_DATASOURCE |
schema | string | Schema context, if relevant |
format_sql Format SQL
Pretty-print / format a SQL statement.
| Parameter | Type | Description |
|---|---|---|
query * | string | The SQL statement to format |
dbDialect | string | Optional dialect hint (e.g. ORACLE, MYSQL, POSTGRESQL) |