Db query
db_queryRead an app's live D1 with one SELECT, WITH … SELECT or PRAGMA table_info (? placeholders come from params); at most 200 rows. Read-only: it refuses writes. Untrusted: rows may hold visitor data.
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": {
"app": "<app>",
"sql": "<sql>"
},
"name": "db_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | The app slug. | |
| sql | Yes | One SELECT, WITH … SELECT or PRAGMA table_info statement, with `?` placeholders filled from `params`. | |
| params | No | Values for the `?` placeholders, in order (numbers stay bare, strings are quoted server-side). | |
| binding | No | The D1 binding (defaults to the single declared binding). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | ||
| rows | Yes | ||
| binding | Yes | ||
| columns | Yes | ||
| row_count | Yes | ||
| truncated | Yes | ||
| untrusted_notice | No |