execute_sql
Run SQL statements (SELECT, INSERT, UPDATE, DELETE, DDL) on a project's dedicated PostgreSQL database. Supports parameterized queries with $1, $2 placeholders for safety. Returns rows and count for SELECT, changes for mutations, or changes:0 for DDL.
Instructions
Run SQL against the project's dedicated PostgreSQL database.
Supports: CREATE TABLE, ALTER TABLE, DROP TABLE, INSERT, SELECT, UPDATE, DELETE.
Use parameterized queries for safety: pass values in the params array with $1, $2, etc. placeholders.
Return format:
SELECT: { rows: [...], count: N } — DECIMAL columns return as strings (e.g. "45.00")
INSERT/UPDATE/DELETE: { changes: N }
DDL: { changes: 0 }
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": {
"project_id": "<project_id>",
"sql": "<sql>"
},
"name": "execute_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID (e.g. proj_a8Kq7fR2xZ) | |
| sql | Yes | SQL statement to execute | |
| params | No | Bind parameters (use $1, $2, etc. placeholders in SQL) |