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. Changed1 schema field changed
    • changedInput schema / properties / detail / enum
      Previous value: -[
      -  "counties",
      -  "districts",
      -  "schools",
      -  "states",
      -  "tracts",
      -  null
      -]New value: +[
      +  "counties",
      +  "districts",
      +  "places",
      +  "schools",
      +  "states",
      +  "tracts",
      +  null
      +]
  2. 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."
  3. 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."
  4. 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."
  5. 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
  6. 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'."
  7. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the description is free to add the operational detail that matters: NULL means source suppression rather than zero, pages default to 100 and cap at 500, sorting happens server-side so top-N needs only N rows, and truncated results should be finished via bulk_export. That is substantive behavior well beyond the annotation set.

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 the result shape, then proceeds through filters, year handling, detail, return payload, and pagination in a logical order. It is dense and backtick-heavy, requiring careful reading, but almost no sentence is filler.

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?

Despite 13 parameters and an output schema, the description covers the things an agent must know to call it correctly: filter key sourcing, mutually exclusive year params, pagination limits, truncation escape hatch, NULL interpretation, and error behavior. Nothing material is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the schema already carries the bar; the description adds real interpretive value on top – `detail` defines what a single row represents, `columns` restricts output, `include_labels=false` drops joined names, and `order_by`+`order` push sorting to the server. It stops short of restating every one of the 13 parameters, which is appropriate given the schema.

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

Purpose5/5

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

The opening states the specific result (rows of one dataset), the transformation (filtered), and the enrichment (district, school, county, demographic names joined in). It also implicitly separates itself from describe_dataset, which it names as the place to find filter keys and valid values.

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

Usage Guidelines5/5

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

Gives explicit either/or rules ('Use `year` or `year_min`/`year_max`, not both') and names alternatives with the condition that selects them: describe_dataset for filter keys/valid values, and bulk_export when `truncated` is true. It also explains the error path for a bad filter.

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