Query app database
tzcloud_query_databaseRun one read-only SQL statement against your application's database and read a bounded page of its rows. The statement starts with SELECT, WITH, VALUES, or TABLE. It runs in a read-only transaction that is always rolled back, with a 10-second timeout. Rows are PostgreSQL's text or null, bounded by limit and 64 KiB. truncated (rows or bytes) means more rows remained: narrow with WHERE, LIMIT or fewer columns, or, for rows, raise limit up to 1,000. A write is refused query_not_read_only. Any other failure of the statement or its session is refused query_failed. Without environment, the call reads production.
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": {
"application": "<application>",
"sql": "<sql>"
},
"name": "tzcloud_query_database"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One SQL statement starting with SELECT, WITH, VALUES, or TABLE, at most 10,000 characters, with no bound parameters. A write is refused `query_not_read_only`; a second statement or a SELECT INTO is refused `query_failed`. | |
| limit | No | How many rows at most, 1 to 1000; 100 where none is given. The answer also stops at 64 KiB of row data, and `truncated` says which bound cut it. | |
| application | Yes | Your account's application `id` from `tzcloud_list_applications`, not its name or label. | |
| environment | No | Production where absent, after its first promote (two environments) or production deploy (one); `development` reads development or a one-environment local run's database; another value draws `invalid_request`, a database not yet made draws `not_found`. |