Skip to main content
Glama
europarcel
by europarcel

Get All Delivery Addresses

getDeliveryAddresses

Retrieve all saved delivery addresses for the authenticated customer, including coordinates and postal codes.

Instructions

Retrieves all delivery addresses (destination locations) for the authenticated customer. Returns complete list with coordinates and postal codes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function 'registerGetDeliveryAddressesTool' that registers and implements the 'getDeliveryAddresses' tool. It creates an API client, calls client.getDeliveryAddresses({all:true}), formats the response, and handles errors.
    export function registerGetDeliveryAddressesTool(server: McpServer): void {
      // Create API client instance
    
      // Register getDeliveryAddresses tool
      server.registerTool(
        "getDeliveryAddresses",
        {
          title: "Get All Delivery Addresses",
          description:
            "Retrieves all delivery addresses (destination locations) for the authenticated customer. Returns complete list with coordinates and postal codes.",
          inputSchema: {},
        },
        async () => {
          // 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 {
            logger.info("Fetching all delivery addresses");
    
            const response = await client.getDeliveryAddresses({
              all: true,
            });
    
            logger.info(`Retrieved ${response.list.length} delivery addresses`);
    
            let formattedResponse = `Found ${response.meta.total} delivery address${response.meta.total !== 1 ? "es" : ""}:\n\n`;
    
            if (response.list.length === 0) {
              formattedResponse += "No delivery addresses found.";
            } else {
              response.list.forEach((address: DeliveryAddress) => {
                formattedResponse += formatAddress(address, "Delivery") + "\n";
              });
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to fetch delivery addresses", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error fetching delivery addresses: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("getDeliveryAddresses tool registered successfully");
    }
  • Registration of the tool via registerGetDeliveryAddressesTool(server) called from the address tools aggregator module.
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { registerGetBillingAddressesTool } from "./getBillingAddresses.js";
    import { registerGetShippingAddressesTool } from "./getShippingAddresses.js";
    import { registerGetDeliveryAddressesTool } from "./getDeliveryAddresses.js";
    import { logger } from "../../utils/logger.js";
    
    export function registerAddressTools(server: McpServer): void {
      logger.info("Registering address tools...");
    
      // Register all address-related tools
      registerGetBillingAddressesTool(server);
      registerGetShippingAddressesTool(server);
      registerGetDeliveryAddressesTool(server);
    
      logger.info("All address tools registered successfully");
    }
    
    // Export individual registration functions if needed
    export { registerGetBillingAddressesTool } from "./getBillingAddresses.js";
    export { registerGetShippingAddressesTool } from "./getShippingAddresses.js";
    export { registerGetDeliveryAddressesTool } from "./getDeliveryAddresses.js";
  • Helper function 'formatAddress' that formats a DeliveryAddress object into a human-readable string for display.
    function formatAddress(address: any, type: string): string {
      let details = `${type} Address #${address.id}:
    - Type: ${address.address_type}
    - Contact: ${address.contact}
    - Phone: ${address.phone}
    - Email: ${address.email}
    - Location: ${address.locality_name}, ${address.county_name} (${address.country_code})
    - Street: ${address.street_name || "N/A"} ${address.street_no}${address.street_details ? ", " + address.street_details : ""}`;
    
      if ((type === "Shipping" || type === "Delivery") && address.zipcode) {
        details += `
    - Zip Code: ${address.zipcode}`;
      }
    
      if ((type === "Shipping" || type === "Delivery") && address.coordinates) {
        details += `
    - Coordinates: ${address.coordinates.lat}, ${address.coordinates.lng}`;
      }
    
      details += `
    - Default: ${address.is_default ? "Yes" : "No"}
    `;
    
      return details;
    }
  • Type definition for DeliveryAddress interface, which extends ShippingAddress (same structure).
    export interface DeliveryAddress extends ShippingAddress {
      // Delivery addresses have the same structure as shipping addresses
    }
  • API client method 'getDeliveryAddresses' that makes the HTTP GET request to /addresses/delivery endpoint.
    async getDeliveryAddresses(params?: {
      page?: number;
      per_page?: 15 | 50 | 100 | 200;
      all?: boolean;
    }): Promise<PaginatedAddressResponse<DeliveryAddress>> {
      const response = await this.client.get<
        PaginatedAddressResponse<DeliveryAddress>
      >("/addresses/delivery", {
        params,
      });
      return response.data;
    }
Behavior3/5

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

The description implies read-only behavior ('Retrieves') and mentions 'authenticated customer' suggesting authentication, but since annotations are absent, it could be more explicit about auth requirements, rate limits, or handling of missing data. However, the tool is simple with no parameters, so the gap is modest.

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, front-loaded sentence that conveys the essential information without any wasted words.

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 zero-parameter retrieval tool, the description covers the purpose and key output fields (coordinates, postal codes). It could be expanded to mention other return fields or pagination, but it is reasonably complete given the simplicity. There is no output schema to rely on.

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?

There are zero parameters, and the schema coverage is 100% (trivially). The description adds value by mentioning the output includes coordinates and postal codes, which helps understand the return value.

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 it retrieves all delivery addresses for the authenticated customer, specifying it returns coordinates and postal codes. This distinguishes it from sibling tools like getBillingAddresses and getShippingAddresses.

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 on when to use this tool versus alternatives such as getBillingAddresses or getShippingAddresses. No when-not or context for usage is provided.

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