Skip to main content
Glama

Query a Dataset

query_dataset
Read-onlyIdempotent

Rows of one dataset, filtered, with the district, school, county, and demographic names joined in. filters takes code columns and category columns (describe_dataset's filters lists the exact keys and valid values). Use year or year_min/year_max, not both. detail picks what one row describes (default: the dataset's finest level). Returns rows and a columns list (type, role, unit, what a NULL means, and is_key_metric on the headline column); key_metric repeats the headline column's name. A NULL usually means the source suppressed the value, not zero. columns returns only the listed columns, include_labels=false leaves out the names, and order_by with order sorts on the server, so a top-N needs only N rows. Pages are small (default 100, at most 500); when truncated is true, bulk_export gives the REST API address that returns the whole result as CSV or Parquet. A bad filter returns an error listing the valid keys and values.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "topic": "<topic>"
    },
    "name": "query_dataset"
  }
}

Input Schema

NameRequiredDescriptionDefault
yearNoExact year. Use this or year_min/year_max, not both.
limitNoRows per page (default 100, at most 500).
orderNoSort direction for order_by: 'asc' or 'desc'.asc
topicYesDataset name, e.g. 'act_scores' (the `name` from list_datasets or search_datasets). Names are unique across subject areas.
detailNoLevel of detail, i.e. what one row describes: 'schools', 'districts', 'counties', 'tracts', 'states', ... (each dataset lists its own). Omit for the dataset's default.
offsetNoNumber of rows to skip, for paging.
columnsNoReturn only these columns (dataset columns and joined name columns). Omit for all.
filtersNoColumn -> value (or list of values). Keys are the code columns (district_code, school_code, county_fips, tract_geoid, demographic), the dataset's category columns, and a few lookup-table attributes (demographic_category, district_type, school_level, locale); describe_dataset's `filters` lists the exact keys and valid values. A list is OR; several keys AND together. A wrong key or value returns an error listing the valid ones.
order_byNoSort by one column (a dataset column or a joined name column). Default order is the row's identifying columns. NULL (suppressed) values sort last either way.
year_maxNoLast year of a range (inclusive).
year_minNoFirst year of a range (inclusive).
include_labelsNoJoin the district, school, county, and demographic names (default true); false returns codes only.
numeric_filtersNoANDed comparisons on numeric metric columns, before pagination or aggregation. gt/gte/lt/lte use value; inclusive between uses values=[lower, upper]. Stored units: 0.9 means 90%. NULLs do not match. describe_dataset lists numeric_filter_columns.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / main_topic
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "Optional subject-area consistency check. Omit: globally unique topic names and full keys identify the dataset on their own.",
      -  "enum": [
      -    "census",
      -    "education",
      -    "health",
      -    "immigration",
      -    null
      -  ],
      -  "title": "Main Topic"
      -}
    • changedInput schema / properties / topic / description
      Previous value: -"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets). The full key, e.g. 'education/gosa/act_scores', also works. main_topic is optional."New value: +"Dataset name, e.g. 'act_scores' (the `name` from list_datasets or search_datasets). Names are unique across subject areas."
  2. Changed8 schema fields changed
    • addedInput schema / $defs
      Added value: +{
      +  "NumericFilter": {
      +    "additionalProperties": false,
      +    "description": "One comparison on a numeric metric; between includes both endpoints.",
      +    "properties": {
      +      "column": {
      +        "description": "Numeric metric from describe_dataset's numeric_filter_columns.",
      +        "title": "Column",
      +        "type": "string"
      +      },
      +      "op": {
      +        "description": "Comparison; between is inclusive.",
      +        "enum": [
      +          "gt",
      +          "gte",
      +          "lt",
      +          "lte",
      +          "between"
      +        ],
      +        "title": "Op",
      +        "type": "string"
      +      },
      +      "value": {
      +        "anyOf": [
      +          {
      +            "type": "integer"
      +          },
      +          {
      +            "type": "number"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Finite bound for gt/gte/lt/lte, in stored units (0.9 for 90%).",
      +        "title": "Value"
      +      },
      +      "values": {
      +        "anyOf": [
      +          {
      +            "maxItems": 2,
      +            "minItems": 2,
      +            "prefixItems": [
      +              {
      +                "anyOf": [
      +                  {
      +                    "type": "integer"
      +                  },
      +                  {
      +                    "type": "number"
      +                  }
      +                ]
      +              },
      +              {
      +                "anyOf": [
      +                  {
      +                    "type": "integer"
      +                  },
      +                  {
      +                    "type": "number"
      +                  }
      +                ]
      +              }
      +            ],
      +            "type": "array"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Ordered [lower, upper] bounds for between; omit value.",
      +        "title": "Values"
      +      }
      +    },
      +    "required": [
      +      "column",
      +      "op"
      +    ],
      +    "title": "NumericFilter",
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / main_topic / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / main_topic / default
      Previous value: -"education"New value: +null
    • changedInput schema / properties / main_topic / description
      Previous value: -"Subject area: 'education' (the default), 'census', or 'immigration'. A dataset's key starts with it."New value: +"Optional subject-area consistency check. Omit: globally unique topic names and full keys identify the dataset on their own."
    • changedInput schema / properties / main_topic / enum
      Previous value: -[
      -  "census",
      -  "education",
      -  "immigration"
      -]New value: +[
      +  "census",
      +  "education",
      +  "health",
      +  "immigration",
      +  null
      +]
    • removedInput schema / properties / main_topic / type
      Removed value: -"string"
    • addedInput schema / properties / numeric_filters
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/NumericFilter"
      +      },
      +      "maxItems": 20,
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "ANDed comparisons on numeric metric columns, before pagination or aggregation. gt/gte/lt/lte use value; inclusive between uses values=[lower, upper]. Stored units: 0.9 means 90%. NULLs do not match. describe_dataset lists numeric_filter_columns.",
      +  "title": "Numeric Filters"
      +}
    • changedInput schema / properties / topic / description
      Previous value: -"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets). The full key, e.g. 'education/gosa/act_scores', also works and sets main_topic."New value: +"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets). The full key, e.g. 'education/gosa/act_scores', also works. main_topic is optional."
  3. Changed1 schema field changed
    • changedInput schema / properties / topic / description
      Previous value: -"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets)."New value: +"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets). The full key, e.g. 'education/gosa/act_scores', also works and sets main_topic."
  4. Changed24 schema fields changed
    • changedInput schema / properties / columns / description
      Previous value: -"Project only these output columns (fact columns + joined label columns). Smaller pages / fewer column reads. Omit for all columns."New value: +"Return only these columns (dataset columns and joined name columns). Omit for all."
    • changedInput schema / properties / detail / description
      Previous value: -"Grain (e.g. schools/districts/states); default finest."New value: +"Level of detail, i.e. what one row describes: 'schools', 'districts', 'counties', 'tracts', 'states', ... (each dataset lists its own). Omit for the dataset's default."
    • addedInput schema / properties / detail / enum
      Added value: +[
      +  "counties",
      +  "districts",
      +  "schools",
      +  "states",
      +  "tracts",
      +  null
      +]
    • changedInput schema / properties / filters / description
      Previous value: -"Column → value (or list of values) filters. Keys are FK columns (district_code, school_code, county_fips, demographic) and categorical columns; read describe_dataset's `filters` for the exact keys and enum values FIRST. A value list is a union (OR); multiple keys AND together. A wrong key/value returns a self-describing error listing the valid ones."New value: +"Column -> value (or list of values). Keys are the code columns (district_code, school_code, county_fips, tract_geoid, demographic), the dataset's category columns, and a few lookup-table attributes (demographic_category, district_type, school_level, locale); describe_dataset's `filters` lists the exact keys and valid values. A list is OR; several keys AND together. A wrong key or value returns an error listing the valid ones."
    • changedInput schema / properties / include_labels / description
      Previous value: -"Join district/school/county/demographic name columns (default true); false = codes only (faster, leaner)."New value: +"Join the district, school, county, and demographic names (default true); false returns codes only."
    • changedInput schema / properties / limit / anyOf
      Previous value: -[
      -  {
      -    "minimum": 1,
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / limit / description
      Previous value: -"Page size (default 100, max 500)."New value: +"Rows per page (default 100, at most 500)."
    • addedInput schema / properties / limit / maximum
      Added value: +500
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • changedInput schema / properties / main_topic / description
      Previous value: -"Main topic: 'education', 'census', or 'immigration'."New value: +"Subject area: 'education' (the default), 'census', or 'immigration'. A dataset's key starts with it."
    • addedInput schema / properties / main_topic / enum
      Added value: +[
      +  "census",
      +  "education",
      +  "immigration"
      +]
    • changedInput schema / properties / offset / description
      Previous value: -"Row offset for paging (>= 0)."New value: +"Number of rows to skip, for paging."
    • addedInput schema / properties / order / enum
      Added value: +[
      +  "asc",
      +  "desc"
      +]
    • changedInput schema / properties / order_by / description
      Previous value: -"Order by one fact column or joined label column (for server-side top-N). Default order is the row grain. NULL (suppressed) cells sort LAST in either direction, so a metric top-N is never polluted by suppressed rows."New value: +"Sort by one column (a dataset column or a joined name column). Default order is the row's identifying columns. NULL (suppressed) values sort last either way."
    • changedInput schema / properties / topic / description
      Previous value: -"Topic name, e.g. 'act_scores'."New value: +"Dataset name, e.g. 'act_scores' (the last part of a key from list_datasets or search_datasets)."
    • changedInput schema / properties / year / description
      Previous value: -"Exact year. Use this OR year_min/max."New value: +"Exact year. Use this or year_min/year_max, not both."
    • addedInput schema / properties / year / maximum
      Added value: +2100
    • addedInput schema / properties / year / minimum
      Added value: +1900
    • changedInput schema / properties / year_max / description
      Previous value: -"Inclusive upper year bound (range)."New value: +"Last year of a range (inclusive)."
    • addedInput schema / properties / year_max / maximum
      Added value: +2100
    • addedInput schema / properties / year_max / minimum
      Added value: +1900
    • changedInput schema / properties / year_min / description
      Previous value: -"Inclusive lower year bound (range)."New value: +"First year of a range (inclusive)."
    • addedInput schema / properties / year_min / maximum
      Added value: +2100
    • addedInput schema / properties / year_min / minimum
      Added value: +1900
  5. Changed1 schema field changed
    • changedInput schema / properties / main_topic / description
      Previous value: -"Main topic: 'education' or 'census'."New value: +"Main topic: 'education', 'census', or 'immigration'."
  6. First observed

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnly/idempotent/non-destructive, and the description goes further: NULLs mean source suppression rather than zero, pages cap at 500, sorting happens server-side, and bad filters return an error enumerating valid keys. It stops short of stating anything about cost, latency, or what `rows` look like in shape.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then parameter rules, return shape, and the pagination escape hatch; nearly every sentence carries a distinct fact. It is one dense block of prose with no visual separation between input semantics and return semantics, which makes it heavier to scan than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter dataset query with annotations and an output schema both present, the description covers the remaining risk areas an agent needs: NULL interpretation, page limits, the truncated-to-bulk_export path, sorting behavior, and filter validation errors.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage the schema already carries the parameter semantics, and much of the description restates it (year vs. range, columns, include_labels, order_by). The genuinely additive parts are strategic — server-side sorting makes top-N cheap, and filter keys come from describe_dataset — but they are brief against a 13-parameter schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource plus scope: "Rows of one dataset, filtered, with the district, school, county, and demographic names joined in." It implicitly distinguishes itself from describe_dataset (for filter keys) and bulk_export (for large results), but never names the closest alternative, `aggregate`, so an agent must infer when to roll up vs. list rows.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit operating rules: use `year` or `year_min`/`year_max` but not both, fetch valid filter keys from describe_dataset, and switch to bulk_export when `truncated` is true. Missing an explicit when-not-to-use-this-tool-vs-`aggregate` exclusion, so a 4 rather than a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources