execute_postgres
Execute SQL queries against a PostgreSQL database and retrieve results as JSON. Use in readonly mode for safe SELECT queries or readwrite for full SQL access (non-production).
Instructions
Execute a SQL query against a PostgreSQL database and return rows as JSON.
Returns: {"rows": [...], "row_count": N}
Mode behaviour (per project in databases.json):
readonly — only SELECT/WITH accepted; writes are blocked before reaching the DB.
readwrite — all SQL allowed; use only on non-production projects.
Call describe_postgres_schema first to confirm table/column names. If row_count equals your LIMIT, there are likely more rows.
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": {
"input": "<input>"
},
"name": "execute_postgres"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |