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:
| Category | Tools | Purpose |
|---|---|---|
| Tariff queries | get_tariff, search_tariffs | Look up and search tariff codes |
| Enrichment | enrich_hts6_codes, generate_multilevel_embeddings, get_enrichment_status | AI enrichment pipeline |
| Graph | generate_graph_edges, classify_graph_edges, get_graph_status, get_code_relationships | Knowledge graph |
| Resources | search_tariff_resources, add_tariff_resource, get_resource_statistics | Policy documents |
| References | get_tariff_references, get_tariffs_referencing_code, get_database_status | Cross-references and status |
Recommended Tool Sequences
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 codesQuick 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") # optionalExploring 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 descriptionsSearch Strategy Selection
| User Intent | Strategy | Why |
|---|---|---|
| Natural language description | hybrid | Best overall accuracy, combines semantic + lexical |
| Specific product terms | lexical | Faster, exact term matching |
| Vague or conceptual query | semantic | Embedding similarity handles conceptual matches |
Multi-Level Search
The level parameter controls search granularity:
| Level | When to Use |
|---|---|
hts8 (default) | Specific tariff line lookup |
hts6 | Broader category search (uses AI-enriched descriptions) |
hts4 | Heading-level exploration |
chapter | Broad commodity group discovery |
The variant parameter controls embedding text:
| Variant | Content |
|---|---|
full (default) | Includes section, chapter, heading context, better for disambiguation |
short | Code 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:
| Type | Meaning | Action |
|---|---|---|
material_affinity | Same material, different forms | Note material connection |
functional_similarity | Same purpose, different materials | Present as alternative |
substitution | Borderline products | Warn about classification boundary |
component_assembly | Part-to-whole | Note manufacturing relationship |
end_use | Used together | Contextual information |
manufacturing_process | Similar production | Background knowledge |
cross_category_bridge | Unexpected cross-chapter link | Highlight for user |
abstraction | Hierarchical parent-child | Navigation aid |
weak_association | Tangential | Low priority |
no_meaningful_relationship | False positive | Ignore |
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.