Skip to main content
Glama
iamfiro

Parcel Tracking MCP Server

by iamfiro

tracking-delivery

Track parcel delivery status using a tracking number, with automatic or manual carrier detection via 17TRACK.

Instructions

Track a parcel delivery via 17TRACK

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYesThe tracking number of the parcel
carrierNoCarrier ID (number). If omitted, 17TRACK will auto-detect, but accuracy may be lower.

Implementation Reference

  • The main execution logic for the 'tracking-delivery' tool: validates carrier ID, prompts for carrier if missing, registers the tracking number, fetches status from 17TRACK API, and returns formatted JSON response or error.
    async ({ number, carrier }) => {
      if (carrier && !validateCarrierId(carrier)) {
        return {
          content: [
            {
              type: "text",
              text: `The carrier ID "${carrier}" is not valid. Please use the 'search-carrier' tool to find the correct carrier ID.`,
            } as const,
          ],
        };
      }
    
      if (!carrier) {
        return {
          content: [
            {
              type: "text",
              text:
                "Please specify the carrier ID along with the tracking number for more accurate results. You can use the 'search-carrier' tool to look up the carrier ID first.",
            } as const,
          ],
        };
      }
    
      try {
        await register({ number, carrier });
        const data = await getDelivery({ number, carrier });
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(data, null, 2),
            } as const,
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: "Error tracking delivery: " + (error instanceof Error ? error.message : String(error)),
            } as const,
          ],
        };
      }
    }
  • Input schema for 'tracking-delivery' tool using Zod: requires tracking 'number' string, optional 'carrier' number ID.
      number: z.string().describe("The tracking number of the parcel"),
      carrier: z
        .number()
        .optional()
        .describe(
          "Carrier ID (number). If omitted, 17TRACK will auto-detect, but accuracy may be lower."
        ),
    },
  • src/index.ts:168-226 (registration)
    MCP tool registration call: server.tool(name, description, inputSchema, handlerFunction). Note: full block includes schema and handler.
    server.tool(
      "tracking-delivery",
      "Track a parcel delivery via 17TRACK",
      {
        number: z.string().describe("The tracking number of the parcel"),
        carrier: z
          .number()
          .optional()
          .describe(
            "Carrier ID (number). If omitted, 17TRACK will auto-detect, but accuracy may be lower."
          ),
      },
      async ({ number, carrier }) => {
        if (carrier && !validateCarrierId(carrier)) {
          return {
            content: [
              {
                type: "text",
                text: `The carrier ID "${carrier}" is not valid. Please use the 'search-carrier' tool to find the correct carrier ID.`,
              } as const,
            ],
          };
        }
    
        if (!carrier) {
          return {
            content: [
              {
                type: "text",
                text:
                  "Please specify the carrier ID along with the tracking number for more accurate results. You can use the 'search-carrier' tool to look up the carrier ID first.",
              } as const,
            ],
          };
        }
    
        try {
          await register({ number, carrier });
          const data = await getDelivery({ number, carrier });
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(data, null, 2),
              } as const,
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: "Error tracking delivery: " + (error instanceof Error ? error.message : String(error)),
              } as const,
            ],
          };
        }
      }
    );
  • Helper function to register a tracking number with the 17TRACK API prior to querying status.
    async function register({ number, carrier }: Props) {
      const body = [
        {
          number,
          carrier: carrier ?? 0,
        },
      ];
    
      const res = await fetch(`${TRACKER_API_BASE_URL}/register`, {
        method: "POST",
        headers: {
          "17token": apiToken,
          "Content-Type": "application/json",
          "User-Agent": USER_AGENT,
        },
        body: JSON.stringify(body),
      });
    
      return res.json();
    }
  • Helper function to retrieve parcel tracking information from the 17TRACK API.
    async function getDelivery({ number, carrier }: Props) {
      const body = [
        {
          number,
          carrier: carrier ?? 0,
        },
      ];
    
      const res = await fetch(`${TRACKER_API_BASE_URL}/gettrackinfo`, {
        method: "POST",
        headers: {
          "17token": apiToken,
          "Content-Type": "application/json",
          "User-Agent": USER_AGENT,
        },
        body: JSON.stringify(body),
      });
    
      return res.json();
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool's function but does not disclose behavioral traits such as authentication requirements, rate limits, error handling, or what the output might look like (e.g., tracking status details). This leaves significant gaps for an agent to understand how to invoke it effectively.

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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and every part earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (tracking with potential carrier detection) and lack of annotations and output schema, the description is incomplete. It does not cover behavioral aspects, output format, or error cases, which are crucial for an agent to use the tool correctly in real-world scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description does not add any meaning beyond what the schema provides (e.g., it doesn't explain parameter interactions or provide examples). Baseline 3 is appropriate as the schema does the heavy lifting.

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?

The description clearly states the specific action ('track') and resource ('parcel delivery') with the service provider ('via 17TRACK'), making the purpose explicit. It distinguishes from the sibling tool 'search-carrier' by focusing on tracking rather than carrier lookup.

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 implies usage context (tracking parcels with 17TRACK) but does not explicitly state when to use this tool versus alternatives like the sibling 'search-carrier'. It provides clear functional intent but lacks explicit comparison or exclusion guidance.

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

Install Server

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