Skip to main content
Glama

Search Census Variables

census_search_variables
Read-only

Search Census variables by keyword across variable labels and concept groups, or look one up by its code. Returns variable codes with human-readable labels — use this to go from a concept like "median household income" to the variable code B19013_001E needed for data queries. A query that is one variable or table code, such as B19013_001E or B19013, returns that variable or the table's variables, in code order, ahead of any keyword matches; a code the dataset does not publish gets a notice naming the dataset that does, when one is confirmed. To retrieve every column of a table, pass its ID to census_query_data as group rather than listing its codes. On ACS datasets it returns both estimate (E suffix) and margin-of-error (M suffix) codes so you can request both; the ACS comparison profiles (acs/acs5/cprofile, acs/acs1/cprofile) and the other dataset families publish no margins of error. Also use it to find the predicate codes a dataset filters on, such as NAICS2017 in cbp. Adding a word narrows the results, since every word must match. Use offset to continue the same search beyond limit; nextOffset names the next page.

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": {
      "query": "<query>"
    },
    "name": "census_search_variables"
  }
}

Input Schema

NameRequiredDescriptionDefault
yearNoVintage year to search (default: latest available for the dataset).
limitNoMaximum results per page (default: 20, max: 100). Follow nextOffset to continue the same search.
queryYesKeywords to search (e.g., "median household income", "poverty", "bachelor's degree"), or one variable or table code (e.g., "B19013_001E", "B19013"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so "rate" does not match "separated". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was. A single token that equals a variable code or a table ID, ignoring case and any quotes or punctuation around it, returns those variables first; that table ID is also what census_query_data takes as group to retrieve the whole table. A token with no digit or underscore, such as "state", is read as a code when no keyword matched; ahead of keyword matches only when typed in the code's own uppercase ("STATE").
offsetNoMatching variables to skip in the existing rank order (default: 0). Keep query, dataset, year and limit unchanged when following nextOffset.
datasetNoDataset to search within (default: "acs/acs5"). Use census_list_datasets to discover options. Case is ignored, and a two-part code can be given by its last part alone — "acs5" is acs/acs5, "pl" is dec/pl. Three-part codes such as acs/acs5/profile must be given in full. The response echoes the resolved code, and the default year is that dataset's latest.

Output Schema

NameRequiredDescriptionDefault
capNoThe limit that was applied.
yearNoVintage year that was searched.
errorNoPresent when the call failed. Absent on success.
shownNoNumber of variables returned after the limit.
noticeNoGuidance for no matches, partial-term matches, continuation, the final page or an offset past the end. For a code the dataset does not publish, names the confirmed sibling dataset or census_get_variable for an attribute column; for a table cut inside its code tier, names the last code shown and the next offset.
datasetNoDataset that was searched.
truncatedNoTrue when more matching variables remain after the current page.
variablesNoMatching variables, best first: the variable whose code equals the query, or every variable of the table whose ID equals it, in code order; then a variable whose label's last !!-separated segment or whose whole concept equals the query, then the query as a phrase in both label and concept, in the label only, in the concept only, then every word present but not as a phrase; ties go to fewer !! segments in the label, then a shorter concept, then the code, which puts an E estimate before its M margin of error. On ACS datasets, codes ending in E are estimates and M are their margins of error, except on the comparison profiles, which publish no M codes; on other datasets the suffix carries no such meaning.
nextOffsetNoOffset for the next page; absent when no matches remain after this page.
totalMatchesNoVariables matched before the limit was applied: those matching the query as a code, plus those containing every query word — or, when none does and no code matched, the variables that contain the most words.
effectiveQueryNoQuery as the server parsed it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / query / description
      Previous value: -"Keywords to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"), or one variable or table code (e.g., \"B19013_001E\", \"B19013\"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so \"rate\" does not match \"separated\". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was. A single token that equals a variable code or a table ID, ignoring case and any quotes or punctuation around it, returns those variables first. A token with no digit or underscore, such as \"state\", is read as a code when no keyword matched; ahead of keyword matches only when typed in the code's own uppercase (\"STATE\")."New value: +"Keywords to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"), or one variable or table code (e.g., \"B19013_001E\", \"B19013\"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so \"rate\" does not match \"separated\". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was. A single token that equals a variable code or a table ID, ignoring case and any quotes or punctuation around it, returns those variables first; that table ID is also what census_query_data takes as group to retrieve the whole table. A token with no digit or underscore, such as \"state\", is read as a code when no keyword matched; ahead of keyword matches only when typed in the code's own uppercase (\"STATE\")."
  2. Changed5 schema fields changed
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum results to return (default: 20, max: 100). Increase if totalMatches greatly exceeds the limit."New value: +"Maximum results per page (default: 20, max: 100). Follow nextOffset to continue the same search."
    • addedInput schema / properties / offset
      Added value: +{
      +  "description": "Matching variables to skip in the existing rank order (default: 0). Keep query, dataset, year and limit unchanged when following nextOffset.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / nextOffset
      Added value: +{
      +  "description": "Offset for the next page; absent when no matches remain after this page.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when no variables matched, when no variable contained every query word and the results hold only some of them, or when results were truncated — suggests other keywords, a narrower query, or a higher limit. For a code the dataset does not publish, it names the sibling dataset confirmed to hold it, or census_get_variable for an attribute column (annotation, flag, label, or significance); for a table cut at the limit, the last code shown."New value: +"Guidance for no matches, partial-term matches, continuation, the final page or an offset past the end. For a code the dataset does not publish, names the confirmed sibling dataset or census_get_variable for an attribute column; for a table cut inside its code tier, names the last code shown and the next offset."
    • changedOutput schema / properties / truncated / description
      Previous value: -"True when totalMatches exceeded the limit and results were cut off."New value: +"True when more matching variables remain after the current page."
  3. Changed6 schema fields changed
    • changedInput schema / properties / query / description
      Previous value: -"Keywords to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so \"rate\" does not match \"separated\". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was."New value: +"Keywords to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"), or one variable or table code (e.g., \"B19013_001E\", \"B19013\"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so \"rate\" does not match \"separated\". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was. A single token that equals a variable code or a table ID, ignoring case and any quotes or punctuation around it, returns those variables first. A token with no digit or underscore, such as \"state\", is read as a code when no keyword matched; ahead of keyword matches only when typed in the code's own uppercase (\"STATE\")."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `dataset_not_found`: Dataset code is not recognized, even after case and shorthand resolution. `year_not_available`: The dataset does not serve the requested vintage year. `variables_unavailable`: Variable metadata could not be fetched or parsed from the Census API. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `dataset_not_found`: Dataset code is not recognized, even after case and shorthand resolution. `year_not_available`: The dataset does not serve the requested vintage year. `variables_unavailable`: Variable metadata could not be fetched or parsed from the Census API. `upstream_error`: The Census API answered the dataset's variables.json with an HTTP error, after any retries a transient status earns. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "dataset_not_found",
      -  "year_not_available",
      -  "variables_unavailable"
      -]New value: +[
      +  "dataset_not_found",
      +  "year_not_available",
      +  "variables_unavailable",
      +  "upstream_error"
      +]
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when no variables matched, when no variable contained every query word and the results hold only some of them, or when results were truncated — suggests other keywords, a narrower query, or a higher limit."New value: +"Guidance when no variables matched, when no variable contained every query word and the results hold only some of them, or when results were truncated — suggests other keywords, a narrower query, or a higher limit. For a code the dataset does not publish, it names the sibling dataset confirmed to hold it, or census_get_variable for an attribute column (annotation, flag, label, or significance); for a table cut at the limit, the last code shown."
    • changedOutput schema / properties / totalMatches / description
      Previous value: -"Variables that contain every query word, before the limit was applied — or, when none does, the variables that contain the most words."New value: +"Variables matched before the limit was applied: those matching the query as a code, plus those containing every query word — or, when none does and no code matched, the variables that contain the most words."
    • changedOutput schema / properties / variables / description
      Previous value: -"Matching variables, best first: a variable whose label's last !!-separated segment or whose whole concept equals the query, then the query as a phrase in both label and concept, in the label only, in the concept only, then every word present but not as a phrase; ties go to fewer !! segments in the label, then a shorter concept, then the code, which puts an E estimate before its M margin of error. On ACS datasets, codes ending in E are estimates and M are their margins of error, except on the comparison profiles, which publish no M codes; on other datasets the suffix carries no such meaning."New value: +"Matching variables, best first: the variable whose code equals the query, or every variable of the table whose ID equals it, in code order; then a variable whose label's last !!-separated segment or whose whole concept equals the query, then the query as a phrase in both label and concept, in the label only, in the concept only, then every word present but not as a phrase; ties go to fewer !! segments in the label, then a shorter concept, then the code, which puts an E estimate before its M margin of error. On ACS datasets, codes ending in E are estimates and M are their margins of error, except on the comparison profiles, which publish no M codes; on other datasets the suffix carries no such meaning."
  4. Changed10 schema fields changed
    • changedInput schema / properties / dataset / description
      Previous value: -"Dataset to search within (default: \"acs/acs5\"). Use census_list_datasets to discover options."New value: +"Dataset to search within (default: \"acs/acs5\"). Use census_list_datasets to discover options. Case is ignored, and a two-part code can be given by its last part alone — \"acs5\" is acs/acs5, \"pl\" is dec/pl. Three-part codes such as acs/acs5/profile must be given in full. The response echoes the resolved code, and the default year is that dataset's latest."
    • changedInput schema / properties / query / description
      Previous value: -"Keyword to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"). Multi-word queries search for all terms."New value: +"Keywords to search (e.g., \"median household income\", \"poverty\", \"bachelor's degree\"). Each word must match a whole word of the label or of the concept, ignoring case and punctuation, so \"rate\" does not match \"separated\". A column shared across tables, such as GEO_ID, is matched on its label only, and a margin of error on its estimate's label. When no variable contains every word, the results are the variables containing the most words, and the notice says how many that was."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `dataset_not_found`: Dataset code is not recognized. `year_not_available`: The dataset does not serve the requested vintage year. `variables_unavailable`: Variable metadata could not be fetched or parsed from the Census API. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `dataset_not_found`: Dataset code is not recognized, even after case and shorthand resolution. `year_not_available`: The dataset does not serve the requested vintage year. `variables_unavailable`: Variable metadata could not be fetched or parsed from the Census API. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when no variables matched, or when results were truncated — suggests broader keywords, a narrower query, or a higher limit."New value: +"Guidance when no variables matched, when no variable contained every query word and the results hold only some of them, or when results were truncated — suggests other keywords, a narrower query, or a higher limit."
    • changedOutput schema / properties / totalMatches / description
      Previous value: -"Total variables matching the query before the limit was applied."New value: +"Variables that contain every query word, before the limit was applied — or, when none does, the variables that contain the most words."
    • changedOutput schema / properties / variables / description
      Previous value: -"Matching variables sorted by relevance. On ACS datasets, codes ending in E are estimates and M are their margins of error; on other datasets the suffix carries no such meaning."New value: +"Matching variables, best first: a variable whose label's last !!-separated segment or whose whole concept equals the query, then the query as a phrase in both label and concept, in the label only, in the concept only, then every word present but not as a phrase; ties go to fewer !! segments in the label, then a shorter concept, then the code, which puts an E estimate before its M margin of error. On ACS datasets, codes ending in E are estimates and M are their margins of error, except on the comparison profiles, which publish no M codes; on other datasets the suffix carries no such meaning."
    • changedOutput schema / properties / variables / items / properties / concept / description
      Previous value: -"Concept group the variable belongs to (e.g., \"MEDIAN HOUSEHOLD INCOME\")."New value: +"Concept of the table the variable belongs to (e.g., \"Median Household Income in the Past 12 Months\"). Absent for a column shared across tables, such as GEO_ID, whose concept joins every table it appears in, and for a column the dataset publishes no concept for, such as STATE."
    • changedOutput schema / properties / variables / items / properties / estimate_code / description
      Previous value: -"Corresponding estimate variable code when this is a margin-of-error variable. ACS datasets only — no other family publishes margins of error."New value: +"Corresponding estimate variable code when this is a margin-of-error variable. ACS datasets only, apart from the comparison profiles — no other dataset publishes margins of error."
    • changedOutput schema / properties / variables / items / properties / moe_code / description
      Previous value: -"Corresponding margin-of-error variable code when this is an estimate variable. Request both estimate and MOE in census_query_data for complete data. ACS datasets only — on other families an E-final code is an ordinary code with no margin-of-error sibling, so the field is absent."New value: +"Corresponding margin-of-error variable code when this is an estimate variable. Request both estimate and MOE in census_query_data for complete data. ACS datasets only, apart from the comparison profiles (acs/acs5/cprofile, acs/acs1/cprofile) — there and on other families an E-final code has no margin-of-error sibling, so the field is absent."
    • changedOutput schema / properties / variables / items / required
      Previous value: -[
      -  "variable_code",
      -  "label",
      -  "concept",
      -  "predicate_type"
      -]New value: +[
      +  "variable_code",
      +  "label",
      +  "predicate_type"
      +]
  5. Changed5 schema fields changed
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum results to return (default: 20, max: 100). Increase if total_matches greatly exceeds the limit."New value: +"Maximum results to return (default: 20, max: 100). Increase if totalMatches greatly exceeds the limit."
    • addedInput schema / properties / limit / maximum
      Added value: +100
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • changedInput schema / properties / limit / type
      Previous value: -"number"New value: +"integer"
    • changedOutput schema / properties / truncated / description
      Previous value: -"True when total_matches exceeded the limit and results were cut off."New value: +"True when totalMatches exceeded the limit and results were cut off."
  6. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true and openWorldHint=false; the description adds substantial behavior beyond that — code matches are ranked ahead of keyword matches, matches fall back to most-words-matched with a count notice, unpublished codes produce a notice naming the publishing dataset, and ACS returns both E and M suffix codes while cprofile families publish no margins of error. It also discloses nextOffset pagination, which an agent cannot learn from the annotations.

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?

Purpose is front-loaded in the first sentence and every later sentence carries distinct information, but several sentences are long and clause-dense (the code-vs-keyword precedence sentence especially), which slows parsing. It is efficient in content, less so in sentence structure.

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 multi-mode search tool with five parameters and an output schema, the description covers the ambiguities that matter: code vs keyword interpretation, ACS E/M pairing, dataset defaulting, ranking, notices, and pagination. Return-value structure is correctly left to the output schema.

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 baseline is 3, but the description still adds operational meaning: offset continues the same search rank order, adding a word narrows results because every word must match, and dataset resolution accepts defaults and shortened codes. Most of that is echoed in the schema, so it edges above baseline rather than transforming it.

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 first two sentences state a specific verb and resource (search Census variables across labels and concept groups, or look one up by code) and give the concrete outcome: variable codes with human-readable labels. It also names the downstream consumer explicitly ('the variable code B19013_001E needed for data queries') and routes table-level retrieval to census_query_data, so it is distinguishable in practice.

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?

It gives explicit when-to-use guidance across several modes: keyword search, single code/table lookup, retrieving a whole table (use census_query_data group instead of listing codes), and finding predicate codes such as NAICS2017 in cbp. It also states a narrowing rule and a paging rule, so the agent knows what to do next without inference.

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.