query_sql
Run a bounded, read-only SQL query against an InfluxDB 3 database and return structured rows, warnings, row counts, and query metadata.
Instructions
Run one bounded, read-only SQL query against an InfluxDB 3 database. Accepts database as an alias for db and query as an alias for q; differing pairs are rejected. Defaults to JSON output and returns structured rows, warnings, and query metadata. Core and Enterprise also return jsonl or csv; Cloud Dedicated, Cloud Serverless, and Clustered return only JSON. Your answer must report metadata.completeness, the cap when capped, warnings, and row_count; see READING QUERY RESULTS in get_help. In SQL, quoted identifiers are exact column names; if a quoted selector contains *, treat it as wildcard intent, call describe_table, expand matching fields explicitly, then retry one bounded query_sql. Use query_influxql regex only when the user explicitly asks for InfluxQL or regex field selection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | Read-only SQL query to run. Provide q or query; if both are present, they must agree. | |
| db | No | Database name to query. Provide db or database; if both are present, they must agree. | |
| query | No | Alias for q; provide one or equal values. | |
| format | No | Output format for query results. Core and Enterprise return json, jsonl, or csv; Cloud Dedicated, Cloud Serverless, and Clustered return json. Other formats are refused with unsupported_query_format. | json |
| params | No | Optional query parameters to pass through | |
| maxRows | No | Maximum rows to return. Default 1000; hard max 5000. | |
| database | No | Alias for db; provide one or equal values. | |
| timeoutMs | No | Optional query timeout in milliseconds |