Tools
Tools exposed by the hypequery MCP server.
The MCP server exposes semantic tools over your dataset registry. Agents do not receive a SQL tool.
list_datasets
Lists registered datasets with description, dimension count, measure count, and metric count. Each entry also has queryable, which is false when the dataset can only be reached through named metrics.
When bridging a Python backend (--client-contract-url), each description is the fixed text Authorized client endpoints., and the counts cover every endpoint the principal may call for that dataset.
{
"name": "list_datasets"
}Example response:
{
"datasets": [
{
"name": "orders",
"description": "Customer orders and revenue data",
"dimensionCount": 5,
"measureCount": 4,
"metricCount": 2
}
],
"total": 1
}get_dataset_schema
Returns metadata for one dataset, including dimensions, measures, named metrics, filters, tenant key, time key, limits, and relationship metadata when present.
When bridging a Python backend, the response is { name, queryable, endpoints: [...] } instead. Each endpoint carries its own dimensions, measures, filters (with the operators each one allows), limits and time settings. Tenant keys, time-key columns and relationship metadata stay on the server. Relationship entries include queryable and fields, so agents can discover which related fields (for example customer.country) a query may reference. See Relationships.
{
"name": "get_dataset_schema",
"arguments": {
"dataset": "orders"
}
}Labels and descriptions from your dataset definitions are included here, so they matter for agent behavior.
query_metric
Runs one named metric handle attached to a dataset.
{
"name": "query_metric",
"arguments": {
"dataset": "orders",
"metric": "revenue",
"dimensions": ["country"],
"filters": [
{ "field": "status", "operator": "eq", "value": "completed" }
],
"orderBy": [
{ "field": "revenue", "direction": "desc" }
],
"limit": 10
}
}Use query_metric when the agent should ask for a stable KPI such as revenue, averageOrderValue, or monthlyRevenue.
query_dataset
Runs an ad hoc dataset query with selected dimensions and measures.
{
"name": "query_dataset",
"arguments": {
"dataset": "orders",
"dimensions": ["country", "status"],
"measures": ["revenue", "orderCount"],
"filters": [
{ "field": "status", "operator": "eq", "value": "completed" }
],
"grain": "month",
"limit": 100
}
}The MCP argument is called measures, matching dataset queries in @hypequery/datasets. Derived or named metrics such as averageOrderValue are not measures and can only be queried through query_metric.
At least one dimension or measure must be specified, otherwise the query is rejected.
Other query arguments
Besides dimensions, measures, filters, orderBy, grain, limit and offset, the query tools accept:
having: conditions on aggregated measure values (query_dataset);timezone: an IANA zone for time buckets and offset-free timestamps;orderByonperiodwhengrainsets a time grain.
Two arguments depend on how the server runs:
Local datasets (hypequery mcp) | Bridging a backend (--client-contract-url) | |
|---|---|---|
includeMeta | Rejected | Returns meta with the request id, row count and pagination |
query_dataset without measures | No measures: dimensions only | The endpoint's default measures |
Pagination
query_metric and query_dataset both accept limit and offset for paging through large result sets. offset skips the given number of rows before returning results.
limitdefaults to 100.offsetmay not exceed 10,000.- A dataset's own limits, and when bridging, each endpoint's
maxLimit, can lower both caps. - A Python backend clamps a
limitabove its endpoint maximum without failing. SendincludeMeta: trueand readmeta.pagination.limitto see the limit that applied, andhasMoreto know whether to page.
Errors
A failed tool call returns isError: true, a text line such as Error [MCP_INVALID_ARGUMENTS]: …, and the same details as structured content:
{ "error": { "code": "MCP_INVALID_ARGUMENTS", "category": "correctable_input", "message": "…", "retryable": false, "correctable": true } }| Code | Category | Retry? | Meaning |
|---|---|---|---|
MCP_INVALID_ARGUMENTS | correctable_input | fix the call | An argument is unknown, the wrong type, or outside a limit |
MCP_NOT_FOUND | correctable_input | fix the call | The dataset or metric doesn't exist |
MCP_UNKNOWN_TOOL | correctable_input | fix the call | The tool name is not one the server exposes |
MCP_UNAUTHORIZED | unauthorized | no | The backend refused the credentials |
MCP_STALE_CONTRACT | stale_contract | after a restart | Definitions changed since the bridge loaded them |
MCP_REQUEST_CANCELLED | budget | no | The client cancelled the call |
MCP_QUERY_TIMEOUT | budget | yes | The query exceeded its time budget |
MCP_RESULT_TOO_LARGE | budget | no | The response exceeded its byte budget; narrow the query |
MCP_CATALOG_TOO_LARGE | budget | no | Too many endpoints to list within the catalog budget |
MCP_RATE_LIMITED | budget | yes, after retryAfterSeconds | A hosted server's rate limit or quota refused the call |
MCP_EXECUTION_FAILED | internal | yes | The query or backend failed; details stay in server logs |
A hosted server may add three optional fields:
| Field | Meaning |
|---|---|
retryAfterSeconds | How long to wait before retrying |
relist | Call list_datasets and the schema tools again before retrying |
reason | The host's own stable code for the failure, such as HQ_SEMANTIC_TENANT_REQUIRED; code stays the portable classification |
A host that executes through the semantic data plane builds these with mcpToolErrorFromSemanticFailure and returns them with createMCPErrorResponse.
Prompt
The server also exposes a dataset_guide prompt that helps an MCP client explain how to query the registered datasets.
Operators and grains
Filter operators, as limited by each field's type:
| Field type | Operators |
|---|---|
| string, timestamp | all of the operators below |
| number | all except like |
| boolean | eq, neq, in, notIn |
A dataset's named filter can declare a narrower list, which get_dataset_schema reports per filter. in and notIn take a non-empty list, and between takes two values. There is no null operator.
eqneqgtgteltlteinnotInbetweenlike
Supported time grains, narrowed per dataset by its catalog supportedGrains:
minutehourdayweekmonthquarteryear