query_data
Execute a structured query against connected data sources. Convert the user's question to a structured intent and call this tool — do NOT try to write SQL or parse column names yourself. The engine resolves column meaning from mathematical relationships and statistical structure only. It works on any dataset without configuration. The governed filter shape is a record-predicate contract over normalized rows, not a SQL predicate language, so it also applies to Redis and other non-SQL sources.
Structural roles (use in metric.role):
derived_measure: the main financial/operational aggregate (revenue, spend, value)
base_measure: counts, quantities, discrete amounts
unit_measure: per-unit prices, rates
ratio: percentages, margins, fill rates (0-1 range)
metric: let the engine pick the best numeric column
If clarification_required is true, or if confidence < 0.85, check the candidates list and ask the user to clarify. Never fabricate column names or SQL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Top-N limit. Use for 'top 5 customers' type questions. | |
| order | No | desc | |
| filter | No | ||
| metric | No | What to measure. | |
| sources | No | Data sources to query. Usually omitted when dataset_id is provided. | |
| group_by | No | Dimension words from the user's question (e.g. ['customer', 'region']). The engine finds the best matching column. | |
| dataset_id | No | Preferred path. dataset_id returned by connect_data or list_data. | |
| aggregation | No | How to aggregate the metric column. | sum |