Skip to main content
Glama
FreightUtils MCP Server

FreightUtils MCP Server

resolve_reference

Read-onlyIdempotent

Resolve an unknown freight identifier such as UN numbers, ports, container codes, or Incoterms into ranked, typed, and cited candidates when the token's entity type is unclear.

Instructions

Resolve an arbitrary freight identifier — one opaque string in, typed and cited candidates out. Use when you hold one identifier-ish token ("176", "UN1845", "NLRTM", "FOB", "22G1", "MSKU1100810", "D/E") and do not know what kind of identifier it is: each candidate names its entity type and carries the api_url and canonical_url of its full record.

Provide q: ONE identifier (single token, max 32 chars). Fourteen grammars all run — UN numbers, AWB prefixes, airline IATA/ICAO, airport IATA/ICAO, UN/LOCODE, ISO 6346 container numbers (check digit computed), HS codes (6-10 digits; national lines resolve at their 6-digit international parent), Incoterms, ADR tunnel codes, ADR Table A codes (special provisions, packing instructions and their PP/B/L provisions, MP, T/BK/TP, tank codes, TU/TC/TE/TA/TT/TM, V/VC/AP/CV/S, vehicle designations, labels, hazard identification numbers — e.g. "TU9" → its meaning, section and review status; a well-formed code no Table A row carries, e.g. "P999", is pattern_only), ULD serials, ISO container size/type codes. Ambiguity is the product: colliding grammars return MULTIPLE ranked candidates ("LHR" is Heathrow AND an Egyptian carrier's ICAO; "336" is an ADR special provision AND a hazard identification number), never a silent guess.

Behavior: deterministic — normalize (trim, uppercase, collapse spaces/dashes, strip a UN prefix), match ALL grammars, rank by record-hit > verification status > static dataset prior (airlines/adr/unlocode first) > stable tiebreak; every candidate carries rank_basis so the ordering is inspectable. Zero candidates is a VALID result (count 0 + note), never an error. A failed container check digit returns a candidate with valid:false rather than dropping it. Rate-limited: a limit error carries reset_at, the UTC time the allowance resets.

Returns: query, normalized, count and candidates[] — each with entity_type, identifier_type, value_normalized, summary, record (the core fields the matching dataset holds), verification_status + verification_basis, rank_basis, canonical_url, api_url and a per-candidate dataset citation — under result, plus confidence, _source and citation (the FreightUtils v1 response envelope).

Limitations: v1 is SINGLE-TOKEN resolution, not free-text extraction — pass one identifier, not a manifest line; SCAC/BIC codes are not yet covered; a match asserts the identifier is known/well-formed, not that a shipment exists.

Related: every lookup tool this resolves into — adr_lookup, airline_lookup, airport_lookup, unlocode_lookup, hs_code_lookup, incoterms_lookup, container_lookup, uld_lookup, validate.

Input Schema

NameRequiredDescriptionDefault
qYesOne freight identifier — e.g. "176", "UN1845", "NLRTM", "FOB", "LHR", "22G1", "MSKU1100810", "090111", "AKE12345AB", "D/E", "TU9".

Output Schema

NameRequiredDescriptionDefault
okYes
_metaNo
as_ofNo
resultYes
statusNo
_sourceYes
editionNo
citationYes
validityNo
warningsNo
confidenceYes
missing_inputsNo
blocking_errorsNo
envelope_versionYes
normalized_inputNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv2.27.0
    • changedInput schema / properties / q / description
      Previous value: -"One freight identifier — e.g. \"176\", \"UN1845\", \"NLRTM\", \"FOB\", \"LHR\", \"22G1\", \"MSKU1100810\", \"090111\", \"AKE12345AB\", \"D/E\"."New value: +"One freight identifier — e.g. \"176\", \"UN1845\", \"NLRTM\", \"FOB\", \"LHR\", \"22G1\", \"MSKU1100810\", \"090111\", \"AKE12345AB\", \"D/E\", \"TU9\"."
    • addedOutput schema / properties / _meta / properties / check_id
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / _meta / properties / edition_basis
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / _meta / properties / receipt
      Added value: +{
      +  "additionalProperties": {},
      +  "properties": {
      +    "created_at": {
      +      "type": "string"
      +    },
      +    "dataset_version": {
      +      "additionalProperties": {
      +        "type": "string"
      +      },
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "engine_version": {
      +      "type": "string"
      +    },
      +    "inputs": {},
      +    "reason": {
      +      "const": "key_required",
      +      "type": "string"
      +    },
      +    "receipt_hash": {
      +      "type": "string"
      +    },
      +    "result": {
      +      "additionalProperties": {},
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "schema_version": {
      +      "type": "string"
      +    },
      +    "stored": {
      +      "const": false,
      +      "type": "boolean"
      +    },
      +    "tool": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "stored",
      +    "reason",
      +    "schema_version",
      +    "receipt_hash",
      +    "created_at",
      +    "tool",
      +    "inputs",
      +    "dataset_version",
      +    "engine_version",
      +    "result"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / _meta / properties / receipt_url
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / properties / result / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": {},
      -    "properties": {
      -      "candidates": {
      -        "anyOf": [
      -          {
      -            "items": {
      -              "additionalProperties": {},
      -              "properties": {
      -                "api_url": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "canonical_url": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "citation": {
      -                  "anyOf": [
      -                    {
      -                      "additionalProperties": {},
      -                      "properties": {
      -                        "qualifier": {
      -                          "type": [
      -                            "string",
      -                            "null"
      -                          ]
      -                        },
      -                        "text": {
      -                          "type": [
      -                            "string",
      -                            "null"
      -                          ]
      -                        }
      -                      },
      -                      "type": "object"
      -                    },
      -                    {
      -                      "type": "null"
      -                    }
      -                  ]
      -                },
      -                "entity_type": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "identifier_type": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "rank_basis": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "record": {
      -                  "anyOf": [
      -                    {
      -                      "additionalProperties": {},
      -                      "propertyNames": {
      -                        "type": "string"
      -                      },
      -                      "type": "object"
      -                    },
      -                    {
      -                      "type": "null"
      -                    }
      -                  ]
      -                },
      -                "summary": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "value_normalized": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "verification_basis": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "verification_status": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                }
      -              },
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ]
      -      },
      -      "count": {
      -        "type": [
      -          "number",
      -          "null"
      -        ]
      -      },
      -      "normalized": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "note": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "query": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": {},
      -    "propertyNames": {
      -      "type": "string"
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": {},
      +    "properties": {
      +      "candidates": {
      +        "anyOf": [
      +          {
      +            "items": {
      +              "additionalProperties": {},
      +              "properties": {
      +                "api_url": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "canonical_url": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "citation": {
      +                  "anyOf": [
      +                    {
      +                      "additionalProperties": {},
      +                      "properties": {
      +                        "qualifier": {
      +                          "type": [
      +                            "string",
      +                            "null"
      +                          ]
      +                        },
      +                        "text": {
      +                          "type": [
      +                            "string",
      +                            "null"
      +                          ]
      +                        }
      +                      },
      +                      "type": "object"
      +                    },
      +                    {
      +                      "type": "null"
      +                    }
      +                  ]
      +                },
      +                "entity_type": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "identifier_type": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "rank_basis": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "record": {
      +                  "anyOf": [
      +                    {
      +                      "additionalProperties": {},
      +                      "propertyNames": {
      +                        "type": "string"
      +                      },
      +                      "type": "object"
      +                    },
      +                    {
      +                      "type": "null"
      +                    }
      +                  ]
      +                },
      +                "summary": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "value_normalized": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "verification_basis": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "verification_status": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      },
      +      "count": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "failure": {
      +        "anyOf": [
      +          {
      +            "additionalProperties": {},
      +            "properties": {
      +              "candidate_types": {
      +                "anyOf": [
      +                  {
      +                    "items": {
      +                      "type": "string"
      +                    },
      +                    "type": "array"
      +                  },
      +                  {
      +                    "type": "null"
      +                  }
      +                ]
      +              },
      +              "message": {
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "reason": {
      +                "anyOf": [
      +                  {
      +                    "enum": [
      +                      "NO_MATCH",
      +                      "AMBIGUOUS"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  {
      +                    "type": "null"
      +                  }
      +                ]
      +              }
      +            },
      +            "type": "object"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      },
      +      "normalized": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "note": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "query": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "validation": {
      +        "anyOf": [
      +          {
      +            "additionalProperties": {},
      +            "properties": {
      +              "failure": {
      +                "anyOf": [
      +                  {
      +                    "additionalProperties": {},
      +                    "properties": {
      +                      "example": {
      +                        "type": [
      +                          "string",
      +                          "null"
      +                        ]
      +                      },
      +                      "expected_format": {
      +                        "type": [
      +                          "string",
      +                          "null"
      +                        ]
      +                      },
      +                      "message": {
      +                        "type": [
      +                          "string",
      +                          "null"
      +                        ]
      +                      },
      +                      "reason": {
      +                        "anyOf": [
      +                          {
      +                            "enum": [
      +                              "INVALID_CHECK_DIGIT",
      +                              "WRONG_LENGTH",
      +                              "BAD_CHARSET",
      +                              "UNKNOWN_PREFIX",
      +                              "UNSUPPORTED_TYPE",
      +                              "AMBIGUOUS"
      +                            ],
      +                            "type": "string"
      +                          },
      +                          {
      +                            "type": "null"
      +                          }
      +                        ]
      +                      }
      +                    },
      +                    "type": "object"
      +                  },
      +                  {
      +                    "type": "null"
      +                  }
      +                ]
      +              },
      +              "type": {
      +                "anyOf": [
      +                  {
      +                    "enum": [
      +                      "awb",
      +                      "container",
      +                      "imo"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  {
      +                    "type": "null"
      +                  }
      +                ]
      +              },
      +              "valid": {
      +                "type": [
      +                  "boolean",
      +                  "null"
      +                ]
      +              }
      +            },
      +            "type": "object"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": {},
      +    "propertyNames": {
      +      "type": "string"
      +    },
      +    "type": "object"
      +  }
      +]
  2. Changed10 schema fields changedv2.24.0
    • addedOutput schema / properties / _meta
      Added value: +{
      +  "additionalProperties": {},
      +  "properties": {
      +    "identify": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / as_of
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / blocking_errors / items / properties / recovery / properties / params / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / edition
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "applies_from": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "may_apply_until": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "name": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "name",
      +        "applies_from",
      +        "may_apply_until"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • changedOutput schema / properties / envelope_version / enum
      Previous value: -[
      -  "1",
      -  "1.1"
      -]New value: +[
      +  "1",
      +  "1.1",
      +  "1.2"
      +]
    • addedOutput schema / properties / missing_inputs
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / normalized_input / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / properties / result / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": true,
      -    "properties": {
      -      "candidates": {
      -        "anyOf": [
      -          {
      -            "items": {
      -              "additionalProperties": true,
      -              "properties": {
      -                "api_url": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "canonical_url": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "citation": {
      -                  "anyOf": [
      -                    {
      -                      "additionalProperties": true,
      -                      "properties": {
      -                        "qualifier": {
      -                          "type": [
      -                            "string",
      -                            "null"
      -                          ]
      -                        },
      -                        "text": {
      -                          "type": [
      -                            "string",
      -                            "null"
      -                          ]
      -                        }
      -                      },
      -                      "type": "object"
      -                    },
      -                    {
      -                      "type": "null"
      -                    }
      -                  ]
      -                },
      -                "entity_type": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "identifier_type": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "rank_basis": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "record": {
      -                  "anyOf": [
      -                    {
      -                      "additionalProperties": {},
      -                      "type": "object"
      -                    },
      -                    {
      -                      "type": "null"
      -                    }
      -                  ]
      -                },
      -                "summary": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "value_normalized": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "verification_basis": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                },
      -                "verification_status": {
      -                  "type": [
      -                    "string",
      -                    "null"
      -                  ]
      -                }
      -              },
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ]
      -      },
      -      "count": {
      -        "type": [
      -          "number",
      -          "null"
      -        ]
      -      },
      -      "normalized": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "note": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      },
      -      "query": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": {},
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": {},
      +    "properties": {
      +      "candidates": {
      +        "anyOf": [
      +          {
      +            "items": {
      +              "additionalProperties": {},
      +              "properties": {
      +                "api_url": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "canonical_url": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "citation": {
      +                  "anyOf": [
      +                    {
      +                      "additionalProperties": {},
      +                      "properties": {
      +                        "qualifier": {
      +                          "type": [
      +                            "string",
      +                            "null"
      +                          ]
      +                        },
      +                        "text": {
      +                          "type": [
      +                            "string",
      +                            "null"
      +                          ]
      +                        }
      +                      },
      +                      "type": "object"
      +                    },
      +                    {
      +                      "type": "null"
      +                    }
      +                  ]
      +                },
      +                "entity_type": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "identifier_type": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "rank_basis": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "record": {
      +                  "anyOf": [
      +                    {
      +                      "additionalProperties": {},
      +                      "propertyNames": {
      +                        "type": "string"
      +                      },
      +                      "type": "object"
      +                    },
      +                    {
      +                      "type": "null"
      +                    }
      +                  ]
      +                },
      +                "summary": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "value_normalized": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "verification_basis": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                },
      +                "verification_status": {
      +                  "type": [
      +                    "string",
      +                    "null"
      +                  ]
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ]
      +      },
      +      "count": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "normalized": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "note": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "query": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": {},
      +    "propertyNames": {
      +      "type": "string"
      +    },
      +    "type": "object"
      +  }
      +]
    • addedOutput schema / properties / status
      Added value: +{
      +  "enum": [
      +    "ok",
      +    "partial",
      +    "not_found",
      +    "unsupported",
      +    "ambiguous"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / warnings / items / properties / details / propertyNames
      Added value: +{
      +  "type": "string"
      +}
  3. Addedv2.17.2

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive and closed-world, so safety is covered structurally; the description still earns credit for disclosing the normalization pipeline, the explicit rank ordering, that zero candidates is a valid non-error result, that a bad container check digit returns valid:false rather than being dropped, and that rate-limit errors carry reset_at. That is real operational context beyond the annotations. It stops short of stating response size/pagination behaviour, and the Returns block largely restates the output schema, so it sits at solid rather than exceptional.

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

Conciseness4/5

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

It is long (~350 words) but front-loaded with the one-sentence purpose and then segmented under Behavior/Returns/Limitations/Related, so it is scannable. The ADR Table A parenthetical enumerating TU/TC/TE/TA/TT/TM and V/VC/AP/CV/S is dense and partially redundant with the sibling adr_lookup, but the overall length is defensible for a 14-grammar resolver.

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?

Covers every decision an agent needs: what to pass, what comes back, how candidates are ordered, what zero results and check-digit failures mean, rate-limit signalling, and the v1 coverage gaps (SCAC/BIC). With an output schema present it could have omitted the Returns detail, but nothing required is missing.

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 coverage is 100% and the schema description already gives ten example values, so the baseline is 3. The description earns an extra point by explaining that q is exactly ONE token (not a line) and by enumerating the fourteen grammars that will be attempted, which tells the agent what input classes are actually accepted and why ambiguity is expected.

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?

States a specific verb and resource with an explicit input/output shape: "one opaque string in, typed and cited candidates out." It clearly positions itself as the disambiguation front door relative to the individual lookup siblings (adr_lookup, airline_lookup, etc.), which are named in the Related line.

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?

"Use when you hold one identifier-ish token ... and do not know what kind of identifier it is" gives the exact selecting condition, backed by seven realistic example tokens. The Limitations section supplies the when-not case (single-token only, not free-text extraction) and lists the resolution targets by name.

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