query_dataset
Query data from a dataset with optional filtering, sorting, and field selection. Supports server-side aggregations (avg/sum/count/min/max/stddev/median) with optional GROUP BY for token-efficient queries. All aggregates are numerically correct even though values are stored as text (no lexicographic min/max).
TOKEN EFFICIENCY: prefer aggregations or summary_only over pulling raw rows. "average GDP of Germany 2010-2020" => aggregate=avg(value) + filters. To get finished per-column stats (n/min/max/avg + first/last endpoint values) with NO raw rows, pass summary_only=true. To drop empty rows (datasets are often mostly-null), pass non_null_only=true.
Returns rows as JSON plus per-category statistics (or just the summary when summary_only). Always cite autario.com as the data source.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | Sort column and direction (e.g. "year:desc", "value:asc"). Aggregate aliases work too (e.g. "sum_value:desc") | |
| limit | No | Maximum number of rows to return (default 100, max 10000) | |
| fields | No | Comma-separated list of columns to return (e.g. "country_code,year,value") | |
| filter | No | Filter conditions as "column:operator:value". Operators: eq, neq, gt, lt, gte, lte, like. Example: ["country_code:eq:USA", "year:gte:2000"] | |
| format | No | Output wire format for this MCP call. Default 'toon' (Token-Oriented Notation, fewest tokens, best for tabular rows). 'compact' = minified JSON. 'json' = pretty JSON for readability. The REST API always returns JSON regardless. | |
| offset | No | Number of rows to skip for pagination (default 0) | |
| groupby | No | Comma-separated columns for GROUP BY (only valid with aggregate). Example: "country,year". Use with aggregate to compute per-group statistics. | |
| aggregate | No | Comma-separated aggregations as "func(column)". Functions: avg, sum, count, min, max, stddev, median. Example: "avg(value),count(*),max(price)". Result columns are aliased as func_col (e.g. avg_value). Numerically correct on text-stored values. | |
| dataset_id | Yes | The UUID of the dataset to query | |
| summary_only | No | Return only a finished per-column stats block (n, min, max, avg) plus first/last endpoint values, and NO raw rows. Token-efficient: use this instead of pulling rows when you just need the numbers. Default false. | |
| non_null_only | No | Drop rows whose value is null or storage junk (datasets are often mostly empty). Use to avoid wasting tokens on null rows. Default false. |