Query tools
MCP reference for Algenta query tools — governed exact queries, multi-metric batches, and constrained read-only SQL reports over your authorized datasets.
Algenta exposes three governed query surfaces as MCP tools. query_data runs a single governed exact query; query_batch runs several in one API call; query_sql_report runs a constrained read-only SQL rowset for wide reports that do not fit the exact-query surface. Convert the user's question into a structured intent — a metric role, an aggregation, dimensions to group by, and filters — and let the engine resolve column meaning from the data's mathematical and statistical structure. Every tool maps one-to-one to a /v1 endpoint.
The query tools
query_data
Run one governed exact query over a dataset from a structured intent.
dataset_id (or sources); metric.role, aggregation, group_by, filter, limit, order.
query_batch
Run several governed exact queries in one call, with optional shared defaults.
queries (required, each key + request); defaults (dataset_id, filter, limit, order).
query_sql_report
Run a constrained read-only SQL rowset over authorized datasets.
sources (required, each dataset_id + optional alias), sql (required), max_rows.
Structured query vocabulary
query_data (and each item in query_batch) is built from a small, fixed vocabulary. Pick the structural metric.role, an aggregation, dimensions, and filters — the engine resolves the actual columns.
Metric roles
derived_measure
The main financial/operational aggregate (revenue, spend, value).
base_measure
Counts, quantities, discrete amounts.
unit_measure
Per-unit prices and rates.
ratio
Percentages, margins, fill rates (0–1 range).
component
A contributing part of a derived measure.
identifier
A key or identifier column.
metric
Let the engine pick the best numeric column.
Aggregation, order, and filters
aggregation
sum (default), avg, count, max, min.
order
desc (default), asc.
filter.time_filter
last_quarter, this_quarter, last_month, this_month, last_year, this_year.
filter.conditions[].op
eq, in, gt, gte, lt, lte, is_null, is_not_null.
Each filter condition names either an exact column or a dimension_hint (a semantic label when the column is not yet known), plus an op and a value (or values for in).
Method and endpoint
Because each tool is a one-to-one wrapper, you can reproduce any call against the raw endpoint.
query_data
POST
/v1/query
query_batch
POST
/v1/query/batch
query_sql_report
POST
/v1/query/sql-report
Worked examples
A single governed exact query
Ask for total completed revenue by region last quarter, top five. The tool arguments an MCP host sends:
The equivalent HTTP call:
A representative response records exactly what the engine resolved and executed:
Several metrics in one call
query_batch runs multiple exact queries together. defaults are merged into each item's request before execution.
The response keys each result by its key:
A wide read-only SQL report
query_sql_report accepts a single SELECT/WITH statement over the datasets you list under sources, each optionally aliased for the SQL.
When truncated is true, the SQL report guardrails capped the rowset — tighten the SQL or lower max_rows.
Related pages
Data & ingest toolsGoverned data & queryQuery governed dataLast updated
Was this helpful?