get_history
Retrieve historical weather data for past dates from 2010 onward, including daily summaries and hourly breakdowns, to analyze past conditions or verify weather events.
Instructions
Get historical weather data for a specific date from 1 January 2010 onwards. Returns daily summary and full hourly breakdown. Useful for past weather lookups, analytics, and backtesting.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Location query — city name, lat/lon, zip, postcode, IATA, or IP. | |
| dt | Yes | Date in yyyy-MM-dd format. Must be on or after 2010-01-01. | |
| end_dt | No | Optional end date for a date range (Pro+ plan only). Max 30 days range. yyyy-MM-dd. |
Implementation Reference
- src/index.ts:296-302 (handler)The handler logic for "get_history" that processes arguments and calls the WeatherAPI's history endpoint.
case "get_history": { const { q, dt, end_dt } = args as { q: string; dt: string; end_dt?: string }; const params: Record<string, string | number> = { q, dt }; if (end_dt) params.end_dt = end_dt; result = await weatherRequest("/history.json", params); break; } - src/index.ts:109-131 (schema)The tool schema registration for "get_history", defining its description, input parameters, and constraints.
name: "get_history", description: "Get historical weather data for a specific date from 1 January 2010 onwards. Returns daily summary and full hourly breakdown. Useful for past weather lookups, analytics, and backtesting.", inputSchema: { type: "object", properties: { q: { type: "string", description: "Location query — city name, lat/lon, zip, postcode, IATA, or IP.", }, dt: { type: "string", description: "Date in yyyy-MM-dd format. Must be on or after 2010-01-01.", }, end_dt: { type: "string", description: "Optional end date for a date range (Pro+ plan only). Max 30 days range. yyyy-MM-dd.", }, }, required: ["q", "dt"], }, },