Skip to main content
Glama
europarcel
by europarcel

Generate Secure Label Download Link

generateLabelLink

Generate a secure, shareable download link for a shipping label by providing the AWB number. The link hides the AWB for safe sharing.

Instructions

Generate a secure download link for a shipping label by AWB number. This calls GET /orders/label-link/{awb}. Parameter: awb (required - the AWB number as string or number). Returns a permanent secure URL that can be shared without exposing the AWB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
awbYesThe AWB number to generate a label link for

Implementation Reference

  • The main handler function that registers the generateLabelLink tool. It validates the awb parameter, calls the API client, and returns a formatted response with the secure download link.
    export function registerGenerateLabelLinkTool(server: McpServer): void {
      // Create API client instance
    
      // Register generateLabelLink tool
      server.registerTool(
        "generateLabelLink",
        {
          title: "Generate Secure Label Download Link",
          description:
            "Generate a secure download link for a shipping label by AWB number. This calls GET /orders/label-link/{awb}. Parameter: awb (required - the AWB number as string or number). Returns a permanent secure URL that can be shared without exposing the AWB.",
          inputSchema: {
            awb: z
              .union([z.string(), z.number()])
              .describe("The AWB number to generate a label link for"),
          },
        },
        async (args: any) => {
          // Get API key from async context
          const apiKey = apiKeyStorage.getStore();
    
          if (!apiKey) {
            return {
              content: [
                {
                  type: "text",
                  text: "Error: X-API-KEY header is required",
                },
              ],
            };
          }
    
          // Create API client with customer's API key
          const client = new EuroparcelApiClient(apiKey);
    
          try {
            if (!args.awb) {
              return {
                content: [
                  {
                    type: "text",
                    text: "Error: awb parameter is required",
                  },
                ],
              };
            }
    
            const awb = String(args.awb).trim();
            if (!awb) {
              return {
                content: [
                  {
                    type: "text",
                    text: "Error: awb must be a non-empty string or number",
                  },
                ],
              };
            }
    
            logger.info("Generating secure label link", { awb });
    
            const response = await client.generateLabelLink(awb);
    
            logger.info("Generated secure label link successfully");
    
            let formattedResponse = `🔗 Secure Label Download Link Generated\n\n`;
            formattedResponse += `📦 AWB: ${response.awb}\n`;
            formattedResponse += `📄 Format: ${response.format}\n`;
            formattedResponse += `🔒 Secure Download URL:\n${response.download_url}\n\n`;
            formattedResponse += `✅ This link is permanent and secure - it doesn't expose the AWB number.\n`;
            formattedResponse += `📋 Anyone with this link can download the shipping label PDF.\n`;
            formattedResponse += `🎯 Use this URL to share labels safely or integrate with other systems.`;
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to generate label link", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error generating label link: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("generateLabelLink tool registered successfully");
    }
  • Input schema for the generateLabelLink tool definition, specifying the 'awb' parameter as a union of string and number types.
    {
      title: "Generate Secure Label Download Link",
      description:
        "Generate a secure download link for a shipping label by AWB number. This calls GET /orders/label-link/{awb}. Parameter: awb (required - the AWB number as string or number). Returns a permanent secure URL that can be shared without exposing the AWB.",
      inputSchema: {
        awb: z
          .union([z.string(), z.number()])
          .describe("The AWB number to generate a label link for"),
      },
  • TypeScript interface for the label link API response with fields: download_url, awb, and format.
    export interface LabelLinkResponse {
      download_url: string;
      awb: string;
      format: string;
    }
  • API client method that makes the HTTP GET request to /orders/label-link/{awb} endpoint.
    /**
     * Generate secure download link for a single order label by AWB
     */
    async generateLabelLink(awb: string): Promise<LabelLinkResponse> {
      const response = await this.client.get<LabelLinkResponse>(
        `/orders/label-link/${awb}`,
      );
      return response.data;
    }
  • Registration of the generateLabelLink tool in the order tools index module.
    registerGenerateLabelLinkTool(server);
Behavior3/5

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

With no annotations provided, the description carries the full burden. It mentions the tool is secure and returns a permanent URL, but does not disclose rate limits, authentication needs, or potential side effects.

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 concise with two sentences. The first sentence states the primary purpose, and the second provides endpoint and parameter details. No redundant information.

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 tool with one parameter and no output schema, the description adequately covers the return value and behavior. It could mention error conditions or prerequisites, but overall is sufficient.

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?

The input schema has 100% coverage with a clear description for the 'awb' parameter. The description adds minimal value beyond stating it can be a string or number, which is already in the schema.

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 generates a secure download link for a shipping label by AWB number, specifying the HTTP method and endpoint. It distinguishes itself from sibling tools like cancelOrder or getOrders, which have different purposes.

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

Usage Guidelines3/5

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

The description does not provide explicit guidance on when to use this tool versus alternatives. It implies usage for generating a label link given an AWB, but lacks context on prerequisites or exclusions.

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/europarcel/mcp-docker'

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