HTS MCP
Skip to Content
GuidesFor LLMs

For LLMs

Patterns and best practices for AI agents using HTS MCP through the Model Context Protocol.

Available Tools

HTS MCP exposes 14 MCP tools organized into 5 categories:

CategoryToolsPurpose
Tariff queriesget_tariff, search_tariffsLook up and search tariff codes
Enrichmentenrich_hts6_codes, generate_multilevel_embeddings, get_enrichment_statusAI enrichment pipeline
Graphgenerate_graph_edges, classify_graph_edges, get_graph_status, get_code_relationshipsKnowledge graph
Resourcessearch_tariff_resources, add_tariff_resource, get_resource_statisticsPolicy documents
Referencesget_tariff_references, get_tariffs_referencing_code, get_database_statusCross-references and status

Tariff Lookup

When a user asks about a specific product:

1. search_tariffs(query="user's product description", strategy="hybrid", limit=5) 2. get_tariff(hts_code=top_result.code) # full detail 3. get_tariff_references(hts_code=code) # cross-references 4. get_code_relationships(hts_code=code) # related codes

Quick Code Lookup

When the user provides an 8-digit code directly:

1. get_tariff(hts_code="0201.30.80") 2. get_tariff_references(hts_code="0201.30.80") # optional

Exploring Relationships

When the user wants to understand connections between codes:

1. get_code_relationships(hts_code=code, min_confidence=0.7) 2. For each interesting related code: get_tariff(hts_code=related_code)

Policy Research

When the user asks about trade policy:

1. search_tariff_resources(query="topic", resource_type="guidance") 2. Present results with titles, URLs, and descriptions

Search Strategy Selection

User IntentStrategyWhy
Natural language descriptionhybridBest overall accuracy, combines semantic + lexical
Specific product termslexicalFaster, exact term matching
Vague or conceptual querysemanticEmbedding similarity handles conceptual matches

The level parameter controls search granularity:

LevelWhen to Use
hts8 (default)Specific tariff line lookup
hts6Broader category search (uses AI-enriched descriptions)
hts4Heading-level exploration
chapterBroad commodity group discovery

The variant parameter controls embedding text:

VariantContent
full (default)Includes section, chapter, heading context, better for disambiguation
shortCode and description only, better for direct similarity

Response Interpretation

Search Results

Results include a score field (0-1). Interpret as:

  • 0.8+: Strong match, high confidence
  • 0.6-0.8: Good match, verify with user
  • 0.3-0.6: Partial match, present as alternative
  • Below 0.3: Weak match, likely not relevant

Relationship Types

The knowledge graph classifies edges into 10 types:

TypeMeaningAction
material_affinitySame material, different formsNote material connection
functional_similaritySame purpose, different materialsPresent as alternative
substitutionBorderline productsWarn about classification boundary
component_assemblyPart-to-wholeNote manufacturing relationship
end_useUsed togetherContextual information
manufacturing_processSimilar productionBackground knowledge
cross_category_bridgeUnexpected cross-chapter linkHighlight for user
abstractionHierarchical parent-childNavigation aid
weak_associationTangentialLow priority
no_meaningful_relationshipFalse positiveIgnore

System Health

Call get_database_status at the start of a session to verify:

  • Tariff data is loaded
  • Embeddings are available (required for semantic/hybrid search)
  • Enrichments exist (required for HTS6-level search)
  • Graph data is populated (required for relationship queries)

If embeddings are unavailable, search will automatically fall back to lexical-only mode.