get_future_weather
Retrieve 3-hourly weather forecasts for dates 14 to 300 days ahead. Provide location details and a future date to access long-range weather predictions.
Instructions
Get future weather forecast for a date between 14 and 300 days from today. Returns 3-hourly data. Available on Pro+ plan and above.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Location query — city name, lat/lon, zip, postcode, IATA, or IP. | |
| dt | Yes | Future date in yyyy-MM-dd format. Must be between 14 and 300 days from today. |
Implementation Reference
- src/index.ts:303-307 (handler)The handler implementation for the "get_future_weather" tool, which calls the "/future.json" WeatherAPI endpoint.
case "get_future_weather": { const { q, dt } = args as { q: string; dt: string }; result = await weatherRequest("/future.json", { q, dt }); break; } - src/index.ts:133-151 (schema)The tool registration and input schema definition for "get_future_weather".
name: "get_future_weather", description: "Get future weather forecast for a date between 14 and 300 days from today. Returns 3-hourly data. Available on Pro+ plan and above.", inputSchema: { type: "object", properties: { q: { type: "string", description: "Location query — city name, lat/lon, zip, postcode, IATA, or IP.", }, dt: { type: "string", description: "Future date in yyyy-MM-dd format. Must be between 14 and 300 days from today.", }, }, required: ["q", "dt"], }, }, - src/index.ts:22-41 (helper)Helper function used by "get_future_weather" and other tools to perform authenticated requests to the WeatherAPI.
async function weatherRequest( endpoint: string, params: Record<string, string | number> ): Promise<unknown> { const searchParams = new URLSearchParams({ key: API_KEY! }); for (const [k, v] of Object.entries(params)) { searchParams.set(k, String(v)); } const url = `${BASE_URL}${endpoint}?${searchParams.toString()}`; const res = await fetch(url); const data = await res.json(); if (!res.ok) { const err = data as { error?: { code: number; message: string } }; throw new McpError( ErrorCode.InternalError, `WeatherAPI error ${err.error?.code}: ${err.error?.message ?? res.statusText}` ); } return data; }