get_available_city_ids
Retrieve a list of city IDs for Japanese cities to access weather forecast data from the Japanese Weather MCP Server.
Instructions
Get a list of available city IDs for Japanese cities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:98-110 (handler)The main handler function for the 'get_available_city_ids' tool. It iterates over CITY_IDS and formats a string listing all available city IDs.execute: async () => { let result = "šļø Available Japanese City IDs:\n\n"; Object.entries(CITY_IDS).forEach(([name, id]) => { result += `${name}: ${id}\n`; }); result += "\nš” You can use these IDs with the get_weather_forecast tool."; result += "\nš For more city IDs, visit: https://weather.tsukumijima.net/primary_area.xml"; return result; },
- src/server.ts:91-113 (registration)Registration of the 'get_available_city_ids' tool using FastMCP's server.addTool method, including name, description, annotations, parameters schema, and inline handler.server.addTool({ annotations: { openWorldHint: false, // This tool doesn't interact with external systems readOnlyHint: true, // This tool doesn't modify anything title: "Get Available City IDs", }, description: "Get a list of available city IDs for Japanese cities", execute: async () => { let result = "šļø Available Japanese City IDs:\n\n"; Object.entries(CITY_IDS).forEach(([name, id]) => { result += `${name}: ${id}\n`; }); result += "\nš” You can use these IDs with the get_weather_forecast tool."; result += "\nš For more city IDs, visit: https://weather.tsukumijima.net/primary_area.xml"; return result; }, name: "get_available_city_ids", parameters: z.object({}), });
- src/server.ts:112-112 (schema)Input schema for the tool, defined as an empty object using Zod (no parameters required).parameters: z.object({}),
- src/weather-api.ts:135-156 (helper)Constant object CITY_IDS containing predefined city names and their corresponding IDs, used by the tool handler to generate the list of available cities.export const CITY_IDS = { // Fukuoka FUKUOKA: "400010", // Hiroshima HIROSHIMA: "340010", // Kawasaki KAWASAKI: "140020", // Kobe KOBE: "280010", // Kyoto KYOTO: "260010", // Nagoya NAGOYA: "230010", // Osaka OSAKA: "270000", // Sapporo SAPPORO: "016010", // Tokyo TOKYO: "130010", // Yokohama YOKOHAMA: "140010", } as const;