Skip to main content
Glama

list_countries

Search and filter countries by name prefix or telephone code, with localized names in preferred languages.

Instructions

List countries with optional filtering by name prefix or telephone code. Supports localized names via preferredLanguages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoCountry name prefix to search for (matches English name and translations in preferredLanguages)
telephoneCodeNoFilter by dialing code (e.g. "+1", "+44")
preferredLanguagesNoComma-separated BCP 47 language tags; sets localizedName and drives translation name search (e.g. "fr,es,en")
limitNoMax results
offsetNoPagination offset

Implementation Reference

  • src/server.ts:114-131 (registration)
    Registration of the 'list_countries' MCP tool with the McpServer, including its schema definition and handler logic.
    server.tool(
      'list_countries',
      'List countries with optional filtering by name prefix or telephone code. Supports localized names via preferredLanguages.',
      {
        name: z.string().optional().describe('Country name prefix to search for (matches English name and translations in preferredLanguages)'),
        telephoneCode: z.string().optional().describe('Filter by dialing code (e.g. "+1", "+44")'),
        preferredLanguages: z
          .string()
          .optional()
          .describe('Comma-separated BCP 47 language tags; sets localizedName and drives translation name search (e.g. "fr,es,en")'),
        limit: z.number().int().min(1).max(500).optional().describe('Max results'),
        offset: z.number().int().min(0).optional().describe('Pagination offset'),
      },
      async (params) => {
        const result = await client.countries.list(params);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      },
    );
  • Schema definition for list_countries tool parameters using Zod: name (optional string), telephoneCode (optional string), preferredLanguages (optional string), limit (optional int 1-500), offset (optional int >= 0).
    {
      name: z.string().optional().describe('Country name prefix to search for (matches English name and translations in preferredLanguages)'),
      telephoneCode: z.string().optional().describe('Filter by dialing code (e.g. "+1", "+44")'),
      preferredLanguages: z
        .string()
        .optional()
        .describe('Comma-separated BCP 47 language tags; sets localizedName and drives translation name search (e.g. "fr,es,en")'),
      limit: z.number().int().min(1).max(500).optional().describe('Max results'),
      offset: z.number().int().min(0).optional().describe('Pagination offset'),
    },
  • Handler function for the list_countries tool: delegates to client.countries.list(params) and returns the result as JSON text.
    async (params) => {
      const result = await client.countries.list(params);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    },
Behavior3/5

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

No annotations provided. The description discloses the tool's read-like behavior (listing with filters) and supports localized names, but does not explicitly confirm it's non-destructive or mention any restrictions or 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?

Two concise sentences front-load the main purpose and additional features. Every word serves a purpose with no redundancy.

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 5 optional parameters and no output schema, the description covers core functionality (filtering by name/telephone code, localization). Pagination (limit/offset) is documented in schema but not mentioned in description; overall sufficient for a list tool.

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?

Schema covers 100% of parameters. The description adds context that 'name' filtering is by prefix, 'preferredLanguages' enables localized name search, and telephone code filtering is supported, enhancing understanding 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?

The description clearly states 'List countries' with optional filtering by name prefix or telephone code, using the verb 'list' and specific resource 'countries'. This distinguishes it from sibling tools like 'get_country' (single country) and 'search_cities'.

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

Usage Guidelines4/5

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

The description indicates optional filtering and supports localized names, implying usage for broad country listings or filtered searches. However, it does not explicitly state when not to use it or mention alternatives like 'get_country' for a single country.

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/930m310n/geomelon-mcp'

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