Skip to main content
Glama

Get Census Variable Metadata

census_get_variable
Read-only

Fetch full metadata for one or more Census variable codes — label, concept group, predicate type, the table's universe, and margin-of-error sibling references. Use to confirm a variable code before building a query, or to look up what a known code means. On ACS datasets it returns estimate_code and moe_code sibling references so you can request both without a separate search, and a margin-of-error code carries attribute_of (its estimate) and attribute_type MARGIN_OF_ERROR; the ACS comparison profiles (acs/acs5/cprofile, acs/acs1/cprofile) and the other dataset families publish no margins of error and carry none of these fields. It also resolves the annotation and flag columns the data tools accept, such as B19013_001EA or EMP_F, naming the column each one belongs to, and predicate codes such as NAICS2017 or SEX, confirming a filter dimension exists in a dataset before a query uses it — for the values a dimension accepts rather than the dimension itself, call census_list_predicate_values.

Input Schema

NameRequiredDescriptionDefault
yearNoVintage year (default: latest available for the dataset).
datasetNoDataset the variables belong to (default: "acs/acs5"). Use census_list_datasets to discover valid values. 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.
variablesYesOne or more variable codes to look up (e.g., ["B19013_001E", "B19013_001M"]). Codes are trimmed and matched regardless of case, and the response echoes the dataset's own spelling — uppercase everywhere except the comparison profiles' significance columns (e.g., CP03_2024to2019_062SS).

Output Schema

NameRequiredDescriptionDefault
yearNoVintage year queried.
errorNoPresent when the call failed. Absent on success.
noticeNoPresent when the dataset's universe lookup failed: names the codes returned without universe for that reason, and says to retry.
datasetNoDataset queried.
variablesNoVariable metadata in the same order as the input array.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `variable_not_found`: One or more variable codes were not found in the dataset and year. `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 — the dataset's variables.json, groups.json, or an attribute column's own entry — could not be fetched or parsed. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `variable_not_found`: One or more variable codes were not found in the dataset and year. `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`: The dataset's variables.json came back as HTML or unparseable, or an attribute column's own entry could not be fetched or parsed. `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: -[
      -  "variable_not_found",
      -  "dataset_not_found",
      -  "year_not_available",
      -  "variables_unavailable"
      -]New value: +[
      +  "variable_not_found",
      +  "dataset_not_found",
      +  "year_not_available",
      +  "variables_unavailable",
      +  "upstream_error"
      +]
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Present when the dataset's universe lookup failed: names the codes returned without universe for that reason, and says to retry.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / variables / items / properties / attribute_type / description
      Previous value: -"For an annotation, flag, or margin-of-error column, its kind as the Census publishes it (e.g., \"ANNOTATION\", \"FLAG\", \"MARGIN_OF_ERROR\"). Absent on ordinary variables."New value: +"For an annotation, flag, or margin-of-error column, its kind in upper-snake case (e.g., \"ANNOTATION\", \"FLAG\", \"MARGIN_OF_ERROR\"), whatever spelling the vintage publishes — older vintages write \"Annotation\" or \"Margin of Error\". Absent on ordinary variables."
    • changedOutput schema / properties / variables / items / properties / universe / description
      Previous value: -"Universe of the variable's table (e.g., \"Households\", \"Population 25 years and over\"). Absent when the table publishes none — the ACS subject, profile, and selected population profile tables, dec/dp, the business datasets, pep/charv, and every ACS and dec/pl vintage before 2020 publish none — and for a column that belongs to no single table."New value: +"Universe of the variable's table (e.g., \"Households\", \"Population 25 years and over\"). Absent when the table publishes none — the ACS subject, profile, and selected population profile tables, dec/dp, the business datasets, pep/charv, and every ACS and dec/pl vintage before 2020 publish none — and for a column that belongs to no single table. Also absent when the universe lookup failed, which the notice names along with the affected codes; retrying can return it."
  2. Changed10 schema fields changed
    • changedInput schema / properties / dataset / description
      Previous value: -"Dataset the variables belong to (default: \"acs/acs5\"). Use census_list_datasets to discover valid values."New value: +"Dataset the variables belong to (default: \"acs/acs5\"). Use census_list_datasets to discover valid values. 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."
    • changedInput schema / properties / variables / description
      Previous value: -"One or more variable codes to look up (e.g., [\"B19013_001E\", \"B19013_001M\"]). Variable codes are case-sensitive."New value: +"One or more variable codes to look up (e.g., [\"B19013_001E\", \"B19013_001M\"]). Codes are trimmed and matched regardless of case, and the response echoes the dataset's own spelling — uppercase everywhere except the comparison profiles' significance columns (e.g., CP03_2024to2019_062SS)."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `variable_not_found`: One or more variable codes were not found in the dataset and year. `dataset_not_found`: Dataset code is not recognized. `year_not_available`: The dataset does not serve the requested vintage year. `variables_unavailable`: Variable metadata endpoint is unreachable or returned an unparseable response. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `variable_not_found`: One or more variable codes were not found in the dataset and year. `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 — the dataset's variables.json, groups.json, or an attribute column's own entry — could not be fetched or parsed. Other values are possible when a failure originates below the handler."
    • addedOutput schema / properties / variables / items / properties / attribute_of
      Added value: +{
      +  "description": "For an annotation, flag, or margin-of-error column, the column it belongs to, as the Census publishes it (e.g., \"B19013_001E\" for B19013_001EA or B19013_001M). Absent on ordinary variables.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / variables / items / properties / attribute_type
      Added value: +{
      +  "description": "For an annotation, flag, or margin-of-error column, its kind as the Census publishes it (e.g., \"ANNOTATION\", \"FLAG\", \"MARGIN_OF_ERROR\"). Absent on ordinary variables.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / variables / items / properties / concept / description
      Previous value: -"Concept group the variable belongs to."New value: +"Concept of the table the variable belongs to. 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: -"Estimate sibling variable code when this is a margin-of-error variable. ACS datasets only — no other family publishes margins of error."New value: +"Estimate sibling 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: -"Margin-of-error sibling code when this is an estimate variable. Include both 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: +"Margin-of-error sibling code when this is an estimate variable. Include both 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 / properties / universe / description
      Previous value: -"Universe the variable applies to (e.g., \"Households\", \"People 25 years and over\")."New value: +"Universe of the variable's table (e.g., \"Households\", \"Population 25 years and over\"). Absent when the table publishes none — the ACS subject, profile, and selected population profile tables, dec/dp, the business datasets, pep/charv, and every ACS and dec/pl vintage before 2020 publish none — and for a column that belongs to no single table."
    • changedOutput schema / properties / variables / items / required
      Previous value: -[
      -  "variable_code",
      -  "label",
      -  "concept",
      -  "predicate_type"
      -]New value: +[
      +  "variable_code",
      +  "label",
      +  "predicate_type"
      +]
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations cover only readOnlyHint and openWorldHint, and the description goes well beyond them: it discloses that ACS results include estimate_code/moe_code sibling references, that MOE codes carry attribute_of and attribute_type MARGIN_OF_ERROR, and that cprofile datasets publish neither. It also explains that annotation/flag columns (B19013_001EA, EMP_F) are resolvable. The only unmet burden is any mention of rate limits, error behavior, or response shape, which keeps it from a 5.

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 clause and nothing is truly filler — every sentence carries domain detail. However, the middle sentence is a dense, semicolon-chained run-on about ACS vs. cprofile behavior that is harder to parse 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 metadata-lookup tool with an output schema (so return values need no explanation) and full schema coverage, this covers purpose, use cases, the alternative sibling, and dataset-family edge cases. Nothing an agent needs to call it correctly is missing.

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?

Schema description coverage is 100%, so the schema already documents year, dataset, and variables in detail (defaults, case handling, two-part abbreviation rules). The description adds no parameter-level syntax or format guidance of its own; baseline 3 applies.

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?

Starts with a specific verb+resource ("Fetch full metadata for one or more Census variable codes") and enumerates what comes back: label, concept group, predicate type, universe, MOE siblings. It also explicitly separates itself from census_search_variables (lookup by known code) and census_list_predicate_values (values a dimension accepts), so an agent can route correctly without opening schemas.

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 two concrete use cases ("confirm a variable code before building a query" and "look up what a known code means") plus an explicit exclusion with a named alternative for predicate values. Both the when and the when-not are stated.

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.