Skip to main content
Glama
europarcel
by europarcel

Get Services

getServices

Retrieve available shipping services and carrier information, filtering by service type, carrier, or country to support logistics operations.

Instructions

Retrieves available services with carrier information. Optional filters: service_id, carrier_id, country_code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_idNoOptional service ID: 1=From home to home, 2=From home to locker, 3=From locker to home, 4=From locker to locker
carrier_idNoOptional carrier ID: 1=Cargus, 2=DPD, 3=FAN Courier, 4=GLS, 6=Sameday, 16=Bookurier
country_codeNoOptional country code - must be 'RO' (Romania)

Implementation Reference

  • The main tool registration and handler function for 'getServices'. It registers the tool with name 'getServices', defines the input schema (service_id, carrier_id, country_code), validates the API key, calls the API client, and formats the response.
    export function registerGetServicesTool(server: McpServer): void {
      // Create API client instance
    
      // Register getServices tool
      server.registerTool(
        "getServices",
        {
          title: "Get Services",
          description:
            "Retrieves available services with carrier information. Optional filters: service_id, carrier_id, country_code",
          inputSchema: {
            service_id: z
              .union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
              .optional()
              .describe(
                "Optional service ID: 1=From home to home, 2=From home to locker, 3=From locker to home, 4=From locker to locker",
              ),
            carrier_id: z
              .union([
                z.literal(1),
                z.literal(2),
                z.literal(3),
                z.literal(4),
                z.literal(6),
                z.literal(16),
              ])
              .optional()
              .describe(
                "Optional carrier ID: 1=Cargus, 2=DPD, 3=FAN Courier, 4=GLS, 6=Sameday, 16=Bookurier",
              ),
            country_code: z
              .enum(["RO"])
              .optional()
              .describe("Optional country code - must be 'RO' (Romania)"),
          },
        },
        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 {
            logger.info("Fetching services", args);
    
            const services = await client.getServices({
              service_id: args.service_id,
              carrier_id: args.carrier_id,
              country_code: args.country_code,
            });
    
            logger.info(`Retrieved ${services.length} services`);
    
            let formattedResponse = `Found ${services.length} services`;
    
            if (args.service_id || args.carrier_id || args.country_code) {
              formattedResponse += " (filtered)";
            }
            formattedResponse += ":\n\n";
    
            services.forEach((service) => {
              formattedResponse += `${service.service_name} (ID: ${service.service_id})\n`;
              formattedResponse += `  Carrier: ${service.carrier_name} (${service.carrier_id})\n`;
              formattedResponse += `  Country: ${service.country_code}\n\n`;
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to fetch services", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error fetching services: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("getServices tool registered successfully");
    }
  • Registration of the 'getServices' tool via server.registerTool() with its name and input schema definitions.
    server.registerTool(
      "getServices",
      {
        title: "Get Services",
        description:
          "Retrieves available services with carrier information. Optional filters: service_id, carrier_id, country_code",
        inputSchema: {
          service_id: z
            .union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
            .optional()
            .describe(
              "Optional service ID: 1=From home to home, 2=From home to locker, 3=From locker to home, 4=From locker to locker",
            ),
          carrier_id: z
            .union([
              z.literal(1),
              z.literal(2),
              z.literal(3),
              z.literal(4),
              z.literal(6),
              z.literal(16),
            ])
            .optional()
            .describe(
              "Optional carrier ID: 1=Cargus, 2=DPD, 3=FAN Courier, 4=GLS, 6=Sameday, 16=Bookurier",
            ),
          country_code: z
            .enum(["RO"])
            .optional()
            .describe("Optional country code - must be 'RO' (Romania)"),
        },
      },
  • Input schema for getServices tool: optional service_id (1-4), carrier_id (1,2,3,4,6,16), and country_code (RO).
    {
      title: "Get Services",
      description:
        "Retrieves available services with carrier information. Optional filters: service_id, carrier_id, country_code",
      inputSchema: {
        service_id: z
          .union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
          .optional()
          .describe(
            "Optional service ID: 1=From home to home, 2=From home to locker, 3=From locker to home, 4=From locker to locker",
          ),
        carrier_id: z
          .union([
            z.literal(1),
            z.literal(2),
            z.literal(3),
            z.literal(4),
            z.literal(6),
            z.literal(16),
          ])
          .optional()
          .describe(
            "Optional carrier ID: 1=Cargus, 2=DPD, 3=FAN Courier, 4=GLS, 6=Sameday, 16=Bookurier",
          ),
        country_code: z
          .enum(["RO"])
          .optional()
          .describe("Optional country code - must be 'RO' (Romania)"),
      },
  • EuroparcelApiClient.getServices() method that makes the HTTP GET request to /locations/services with optional query parameters.
    async getServices(params?: {
      service_id?: number;
      carrier_id?: string;
      country_code?: string;
    }): Promise<Service[]> {
      const response = await this.client.get<Service[]>("/locations/services", {
        params,
      });
      return response.data;
    }
  • Service interface type definition with fields: service_id, service_name, carrier_id, carrier_name, country_code.
    export interface Service {
      service_id: number;
      service_name: string;
      carrier_id: string;
      carrier_name: string;
      country_code: string;
    }
Behavior3/5

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

No annotations provided; description clearly states a read-only retrieval, but lacks detail on data freshness, authorization needs, or other behavioral traits.

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?

Single sentence, front-loaded with verb, no extraneous 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 simple query tool with 3 optional enum parameters and no output schema, the description is adequate, though it could explicitly state that omitting all filters retrieves all services.

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 already covers all 3 parameters with enum descriptions (100% coverage). Description adds 'Optional filters' but no extra semantics beyond 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?

Clear verb 'Retrieves' with specific resource 'available services with carrier information'. Distinguishes from sibling tools like getCarriers and getOrders.

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?

Describes optional filters but provides no explicit guidance on when to use vs alternatives, nor any exclusions or prerequisites.

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