db_query
Run predefined parameterized queries against allow-listed PostgreSQL, MySQL, or Redis database presets and return rows as JSON, with approval and audit controls.
Instructions
Run a NAMED QUERY against a database preset (PostgreSQL, MySQL,
or Redis). You supply query_name (must match one declared in
the preset) and params (positional). The SQL/command is
FIXED at preset definition time — you cannot send arbitrary SQL.
Returns rows as JSON. Approval prompt fires per the preset's policy.
If the user previously approved a time-boxed window for this
preset+action, the call proceeds without a new prompt and is
recorded as 'windowed' in the audit log.
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": {
"preset_name": "<preset_name>",
"query_name": "<query_name>"
},
"name": "db_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | Positional parameters; types must match the named query's `param_types`. | |
| query_name | Yes | Must match one of the preset's declared `queries[].name`. | |
| preset_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| notice | No | Set when mcp-warden withheld the rows (over the size limit). | |
| rows_affected | Yes |