db_query
Run SQL queries against a selected database profile, or switch to dev/qa for a single call. Read-only by default; optionally cap rows and override database without asking for credentials.
Instructions
Run SQL against the sticky session profile (or optional profile=dev|qa for one call). Read-only by default. Optional database name and maxRows. Do not ask the user for connection host/password — use profiles.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "db_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL statement to execute | |
| maxRows | No | Max rows to return (default from DBEAVER_QUERY_MAX_ROWS / PG_MAX_ROWS) | |
| profile | No | Connection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (DBEAVER_DEV_* / DBEAVER_QA_* or PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from db_set_profile / DBEAVER_PROFILE. | |
| database | No | Optional database name override |