Skip to main content
Glama
jslagle9

census-trade-mcp-server

by jslagle9

Get Valid Variables for a Trade Dataset

census_trade_get_dataset_variables
Read-onlyIdempotent

List valid Census API variable names for any trade dataset and direction, preventing unknown-variable errors when querying exports or imports.

Instructions

List every valid Census API variable (field) name for a specific dataset + trade direction, straight from the Census API's own metadata.

Use this before calling census_trade_query_exports/imports when you're unsure which variable names are valid to put in the "get" or "filters" parameters - the Census API rejects unknown variable names with a 400 error, and valid variables differ by dataset (e.g. "SITC" is only valid on the sitc dataset, not hs).

Args:

  • direction ('exports' | 'imports'): which trade direction's variable list to fetch

  • dataset (string): dataset code, e.g. 'hs', 'naics', 'statehs' (see census_trade_list_datasets for the full list)

  • response_format ('markdown' | 'json'): output format (default 'markdown')

Returns: For each variable - its name, human-readable label, whether it's required, and its type (string/int/datetime).

Examples:

  • Use when: "What fields can I request from the imports NAICS endpoint?"

  • Use when: You got a "unknown variable" error from census_trade_query_exports and need to find the correct name

  • Don't use when: You just want dataset descriptions, not field-level detail - use census_trade_list_datasets instead

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetYesWhich commodity classification / geography dataset to query: 'hs' (Harmonized System, most detailed commodity codes, by country+district), 'naics' (industry classification, by country+district), 'enduse' (broad economic-use categories, by country+district), 'sitc' (Standard International Trade Classification, by country+district), 'usda' (agricultural vs. non-agricultural, by country+district), 'hitech' (Advanced Technology Products, by country+district), 'statehs' (HS codes by U.S. state instead of district, 2/4/6-digit only), 'statenaics' (NAICS by U.S. state instead of district, 2/3/4-digit only), 'porths' (HS codes by U.S. port instead of district, 2/4/6-digit only). Use list_trade_datasets for full descriptions.
directionYesTrade direction: 'exports' or 'imports'.
response_formatNoOutput format: 'markdown' for a human-readable table, or 'json' for machine-readable structured data.markdown
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, establishing a safe read operation. The description adds valuable context beyond this: it notes the Census API rejects unknown variable names with a 400 error, and that valid variables vary by dataset (e.g., SITC only on the sitc dataset). This failure-mode information helps the agent anticipate user needs and error conditions without contradicting any annotations.

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

Conciseness5/5

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

The description is well-organized into distinct sections: purpose, usage, args, returns, and examples. Every sentence serves a purpose, the opening is front-loaded with the core verb and resource, and the examples provide concrete use cases. Despite being longer than average, it avoids redundancy and is scannable.

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?

Given that there is no output schema, the description appropriately details the return structure ('For each variable - its name, human-readable label, whether it's required, and its type'). It also covers the full lifecycle: when to use, how to invoke, what to expect, and when not to use. The tool is fully self-contained and contextually complete for an agent navigating a complex API.

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%, with each parameter (direction, dataset, response_format) having a full description and enum values. The description's Args section somewhat duplicates this information, but it adds a small amount of context, such as the note to 'see census_trade_list_datasets for the full list' and the default value for response_format. Since the schema already carries the heavy load, the description adds marginal value, keeping this at the baseline 3.

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 description opens with a specific verb+resource: 'List every valid Census API variable (field) name for a specific dataset + trade direction.' This clearly distinguishes it from sibling tools like census_trade_query_exports/imports and census_trade_list_datasets. The explicit mention of listing fields rather than querying data or listing datasets removes any ambiguity.

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?

The description explicitly instructs when to use the tool ('Use this before calling census_trade_query_exports/imports when you're unsure which variable names are valid'), and provides a clear 'Don't use when' case with a named alternative (use census_trade_list_datasets instead). This exceeds typical guidance by giving both positive and negative usage scenarios.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jslagle9/uscensus-intl-trade-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server