Run SQL on a database
run_sqlRun SQL on a Postgres database. Read-only unless writes is true (then it can change or drop data: show the person the statement and get their go-ahead first; writes are recorded in the account's audit log). One statement result, the first 500 rows, 30 seconds at most. A statement Postgres refuses comes back with ok: false and its error. Use get_database_schema to see the tables first.
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": {
"id": "<id>",
"sql": "<sql>"
},
"name": "run_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The database's service id, from list_services | |
| sql | Yes | The SQL to run | |
| writes | No | Allow changes (INSERT, UPDATE, DDL). Off by default: a read-only transaction. |