query
Execute SQL queries on a configured database connection, with control over row limits, timeouts, and database selection.
Instructions
Execute a SQL query on a configured connection (use connection_list to discover keys). Results are truncated to max_rows (default from config, typically 1000) with truncated=true set; add LIMIT for large tables. Connections marked read_only reject writes at the session level. Multi-statement scripts are passed to the driver as-is (for mysql they require multipleStatements enabled in the connection options).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL text to execute | |
| database | No | Database to run against; required when the connection declares multiple databases | |
| max_rows | No | Row cap for this call (overrides config) | |
| connection | Yes | Connection key from connection_list | |
| timeout_ms | No | Query timeout in ms for this call (overrides config) |