city_context
Retrieve a city together with its full country and region details in one call. Supports multilingual names for city, country, and region.
Instructions
Get a city together with its full country and region details in one call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | City UUID | |
| preferredLanguages | No | Comma-separated BCP 47 language tags |
Implementation Reference
- src/server.ts:230-246 (registration)Registration of the 'city_context' tool via server.tool() with its schema and handler.
server.tool( 'city_context', 'Get a city together with its full country and region details in one call.', { id: z.string().describe('City UUID'), preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'), }, async ({ id }) => { const city = await client.cities.get(id); const [country, region] = await Promise.all([ client.countries.get(city.countryId), city.regionId ? client.regions.get(city.regionId) : Promise.resolve(null), ]); const result = { city, country, region }; return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, ); - src/server.ts:233-236 (schema)Input schema for the 'city_context' tool: expects a required 'id' (City UUID string) and an optional 'preferredLanguages' string.
{ id: z.string().describe('City UUID'), preferredLanguages: z.string().optional().describe('Comma-separated BCP 47 language tags'), }, - src/server.ts:237-246 (handler)Handler function for 'city_context': fetches the city by UUID, then concurrently fetches the country and (optionally) region, returning all combined.
async ({ id }) => { const city = await client.cities.get(id); const [country, region] = await Promise.all([ client.countries.get(city.countryId), city.regionId ? client.regions.get(city.regionId) : Promise.resolve(null), ]); const result = { city, country, region }; return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, );