Skip to main content
Glama

cities_by_coordinates_closest

Find the nearest cities to any geographic coordinates, sorted by distance. Specify latitude and longitude to get a ranked list of nearby cities.

Instructions

Find cities nearest to given coordinates, ordered by distance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude
lonYesLongitude
preferredLanguagesNoComma-separated BCP 47 language tags

Implementation Reference

  • Input schema for the cities_by_coordinates_closest tool: lat (number), lon (number), and optional preferredLanguages string.
    {
      lat: z.number().describe('Latitude'),
      lon: z.number().describe('Longitude'),
      preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'),
    },
  • Handler function that calls client.cities.byCoordinatesClosest(params) and returns the JSON result.
      async (params) => {
        const result = await client.cities.byCoordinatesClosest(params);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      },
    );
  • src/server.ts:71-83 (registration)
    Registers the 'cities_by_coordinates_closest' tool via server.tool() with its description, schema, and handler.
    server.tool(
      'cities_by_coordinates_closest',
      'Find cities nearest to given coordinates, ordered by distance.',
      {
        lat: z.number().describe('Latitude'),
        lon: z.number().describe('Longitude'),
        preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'),
      },
      async (params) => {
        const result = await client.cities.byCoordinatesClosest(params);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      },
    );
  • Reuses client.cities.byCoordinatesClosest inside the 'find_cities_near_city' compound tool when mode is 'closest'.
    const nearby = mode === 'largest'
      ? await client.cities.byCoordinatesLargest(params)
      : await client.cities.byCoordinatesClosest(params);
Behavior2/5

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

Without annotations, the description bears full responsibility for behavioral disclosure. It only states the basic operation (finding and ordering) but omits crucial details like the number of results returned, distance metric used, or any limits. This leaves the agent uninformed about key behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. While very concise, it sacrifices some informative detail; however, for the given length, it is well-structured and clear.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description fails to convey important contextual information such as output format, ordering details, distance calculation, or result limits. This leaves significant gaps for an agent intending to use the tool effectively.

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?

Input schema coverage is 100%, with each parameter having a description. The tool description adds no additional meaning beyond what the schema already provides for lat, lon, and preferredLanguages. Thus, the description does not enhance parameter understanding.

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 tool finds cities nearest to given coordinates and orders them by distance. It uses a specific verb ('find') and resource ('cities'), and the scope ('nearest to given coordinates') distinguishes it from sibling tools like cities_by_coordinates_largest, which likely serves a different ordering or filtering purpose.

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 is provided on when to use this tool versus its siblings (e.g., cities_by_coordinates_largest, cities_distance). An agent would have to infer from the name alone, which is insufficient for optimal tool selection.

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