Skip to main content
Glama
europarcel
by europarcel

Get All Billing Addresses

getBillingAddresses

Retrieve all billing addresses for the authenticated customer, including business details, VAT information, and bank details.

Instructions

Retrieves all billing addresses for the authenticated customer. Returns complete list with business details, VAT info, and bank details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function registerGetBillingAddressesTool that registers the 'getBillingAddresses' tool with the MCP server. It retrieves the API key, creates a client, calls client.getBillingAddresses(), formats and returns the results.
    export function registerGetBillingAddressesTool(server: McpServer): void {
      // Register getBillingAddresses tool
      server.registerTool(
        "getBillingAddresses",
        {
          title: "Get All Billing Addresses",
          description:
            "Retrieves all billing addresses for the authenticated customer. Returns complete list with business details, VAT info, and bank details.",
          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 billing addresses");
    
            const response = await client.getBillingAddresses({
              all: true,
            });
    
            logger.info(`Retrieved ${response.list.length} billing addresses`);
    
            let formattedResponse = `Found ${response.meta.total} billing address${response.meta.total !== 1 ? "es" : ""}:\n\n`;
    
            if (response.list.length === 0) {
              formattedResponse += "No billing addresses found.";
            } else {
              response.list.forEach((address: BillingAddress) => {
                formattedResponse += formatAddress(address, "Billing") + "\n";
              });
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to fetch billing addresses", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error fetching billing addresses: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("getBillingAddresses tool registered successfully");
    }
  • BillingAddress interface extending Address with business-specific fields (company, vat_no, reg_com, vat_payer, cnp, bank_iban, bank).
    export interface BillingAddress extends Address {
      company?: string | null;
      vat_no?: string | null;
      reg_com?: string | null;
      vat_payer?: string | null;
      cnp?: string | null;
      bank_iban?: string | null;
      bank?: string | null;
    }
  • Registration file that imports and calls registerGetBillingAddressesTool(server) as part of registerAddressTools.
    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 billing address data (including business details and bank info) into a human-readable string.
    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 === "Billing" && address.address_type === "business") {
        details += `
    - Company: ${address.company || "N/A"}
    - VAT No: ${address.vat_no || "N/A"}
    - Reg Com: ${address.reg_com || "N/A"}
    - VAT Payer: ${address.vat_payer || "N/A"}`;
      }
    
      if (type === "Billing" && address.bank_iban) {
        details += `
    - Bank IBAN: ${address.bank_iban}
    - Bank: ${address.bank || "N/A"}`;
      }
    
      details += `
    - Default: ${address.is_default ? "Yes" : "No"}
    `;
    
      return details;
    }
  • API client method getBillingAddresses that calls GET /addresses/billing with optional pagination params and returns a PaginatedAddressResponse.
    async getBillingAddresses(params?: {
      page?: number;
      per_page?: 15 | 50 | 100 | 200;
      all?: boolean;
    }): Promise<PaginatedAddressResponse<BillingAddress>> {
      const response = await this.client.get<
        PaginatedAddressResponse<BillingAddress>
      >("/addresses/billing", {
        params,
      });
      return response.data;
    }
Behavior3/5

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

With no annotations, the description carries full burden. It implies authentication via 'authenticated customer' but omits details on rate limits, pagination, error handling, or behavior when no addresses exist. The statement about returning a list is accurate but lacks depth.

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?

Two sentences, no redundancy, directly conveys purpose and content. Front-loaded with core action and scope.

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?

Given no output schema and no annotations, the description sufficiently covers the tool's function. It specifies the return includes business details, VAT, and bank info. Could mention ordering or limits, but adequate for a simple list retrieval.

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?

Input schema has 0 parameters, so baseline is 4. The description does not add parameter info because none exist, but the schema coverage is 100% trivially.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves all billing addresses for the authenticated customer and lists included details (business, VAT, bank). It distinguishes from siblings like getDeliveryAddresses and getShippingAddresses by focusing on billing addresses, but does not explicitly differentiate from similar address retrieval tools.

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 getDeliveryAddresses or getShippingAddresses. It does not mention prerequisites, when not to use, or context for usage.

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