Skip to main content
Glama

Comtrade Top Commodities

comtrade_top_commodities
Read-onlyIdempotent

Rank the products two countries actually trade, largest value first — "what does the US import most from China". Returns HS categories with trade value and net weight. Defaults to HS 2-digit chapters (~97 categories, e.g. 85 Electrical machinery); pass hs_level 4 or 6 for finer product detail.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flowYesTrade flow, REQUIRED because it decides what the answer MEANS: "X" for exports (what a country SELLS / ships abroad) or "M" for imports (what it BUYS / receives). Deliberately not defaulted — guessing returns imports for an export question, which reads as a confident wrong answer instead of an error.
yearYesTrade year (e.g., "2024")
limitNoNumber of top commodities to return (default 20)
hs_levelNoHS aggregation level: 2 for chapters (default, ~97 broad categories), 4 for headings, 6 for subheadings. Higher numbers give finer product detail and many more rows.
partner_codeNoPartner country name or UN code (0=World). Optional — defaults to World. Names resolved automatically.
reporter_codeYesCountry name (e.g. "USA", "China") or UN numeric code (842=US). Names resolved automatically.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
flowYesTrade flow type (Imports or Exports)
yearYesTrade year queried
partnerYesPartner country name
reporterYesReporting country name
top_commoditiesYes
total_commoditiesYesTotal number of top commodities returned

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changed
    • changedInput schema / properties / flow / description
      Previous value: -"Trade flow: \"M\" for imports, \"X\" for exports"New value: +"Trade flow, REQUIRED because it decides what the answer MEANS: \"X\" for exports (what a country SELLS / ships abroad) or \"M\" for imports (what it BUYS / receives). Deliberately not defaulted — guessing returns imports for an export question, which reads as a confident wrong answer instead of an error."
    • changedInput schema / required
      Previous value: -[
      -  "reporter_code",
      -  "partner_code",
      -  "year",
      -  "flow"
      -]New value: +[
      +  "reporter_code",
      +  "year",
      +  "flow"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / hs_level
      Added value: +{
      +  "description": "HS aggregation level: 2 for chapters (default, ~97 broad categories), 4 for headings, 6 for subheadings. Higher numbers give finer product detail and many more rows.",
      +  "type": "number"
      +}
  3. Changed2 schema fields changed
    • changedInput schema / properties / partner_code / description
      Previous value: -"ISO numeric country code for the partner country"New value: +"Partner country name or UN code (0=World). Optional — defaults to World. Names resolved automatically."
    • changedInput schema / properties / reporter_code / description
      Previous value: -"ISO numeric country code for the reporting country"New value: +"Country name (e.g. \"USA\", \"China\") or UN numeric code (842=US). Names resolved automatically."
  4. Changed1 schema field changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "flow": "M",
      -    "limit": 15,
      -    "partner_code": "156",
      -    "reporter_code": "840",
      -    "year": "2024"
      -  },
      -  {
      -    "flow": "X",
      -    "partner_code": "840",
      -    "reporter_code": "392",
      -    "year": "2023"
      -  }
      -]New value: +[
      +  {
      +    "flow": "M",
      +    "limit": 15,
      +    "partner_code": "156",
      +    "reporter_code": "842",
      +    "year": "2024"
      +  },
      +  {
      +    "flow": "X",
      +    "partner_code": "842",
      +    "reporter_code": "392",
      +    "year": "2023"
      +  }
      +]
  5. Changed3 schema fields changed
    • removedOutput schema / properties / top_commodities / description
      Removed value: -"List of top traded commodities ranked by value"
    • changedOutput schema / properties / top_commodities / items / properties / commodity / description
      Previous value: -"Commodity description"New value: +"Commodity description or code"
    • changedOutput schema / properties / top_commodities / items / properties / trade_value_usd / description
      Previous value: -"Trade value for this commodity in USD"New value: +"Trade value in USD"
  6. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "flow": {
      +      "description": "Trade flow type (Imports or Exports)",
      +      "type": "string"
      +    },
      +    "partner": {
      +      "description": "Partner country name",
      +      "type": "string"
      +    },
      +    "reporter": {
      +      "description": "Reporting country name",
      +      "type": "string"
      +    },
      +    "top_commodities": {
      +      "description": "List of top traded commodities ranked by value",
      +      "items": {
      +        "properties": {
      +          "commodity": {
      +            "description": "Commodity description",
      +            "type": "string"
      +          },
      +          "hs_code": {
      +            "description": "HS commodity code",
      +            "type": "string"
      +          },
      +          "net_weight_kg": {
      +            "description": "Net weight in kilograms",
      +            "type": "number"
      +          },
      +          "rank": {
      +            "description": "Commodity rank by trade value",
      +            "type": "number"
      +          },
      +          "trade_value_usd": {
      +            "description": "Trade value for this commodity in USD",
      +            "type": "number"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "total_commodities": {
      +      "description": "Total number of top commodities returned",
      +      "type": "number"
      +    },
      +    "year": {
      +      "description": "Trade year queried",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "reporter",
      +    "partner",
      +    "year",
      +    "flow",
      +    "total_commodities",
      +    "top_commodities"
      +  ],
      +  "type": "object"
      +}
  7. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "flow": "M",
      +    "limit": 15,
      +    "partner_code": "156",
      +    "reporter_code": "840",
      +    "year": "2024"
      +  },
      +  {
      +    "flow": "X",
      +    "partner_code": "840",
      +    "reporter_code": "392",
      +    "year": "2023"
      +  }
      +]
  8. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint false. The description adds behavioral context beyond that: it returns HS categories with trade value and net weight, defaults to HS 2-digit, and explains how hs_level changes granularity. No contradictions.

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?

Two sentences deliver the core action, an example, output contents, and the key parameter (hs_level) customization. Front-loaded with the most important information, no filler.

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 six well-documented schema parameters and an output schema, the description covers the essential decision points: what the tool does, what it returns, default behavior, and how to adjust granularity. The example anchors usage, and no critical information is missing for a read-only ranking tool.

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 covers 100% of parameters, so baseline is 3. The description adds meaningful semantics for hs_level ('Defaults to HS 2-digit chapters (~97 categories, e.g. 85 Electrical machinery); pass hs_level 4 or 6 for finer product detail') and clarifies the output meaning of flow via the example. This exceeds the schema's per-parameter descriptions.

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?

Description opens with a specific action verb and resource: 'Rank the products two countries actually trade, largest value first' and provides a concrete example ('what does the US import most from China'). This clearly differentiates from sibling tools like comtrade_top_partners (ranks partners) and comtrade_trade_data (likely raw trade data).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states the tool's purpose and default behavior (HS 2-digit, largest value first) and implies when to use it for ranked product answers. It does not explicitly name alternatives or exclusions, but the context is clear enough for selection among siblings.

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.

TDQS

A3.8/5.0
Disambiguation3/5

Some tools have near-identical purposes (ask_pipeworx vs ask_pipeworx_beta are currently identical; polymarket_arbitrage vs polymarket_edges both find opportunities), but detailed descriptions and distinct input patterns mostly help an agent choose. A few discovery/verification tools (suggest_questions vs discover_tools, validate_claim vs ask_pipeworx_grounded) also overlap, creating residual ambiguity.

Naming Consistency3/5

All names are snake_case and many use domain prefixes (comtrade_, polymarket_, pipeworx_), but the set mixes verb_noun (compare_entities, discover_tools), bare verbs (remember, forget, subscribe), and noun phrases (entity_profile, recent_changes). This inconsistency, plus the use of domain-specific prefixes as a substitute for a uniform verb_noun style, makes the naming pattern only moderately predictable.

Tool Count2/5

35 tools is well beyond the typical well-scoped range, and the vast majority (prediction markets, memory, subscriptions, feedback, npm dependency checks) have nothing to do with the server's apparent Comtrade trade-data purpose. This bloat makes the set feel unfocused, even though some meta-tools serve a general data-access mission.

Completeness4/5

For the Comtrade trade-data domain, the four comtrade_* tools cover country codes, top commodities, top partners, and detailed bilateral trade values — enough for most queries, with minor gaps like time-series trends or tariff lookups. For the broader Pipeworx data-access scope, the set is extensive (ask_pipeworx, deep_research, entity_profile, validate_claim, subscriptions), so no severe dead ends are apparent.