get_tokyo_wbgt_forecast
Retrieve WBGT heat index forecasts for Tokyo locations to assess heat stroke risk and plan outdoor activities safely.
Instructions
東京都のWBGT(暑さ指数)予測値を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | No | 東京都内の観測地点(tokyo, hachioji, fuchu, nerima, ome, ogochi, edogawa) | tokyo |
Implementation Reference
- src/index.ts:122-133 (handler)The handler function that executes the tool logic for get_tokyo_wbgt_forecast. It calls the WBGTService to fetch data and returns it as JSON string in MCP content format.private async handleGetTokyoWBGTForecast(location: string): Promise<any> { const data = await this.wbgtService.getTokyoWBGTForecast(location as TokyoLocation); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:41-51 (schema)Input schema definition for the get_tokyo_wbgt_forecast tool, specifying the location parameter with enum values.inputSchema: { type: "object", properties: { location: { type: "string", description: "東京都内の観測地点(tokyo, hachioji, fuchu, nerima, ome, ogochi, edogawa)", enum: ["tokyo", "hachioji", "fuchu", "nerima", "ome", "ogochi", "edogawa"], default: "tokyo" } }, },
- src/index.ts:38-52 (registration)Registration of the get_tokyo_wbgt_forecast tool in the ListTools response, including name, description, and input schema.{ name: "get_tokyo_wbgt_forecast", description: "東京都のWBGT(暑さ指数)予測値を取得します", inputSchema: { type: "object", properties: { location: { type: "string", description: "東京都内の観測地点(tokyo, hachioji, fuchu, nerima, ome, ogochi, edogawa)", enum: ["tokyo", "hachioji", "fuchu", "nerima", "ome", "ogochi", "edogawa"], default: "tokyo" } }, }, },
- src/wbgt-service.ts:12-31 (helper)Supporting service method that implements the core logic: maps location to ID, fetches CSV from API, parses it using utility.async getTokyoWBGTForecast(location: TokyoLocation): Promise<WBGTData> { const locationId = LOCATION_ID_MAP[location]; if (!locationId) { throw new Error(`Unknown location: ${location}. Available: ${Object.keys(LOCATION_ID_MAP).join(", ")}`); } const url = `${WBGT_API_BASE_URLS.forecast}yohou_${locationId}.csv`; try { const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const csvData = await response.text(); return parseWBGTForecastCSV(csvData, location); } catch (error) { throw new Error(`Failed to fetch WBGT data: ${error instanceof Error ? error.message : String(error)}`); } }