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.

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": {
      "variables": "<variables>"
    },
    "name": "census_get_variable"
  }
}

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. Changed1 schema field changed
    • 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. Also absent when the universe lookup failed, which the notice names along with the affected codes; retrying can return it."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, geoinfo, 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. 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."
  3. 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"
      +]
  4. 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 and closed-world, but the description adds substantial behavioral context beyond them: ACS responses include estimate_code/moe_code sibling links, MOE codes carry attribute_of and attribute_type=MARGIN_OF_ERROR, and the comparison profiles plus other dataset families return none of these fields. It also discloses that the tool resolves annotation/flag columns (B19013_001EA, EMP_F) and predicate codes, which is non-obvious behavior an agent could not infer from 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 and use cases are front-loaded in the first two sentences, and nearly every clause carries real information. The middle section is dense to the point of being a run-on, listing two full cprofile paths and multiple example codes that could be tightened without loss.

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 3-parameter read-only lookup with a full output schema, the description covers the remaining burden: what fields come back, how ACS vs. non-ACS datasets differ, and what the tool does not do. Nothing an agent needs in order 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.

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; the description earns above that by tying dataset choice to observable output differences (ACS datasets yield MOE sibling fields, cprofile and other families do not), which informs how an agent should set the `dataset` parameter. It does not, however, add anything about `year` or code-matching rules beyond what the schema already documents.

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?

Opens with a specific verb+resource ("Fetch full metadata for one or more Census variable codes") and immediately enumerates what metadata means: label, concept group, predicate type, table universe, MOE sibling references. That enumeration separates it from census_search_variables (finding codes) and census_list_predicate_values (enumerating accepted 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 two explicit use cases ("confirm a variable code before building a query, or to look up what a known code means") and routes the agent away to a named sibling for a related-but-different need: "for the values a dimension accepts rather than the dimension itself, call census_list_predicate_values." Both when-to-use and 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.