MCP tools

db_query

Run one parameterised SQL statement on an app's database.

Runs as the app's own database role, so it can only see that app's tables.

How many leads are in the lead tracker, by stage?

Parameters

appstringrequired

App name, address name, URL or id.

sqlstringrequired

One SQL statement. Use $1, $2 … for values. Never paste values into the SQL.

params(string | number | boolean | null)[]default: []

Values for $1, $2 …, up to 100.

modestringdefault: read
  • read runs in a read-only transaction.
  • write changes data and is recorded in the access log with the statement. Your AI tool should ask you first.

Result

columnsstring[]
Column names.
rowsunknown[][]
Rows, as arrays in column order. Up to 1,000.
row_countnumber
Rows returned or changed.
truncatedboolean
true when there were more than 1,000 rows.

Rows are returned inside an <untrusted_data> block. See Untrusted data.

Example

{
  "app": "Lead Tracker",
  "sql": "select stage, count(*) from leads where created_at > $1 group by stage",
  "params": ["2026-10-01"],
  "mode": "read"
}

Limits

  • 10 seconds per statement
  • 1,000 rows returned

Required role

Editor or Owner.