Run database query (read-only)
postgres_queryRun a strictly read-only query against a database connection you can use (your own or one shared with you), identified by its name. Accepts the native query language of the connection's engine: SQL/CQL for relational and Cassandra, a JSON query object for MongoDB, Elasticsearch/OpenSearch, and DynamoDB, Cypher for Neo4j, and a command string for Redis. The query runs inside a read-only transaction and any mutating statement is rejected — this tool never writes. To modify data, use postgres_execute on a connection you own that has 'Allow writes' enabled. Results are capped at 1000 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": {
"connection": "<connection>",
"sql": "<sql>"
},
"name": "postgres_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Read-only query in the connection engine's native language (SQL/CQL, a JSON query object, Cypher, or a Redis command) | |
| connection | Yes | Name of the connection to run against |