Skip to main content
Glama
iamfiro

Parcel Tracking MCP Server

by iamfiro

search-carrier

Find parcel carriers by name using fuzzy search to handle typos and spelling variations. This tool helps identify shipping providers for tracking packages across multiple services.

Instructions

Search carriers by name keyword (supports fuzzy typos)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesKeyword to search carrier names, case-insensitive (typos allowed)
limitNoMax number of results to return (default 10)

Implementation Reference

  • Executes the search-carrier tool: performs exact substring search on carrier names (EN/CN/HK), falls back to fuzzy Fuse.js search if no matches, limits results, returns JSON array of {id, name}.
    ({ query, limit = 10 }) => { const keyword = query.toLowerCase(); let exactMatches = carrierRows.filter( (row) => row.name_en.toLowerCase().includes(keyword) || row.name_cn.toLowerCase().includes(keyword) || row.name_hk.toLowerCase().includes(keyword) ); if (exactMatches.length === 0) { exactMatches = fuse.search(keyword).map((m) => m.item as CarrierRow); } const results = exactMatches.slice(0, limit).map((row) => ({ id: Number(row.key), name: row.name_en })); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), } as const, ], }; }
  • Zod input schema defining 'query' (string) and optional 'limit' (number) parameters for the search-carrier tool.
    { query: z.string().describe("Keyword to search carrier names, case-insensitive (typos allowed)"), limit: z.number().optional().describe("Max number of results to return (default 10)"), },
  • src/index.ts:135-166 (registration)
    Registers the 'search-carrier' tool with McpServer using server.tool(name, description, inputSchema, handlerFunction).
    server.tool( "search-carrier", "Search carriers by name keyword (supports fuzzy typos)", { query: z.string().describe("Keyword to search carrier names, case-insensitive (typos allowed)"), limit: z.number().optional().describe("Max number of results to return (default 10)"), }, ({ query, limit = 10 }) => { const keyword = query.toLowerCase(); let exactMatches = carrierRows.filter( (row) => row.name_en.toLowerCase().includes(keyword) || row.name_cn.toLowerCase().includes(keyword) || row.name_hk.toLowerCase().includes(keyword) ); if (exactMatches.length === 0) { exactMatches = fuse.search(keyword).map((m) => m.item as CarrierRow); } const results = exactMatches.slice(0, limit).map((row) => ({ id: Number(row.key), name: row.name_en })); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), } as const, ], }; } );
  • Initializes Fuse.js fuzzy search index on carrierRows, used by search-carrier handler for fallback fuzzy matching.
    const fuse = new Fuse(carrierRows, { keys: ["name_en", "name_cn", "name_hk"], threshold: 0.4, includeScore: true, });
  • Parses carriers.csv into carrierRows array, providing the data source for exact and fuzzy searches in search-carrier.
    const carrierRows: CarrierRow[] = parseCsv(fs.readFileSync(carriersCsvPath), { bom: true, columns: true, skip_empty_lines: true, trim: true, relax_quotes: true, });

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamfiro/parcel-tracking-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server