cities_distance
Calculate the distance in kilometers between two cities given their unique identifiers.
Instructions
Calculate the distance in kilometres between two cities.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city1 | Yes | First city UUID | |
| city2 | Yes | Second city UUID |
Implementation Reference
- src/server.ts:99-110 (handler)Handler for the 'cities_distance' tool. Accepts two city UUIDs (city1, city2), calls client.cities.distance(city1, city2) to compute the distance in km, and returns the raw result as JSON text.
server.tool( 'cities_distance', 'Calculate the distance in kilometres between two cities.', { city1: z.string().describe('First city UUID'), city2: z.string().describe('Second city UUID'), }, async ({ city1, city2 }) => { const result = await client.cities.distance(city1, city2); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, ); - src/server.ts:102-105 (schema)Input schema for cities_distance: two required string parameters (city1 and city2), each representing a city UUID.
{ city1: z.string().describe('First city UUID'), city2: z.string().describe('Second city UUID'), }, - src/server.ts:99-110 (registration)Registration of the tool named 'cities_distance' on the McpServer instance, within the createServer function.
server.tool( 'cities_distance', 'Calculate the distance in kilometres between two cities.', { city1: z.string().describe('First city UUID'), city2: z.string().describe('Second city UUID'), }, async ({ city1, city2 }) => { const result = await client.cities.distance(city1, city2); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, );