Skip to main content
Glama

compare_cities

Retrieve detailed information and distance for two cities using their unique identifiers.

Instructions

Fetch full details for two cities and the distance between them in one call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
city1YesFirst city UUID
city2YesSecond city UUID
preferredLanguagesNoComma-separated BCP 47 language tags

Implementation Reference

  • src/server.ts:281-298 (registration)
    The 'compare_cities' tool is registered on the MCP server via `server.tool()`, defining its name, description, Zod schema for inputs (city1 UUID, city2 UUID, optional preferredLanguages), and the async handler that fetches both city details and distance between them.
    server.tool(
      'compare_cities',
      'Fetch full details for two cities and the distance between them in one call.',
      {
        city1: z.string().describe('First city UUID'),
        city2: z.string().describe('Second city UUID'),
        preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'),
      },
      async ({ city1, city2 }) => {
        const [cityA, cityB, dist] = await Promise.all([
          client.cities.get(city1),
          client.cities.get(city2),
          client.cities.distance(city1, city2),
        ]);
        const result = { city1: cityA, city2: cityB, distanceKm: dist.distanceKm };
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      },
    );
  • The async handler function that executes the tool logic: it calls `client.cities.get()` for both cities and `client.cities.distance()` concurrently via Promise.all, then returns the combined result with city details and distance in km.
    async ({ city1, city2 }) => {
      const [cityA, cityB, dist] = await Promise.all([
        client.cities.get(city1),
        client.cities.get(city2),
        client.cities.distance(city1, city2),
      ]);
      const result = { city1: cityA, city2: cityB, distanceKm: dist.distanceKm };
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    },
  • Zod schema defining the tool's input parameters: city1 (string UUID), city2 (string UUID), and optional preferredLanguages (comma-separated BCP 47 tags).
    {
      city1: z.string().describe('First city UUID'),
      city2: z.string().describe('Second city UUID'),
      preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'),
    },
Behavior2/5

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

No annotations provided, so description carries burden. It mentions 'full details' but does not specify what fields are returned, nor any behavioral traits like authentication or rate limits. Vague on output, leaving agent uncertain.

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 concise sentence, front-loaded with action and result. Every word carries meaning with no waste.

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 complexity (combining two cities and distance) and no output schema, the description is minimal. Does not explain what 'full details' includes, leaving gap in completeness for agent to understand response.

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 coverage is 100% with descriptions for each parameter. Description adds no extra meaning beyond what the schema already provides. Baseline score of 3 appropriate.

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 fetches full details for two cities and the distance between them in one call, specifying the verb, resource, and benefit. This distinguishes it from sibling tools like 'get_city' (single city) and 'cities_distance' (distance only).

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 when needing both city details and distance, but lacks explicit guidance on when to use alternatives (e.g., 'cities_distance' for distance only). No 'when-not' or 'alternatives' mentioned.

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