getFutureWeatherByAirport
Retrieve 3-day weather forecasts for any airport using its IATA 3-letter code. Plan travel and operations with accurate weather predictions for today, tomorrow, and the following day.
Instructions
Get airport future weather for 3days (today、tomorrow、the day after tomorrow) by airport IATA 3-letter code. Airport codes should be IATA 3-letter codes (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| airport | Yes | Airport IATA 3-letter code (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"airport": {
"description": "Airport IATA 3-letter code (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)",
"pattern": "^[A-Z]{3}$",
"type": "string"
}
},
"required": [
"airport"
],
"type": "object"
}
Implementation Reference
- dist/index.js:215-234 (handler)Inline tool handler function that invokes flightService.getAirportWeather(airport), formats the response as MCP content, and handles errors.}, async ({ airport }) => { try { const weather = await flightService.getAirportWeather(airport); return { content: [ { type: "text", text: JSON.stringify(weather, null, 2) } ] }; } catch (error) { console.error('Error getting airport weather:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
- dist/index.js:212-214 (schema)Zod input schema validating the 'airport' parameter as a 3-letter uppercase IATA code.airport: z.string() .regex(/^[A-Z]{3}$/) .describe("Airport IATA 3-letter code (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)")
- dist/index.js:211-234 (registration)Full server.tool registration including name, description, input schema, and inline handler.server.tool('getFutureWeatherByAirport', 'Get airport future weather for 3days (today、tomorrow、the day after tomorrow) by airport IATA 3-letter code. Airport codes should be IATA 3-letter codes (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei).', { airport: z.string() .regex(/^[A-Z]{3}$/) .describe("Airport IATA 3-letter code (e.g. PEK for Beijing, SHA for Shanghai, CAN for Guangzhou, HFE for Hefei)") }, async ({ airport }) => { try { const weather = await flightService.getAirportWeather(airport); return { content: [ { type: "text", text: JSON.stringify(weather, null, 2) } ] }; } catch (error) { console.error('Error getting airport weather:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } });
- dist/services/openalService.js:55-60 (helper)OpenAlService method implementing the core API call to retrieve future weather data for the airport using the 'futureAirportWeather' endpoint.async getAirportWeather(airport) { return this.makeRequest('futureAirportWeather', { "code": airport, "type": "1" }); }