Skip to main content
Glama

track_shipment

Retrieve the current status and complete tracking history of an APC Overnight parcel using its waybill number.

Instructions

Get the current status and tracking history for an APC Overnight consignment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
waybillYesThe 22-digit WayBill number

Implementation Reference

  • The core handler function `trackConsignment` that calls APC API endpoint /Tracks/{waybill}.json with searchtype=CarrierWaybill&history=yes and returns status, events, and raw tracking data.
    export async function trackConsignment(waybill) {
      const path = `/Tracks/${waybill}.json?searchtype=CarrierWaybill&history=yes`;
      const result = await request('GET', path);
    
      const tracks = result?.Tracks;
      const track  = Array.isArray(tracks?.Track) ? tracks.Track[0] : tracks?.Track;
    
      return {
        success: true,
        waybill,
        status: track?.Status || track?.Description || 'Unknown',
        events: Array.isArray(tracks?.Track) ? tracks.Track : (track ? [track] : []),
        raw: result,
      };
    }
  • Input schema: requires a single 'waybill' parameter (22-digit string).
    {
      waybill: z.string().describe('The 22-digit WayBill number'),
    },
  • src/index.js:264-291 (registration)
    Tool registration via server.tool('track_shipment', ...) with description and handler that calls apc.trackConsignment.
    server.tool(
      'track_shipment',
      'Get the current status and tracking history for an APC Overnight consignment.',
      {
        waybill: z.string().describe('The 22-digit WayBill number'),
      },
      async ({ waybill }) => {
        try {
          const result = await apc.trackConsignment(waybill);
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                success: result.success,
                waybill,
                status: result.status,
                events: result.events,
              }, null, 2),
            }],
          };
        } catch (err) {
          return {
            content: [{ type: 'text', text: `Error tracking shipment: ${err.message}` }],
            isError: true,
          };
        }
      }
    );
  • The `request` helper function used by trackConsignment to make authenticated HTTP requests to the APC API.
    async function request(method, path, body = null) {
      const url = `${BASE_URL}${path}`;
    
      const options = {
        method,
        headers: {
          'remote-user':  getAuthHeader(),
          'Content-Type': 'application/json',
          'Accept':       'application/json',
        },
      };
    
      if (body) {
        options.body = JSON.stringify(body);
      }
    
      const response = await fetch(url, options);
    
      if (!response.ok) {
        const error = await response.text();
        throw new Error(`APC API ${response.status}: ${error}`);
      }
    
      return response.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 does not disclose authentication needs, rate limits, or what happens with invalid waybills. Only states it returns status and history.

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, concise sentence with no filler. It is front-loaded with the action and entity, making it quickly understandable.

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

Completeness4/5

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

For a simple lookup tool with one parameter and no output schema, the description is sufficient. It conveys the purpose and what it returns (status and tracking history). Could be enhanced by mentioning the output format, but not essential.

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 coverage is 100% and the schema already describes the 'waybill' parameter as 'The 22-digit WayBill number'. The description adds no additional meaning beyond what the schema provides, so baseline 3 applies.

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 tool gets current status and tracking history for an APC Overnight consignment. It uses a specific verb and resource, and distinguishes from sibling tools (booking, canceling, labeling).

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, when not to use it, or context signals. The description simply states what it does.

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/catrinmdonnelly/apc-mcp'

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