Query a site's database
db_queryRun one SQL statement on a site's database, connecting with the site's own credentials (you never need the password). SELECT, SHOW, DESCRIBE and EXPLAIN run straight away in a read-only transaction; anything that changes data needs the user's approval. Remember the table prefix from list_sites. Query only the tables and columns the task needs. Do not select or return payment card numbers, government ID numbers, health or biometric data or password hashes, and never ask the user for them: if a table holds them, leave those columns out.
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 | ||
| why | No | One plain sentence for the user, shown on the approval page if this call needs their approval: what it does and why it is needed. | |
| site | No | Site root folder, like /var/www/shop, or one of the site's domains. Optional when the server has one site (see list_sites). | |
| server | No | Server name or id. Optional when the account has one server. | |
| max_rows | No | Default 200, max 1000. | |
| approval_id | No | Only when repeating a call the user approved. |