Skip to main content
Glama
europarcel
by europarcel

Get Countries

getCountries

Retrieve country data including currency and language details for international shipping operations.

Instructions

Retrieves all available countries with their currency and language information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the getCountries MCP tool. Handles API key retrieval, client creation, API call to fetch countries, formatting the response as text listing countries with codes, currencies, and languages, and error handling.
    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 countries");
    
        const countries = await client.getCountries();
    
        logger.info(`Retrieved ${countries.length} countries`);
    
        let formattedResponse = `Found ${countries.length} countries:\n\n`;
    
        countries.forEach((country) => {
          formattedResponse += `${country.name} (${country.country_code})\n`;
          formattedResponse += `  Currency: ${country.currency}\n`;
          formattedResponse += `  Language: ${country.language}\n\n`;
        });
    
        return {
          content: [
            {
              type: "text",
              text: formattedResponse,
            },
          ],
        };
      } catch (error: any) {
        logger.error("Failed to fetch countries", error);
    
        return {
          content: [
            {
              type: "text",
              text: `Error fetching countries: ${error.message || "Unknown error"}`,
            },
          ],
        };
      }
    },
  • Tool schema definition including title, description, and empty inputSchema (no parameters required).
    {
      title: "Get Countries",
      description:
        "Retrieves all available countries with their currency and language information",
      inputSchema: {},
    },
  • The registerGetCountriesTool function that registers the getCountries tool on the McpServer, including schema and handler.
    export function registerGetCountriesTool(server: McpServer): void {
      // Create API client instance
    
      // Register getCountries tool
      server.registerTool(
        "getCountries",
        {
          title: "Get Countries",
          description:
            "Retrieves all available countries with their currency and language information",
          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 countries");
    
            const countries = await client.getCountries();
    
            logger.info(`Retrieved ${countries.length} countries`);
    
            let formattedResponse = `Found ${countries.length} countries:\n\n`;
    
            countries.forEach((country) => {
              formattedResponse += `${country.name} (${country.country_code})\n`;
              formattedResponse += `  Currency: ${country.currency}\n`;
              formattedResponse += `  Language: ${country.language}\n\n`;
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to fetch countries", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error fetching countries: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("getCountries tool registered successfully");
    }
  • Invocation of registerGetCountriesTool within registerLocationTools to register the tool.
    registerGetCountriesTool(server);
  • EuroparcelApiClient.getCountries method: makes HTTP GET to /locations/countries API endpoint to retrieve the list of countries.
    async getCountries(): Promise<Country[]> {
      const response = await this.client.get<Country[]>("/locations/countries");
      return response.data;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Retrieves' suggests a read operation, it doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what happens on errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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, efficient sentence that immediately communicates the core functionality without any wasted words. It's appropriately sized for a simple retrieval tool and front-loads the essential information about what data is returned.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema), the description adequately covers the basic purpose. However, without annotations or output schema, it doesn't address behavioral aspects like authentication requirements, response format, or error handling. For a retrieval tool in a server with many siblings, more context about when and how to use it would be beneficial.

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?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the lack of inputs. The description appropriately doesn't mention parameters, maintaining focus on what the tool returns rather than what it accepts. This meets the baseline expectation for parameterless tools.

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 specific action ('Retrieves'), resource ('all available countries'), and scope ('with their currency and language information'), making the purpose immediately understandable. It distinguishes this tool from siblings like getCounties, getLocalities, or getFixedLocations by specifying it returns country-level data with specific attributes.

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 implies usage for obtaining country data with currency and language details, but provides no explicit guidance on when to use this tool versus alternatives like getCounties or getLocalities. There's no mention of prerequisites, exclusions, or specific scenarios where this tool is preferred.

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'

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