Search Commodity Codes
comtrade_search_commoditiesFind HS or SITC commodity codes by keyword, description, or code prefix. A code written with dots, spaces, or hyphens ("0901.11") matches 090111. Exact codes, code prefixes and contiguous description matches rank first, followed by descriptions containing every query term in any order. Default HS searches include historical codes and report which edition catalogs list each code. Use a trade row’s classificationCode or comtrade_get_data_availability to identify the edition, then search that edition for its descriptions. Keyless goods queries use HS for as-reported data. Continue with nextOffset using the same query, classification, and aggr_level.
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": {
"query": "<query>"
},
"name": "comtrade_search_commodities"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum matching codes returned per page; defaults to 50. | |
| query | Yes | Keyword, partial description, or commodity code prefix. Dots, spaces, and hyphens in a code are ignored, so "0901.11" finds 090111. Examples: "motor vehicles", "8471", "coffee", "84" (HS chapter 84 = machinery). | |
| offset | No | Number of matching codes to skip; use nextOffset to continue. | |
| aggr_level | No | Native aggregation level: HS uses 2 (chapter), 4 (heading), 6 (subheading); SITC uses 1–5. Omit to return all matching levels. | |
| classification | No | Goods reference catalog, case-insensitive: HS uses the default HS.json discovery catalog, whose total identifies H6; it is not an authoritative historical-edition reference. Select H0–H6 for an explicit HS edition, or SS/S1–S4 for SITC. | HS |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of codes returned on this page. | |
| notice | No | Recovery hint when no codes match, matches remain past this page, or the offset is past the end. Absent otherwise. | |
| offset | No | Number of matching codes skipped for this page. | |
| matches | No | Commodity codes on this page matching the query in the selected classification, ranked exact code, code prefix, whole-word description match, then other description matches for the contiguous query, then descriptions containing every term in any order. Ties keep catalog order. | |
| truncated | No | Whether this page holds only part of the matching codes (shown < totalMatches). | |
| nextOffset | No | Offset for the next page; absent when no matching codes remain. | |
| totalMatches | No | Total matching codes across all pages. | |
| classification | No | Reference catalog used for the search. | |
| referenceNotice | No | Unavailable HS edition catalog names when the discovery page is returned without edition enrichment. |