@dangahagan/weather-mcp 0.1.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +295 -52
  2. package/dist/config/cache.d.ts +30 -0
  3. package/dist/config/cache.d.ts.map +1 -0
  4. package/dist/config/cache.js +105 -0
  5. package/dist/config/cache.js.map +1 -0
  6. package/dist/config/displayThresholds.d.ts +83 -0
  7. package/dist/config/displayThresholds.d.ts.map +1 -0
  8. package/dist/config/displayThresholds.js +83 -0
  9. package/dist/config/displayThresholds.js.map +1 -0
  10. package/dist/errors/ApiError.d.ts +62 -0
  11. package/dist/errors/ApiError.d.ts.map +1 -0
  12. package/dist/errors/ApiError.js +147 -0
  13. package/dist/errors/ApiError.js.map +1 -0
  14. package/dist/handlers/alertsHandler.d.ts +11 -0
  15. package/dist/handlers/alertsHandler.d.ts.map +1 -0
  16. package/dist/handlers/alertsHandler.js +79 -0
  17. package/dist/handlers/alertsHandler.js.map +1 -0
  18. package/dist/handlers/currentConditionsHandler.d.ts +11 -0
  19. package/dist/handlers/currentConditionsHandler.d.ts.map +1 -0
  20. package/dist/handlers/currentConditionsHandler.js +168 -0
  21. package/dist/handlers/currentConditionsHandler.js.map +1 -0
  22. package/dist/handlers/forecastHandler.d.ts +13 -0
  23. package/dist/handlers/forecastHandler.d.ts.map +1 -0
  24. package/dist/handlers/forecastHandler.js +226 -0
  25. package/dist/handlers/forecastHandler.js.map +1 -0
  26. package/dist/handlers/historicalWeatherHandler.d.ts +12 -0
  27. package/dist/handlers/historicalWeatherHandler.d.ts.map +1 -0
  28. package/dist/handlers/historicalWeatherHandler.js +188 -0
  29. package/dist/handlers/historicalWeatherHandler.js.map +1 -0
  30. package/dist/handlers/locationHandler.d.ts +11 -0
  31. package/dist/handlers/locationHandler.d.ts.map +1 -0
  32. package/dist/handlers/locationHandler.js +113 -0
  33. package/dist/handlers/locationHandler.js.map +1 -0
  34. package/dist/handlers/statusHandler.d.ts +12 -0
  35. package/dist/handlers/statusHandler.d.ts.map +1 -0
  36. package/dist/handlers/statusHandler.js +106 -0
  37. package/dist/handlers/statusHandler.js.map +1 -0
  38. package/dist/index.js +149 -343
  39. package/dist/index.js.map +1 -1
  40. package/dist/services/noaa.d.ts +23 -1
  41. package/dist/services/noaa.d.ts.map +1 -1
  42. package/dist/services/noaa.js +154 -41
  43. package/dist/services/noaa.js.map +1 -1
  44. package/dist/services/openmeteo.d.ts +63 -3
  45. package/dist/services/openmeteo.d.ts.map +1 -1
  46. package/dist/services/openmeteo.js +284 -50
  47. package/dist/services/openmeteo.js.map +1 -1
  48. package/dist/types/noaa.d.ts +64 -12
  49. package/dist/types/noaa.d.ts.map +1 -1
  50. package/dist/types/openmeteo.d.ts +156 -0
  51. package/dist/types/openmeteo.d.ts.map +1 -1
  52. package/dist/utils/cache.d.ts +69 -0
  53. package/dist/utils/cache.d.ts.map +1 -0
  54. package/dist/utils/cache.js +164 -0
  55. package/dist/utils/cache.js.map +1 -0
  56. package/dist/utils/logger.d.ts +59 -0
  57. package/dist/utils/logger.d.ts.map +1 -0
  58. package/dist/utils/logger.js +128 -0
  59. package/dist/utils/logger.js.map +1 -0
  60. package/dist/utils/temperatureConversion.d.ts +12 -0
  61. package/dist/utils/temperatureConversion.d.ts.map +1 -0
  62. package/dist/utils/temperatureConversion.js +17 -0
  63. package/dist/utils/temperatureConversion.js.map +1 -0
  64. package/dist/utils/validation.d.ts +89 -0
  65. package/dist/utils/validation.d.ts.map +1 -0
  66. package/dist/utils/validation.js +177 -0
  67. package/dist/utils/validation.js.map +1 -0
  68. package/package.json +10 -3
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Handler for get_current_conditions tool
3
+ */
4
+ import { validateCoordinates } from '../utils/validation.js';
5
+ import { convertToFahrenheit } from '../utils/temperatureConversion.js';
6
+ import { DisplayThresholds } from '../config/displayThresholds.js';
7
+ export async function handleGetCurrentConditions(args, noaaService) {
8
+ // Validate input parameters with runtime checks
9
+ const { latitude, longitude } = validateCoordinates(args);
10
+ // Get current observation
11
+ const observation = await noaaService.getCurrentConditions(latitude, longitude);
12
+ const props = observation.properties;
13
+ // Format current conditions
14
+ let output = `# Current Weather Conditions\n\n`;
15
+ output += `**Station:** ${props.station}\n`;
16
+ output += `**Time:** ${new Date(props.timestamp).toLocaleString()}\n\n`;
17
+ // Main conditions
18
+ if (props.textDescription) {
19
+ output += `**Conditions:** ${props.textDescription}\n`;
20
+ }
21
+ // Temperature section
22
+ const tempF = convertToFahrenheit(props.temperature.value, props.temperature.unitCode);
23
+ if (tempF !== null) {
24
+ output += `**Temperature:** ${Math.round(tempF)}°F\n`;
25
+ // Show heat index when temperature is high and heat index is available
26
+ if (props.heatIndex) {
27
+ const heatIndexF = convertToFahrenheit(props.heatIndex.value, props.heatIndex.unitCode);
28
+ if (heatIndexF !== null && tempF > DisplayThresholds.temperature.showHeatIndex && heatIndexF > tempF) {
29
+ output += `**Feels Like (Heat Index):** ${Math.round(heatIndexF)}°F\n`;
30
+ }
31
+ }
32
+ // Show wind chill when temperature is low and wind chill is available
33
+ if (props.windChill) {
34
+ const windChillF = convertToFahrenheit(props.windChill.value, props.windChill.unitCode);
35
+ if (windChillF !== null && tempF < DisplayThresholds.temperature.showWindChill && windChillF < tempF) {
36
+ output += `**Feels Like (Wind Chill):** ${Math.round(windChillF)}°F\n`;
37
+ }
38
+ }
39
+ }
40
+ // 24-hour temperature range
41
+ const max24F = props.maxTemperatureLast24Hours ? convertToFahrenheit(props.maxTemperatureLast24Hours.value, props.maxTemperatureLast24Hours.unitCode) : null;
42
+ const min24F = props.minTemperatureLast24Hours ? convertToFahrenheit(props.minTemperatureLast24Hours.value, props.minTemperatureLast24Hours.unitCode) : null;
43
+ if (max24F !== null || min24F !== null) {
44
+ let range = `**24-Hour Range:**`;
45
+ if (max24F !== null)
46
+ range += ` High ${Math.round(max24F)}°F`;
47
+ if (max24F !== null && min24F !== null)
48
+ range += ` /`;
49
+ if (min24F !== null)
50
+ range += ` Low ${Math.round(min24F)}°F`;
51
+ output += `${range}\n`;
52
+ }
53
+ if (props.dewpoint.value !== null) {
54
+ const dewF = convertToFahrenheit(props.dewpoint.value, props.dewpoint.unitCode);
55
+ if (dewF !== null) {
56
+ output += `**Dewpoint:** ${Math.round(dewF)}°F\n`;
57
+ }
58
+ }
59
+ if (props.relativeHumidity.value !== null) {
60
+ output += `**Humidity:** ${Math.round(props.relativeHumidity.value)}%\n`;
61
+ }
62
+ // Wind section
63
+ if (props.windSpeed && props.windSpeed.value !== null) {
64
+ const windMph = props.windSpeed.unitCode.includes('km_h')
65
+ ? props.windSpeed.value * 0.621371
66
+ : props.windSpeed.value * 2.23694; // m/s to mph
67
+ const windDir = props.windDirection?.value ?? null;
68
+ output += `**Wind:** ${Math.round(windMph)} mph`;
69
+ if (windDir !== null) {
70
+ output += ` from ${Math.round(windDir)}°`;
71
+ }
72
+ // Add wind gust if available and significant
73
+ if (props.windGust && props.windGust.value !== null) {
74
+ const gustMph = props.windGust.unitCode.includes('km_h')
75
+ ? props.windGust.value * 0.621371
76
+ : props.windGust.value * 2.23694;
77
+ if (gustMph > windMph * DisplayThresholds.wind.gustSignificanceRatio) {
78
+ output += `, gusting to ${Math.round(gustMph)} mph`;
79
+ }
80
+ }
81
+ output += `\n`;
82
+ }
83
+ if (props.barometricPressure && props.barometricPressure.value !== null) {
84
+ const pressureInHg = props.barometricPressure.value * 0.0002953;
85
+ output += `**Pressure:** ${pressureInHg.toFixed(2)} inHg\n`;
86
+ }
87
+ // Enhanced visibility and cloud cover
88
+ if (props.visibility && props.visibility.value !== null) {
89
+ const visibilityMiles = props.visibility.value * 0.000621371;
90
+ output += `**Visibility:** ${visibilityMiles.toFixed(1)} miles`;
91
+ // Add descriptive text for visibility
92
+ if (visibilityMiles < DisplayThresholds.visibility.denseFog) {
93
+ output += ` (dense fog)`;
94
+ }
95
+ else if (visibilityMiles < DisplayThresholds.visibility.fog) {
96
+ output += ` (fog)`;
97
+ }
98
+ else if (visibilityMiles < DisplayThresholds.visibility.hazeMist) {
99
+ output += ` (haze/mist)`;
100
+ }
101
+ else if (visibilityMiles >= DisplayThresholds.visibility.clear) {
102
+ output += ` (clear)`;
103
+ }
104
+ output += `\n`;
105
+ }
106
+ // Cloud cover details
107
+ if (props.cloudLayers && props.cloudLayers.length > 0) {
108
+ const cloudDescriptions = {
109
+ 'FEW': 'Few clouds',
110
+ 'SCT': 'Scattered clouds',
111
+ 'BKN': 'Broken clouds',
112
+ 'OVC': 'Overcast',
113
+ 'CLR': 'Clear',
114
+ 'SKC': 'Sky clear'
115
+ };
116
+ const clouds = props.cloudLayers
117
+ .filter(layer => layer.amount)
118
+ .map(layer => {
119
+ const desc = cloudDescriptions[layer.amount] || layer.amount;
120
+ if (layer.base?.value !== null && layer.base?.value !== undefined) {
121
+ const heightFt = layer.base.unitCode.includes('m')
122
+ ? layer.base.value * 3.28084
123
+ : layer.base.value;
124
+ return `${desc} at ${Math.round(heightFt).toLocaleString()} ft`;
125
+ }
126
+ return desc;
127
+ });
128
+ if (clouds.length > 0) {
129
+ output += `**Cloud Cover:** ${clouds.join(', ')}\n`;
130
+ }
131
+ }
132
+ // Precipitation section
133
+ const precip1h = props.precipitationLastHour?.value ?? null;
134
+ const precip3h = props.precipitationLast3Hours?.value ?? null;
135
+ const precip6h = props.precipitationLast6Hours?.value ?? null;
136
+ if (precip1h !== null || precip3h !== null || precip6h !== null) {
137
+ output += `\n## Recent Precipitation\n`;
138
+ if (precip1h !== null && props.precipitationLastHour) {
139
+ const precipIn = props.precipitationLastHour.unitCode.includes('mm')
140
+ ? precip1h * 0.0393701
141
+ : precip1h;
142
+ output += `**Last Hour:** ${precipIn.toFixed(2)} inches\n`;
143
+ }
144
+ if (precip3h !== null && props.precipitationLast3Hours) {
145
+ const precipIn = props.precipitationLast3Hours.unitCode.includes('mm')
146
+ ? precip3h * 0.0393701
147
+ : precip3h;
148
+ output += `**Last 3 Hours:** ${precipIn.toFixed(2)} inches\n`;
149
+ }
150
+ if (precip6h !== null && props.precipitationLast6Hours) {
151
+ const precipIn = props.precipitationLast6Hours.unitCode.includes('mm')
152
+ ? precip6h * 0.0393701
153
+ : precip6h;
154
+ output += `**Last 6 Hours:** ${precipIn.toFixed(2)} inches\n`;
155
+ }
156
+ }
157
+ output += `\n---\n`;
158
+ output += `*Data source: NOAA National Weather Service*\n`;
159
+ return {
160
+ content: [
161
+ {
162
+ type: 'text',
163
+ text: output
164
+ }
165
+ ]
166
+ };
167
+ }
168
+ //# sourceMappingURL=currentConditionsHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currentConditionsHandler.js","sourceRoot":"","sources":["../../src/handlers/currentConditionsHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAAa,EACb,WAAwB;IAExB,gDAAgD;IAChD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAE1D,0BAA0B;IAC1B,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAChF,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC;IAErC,4BAA4B;IAC5B,IAAI,MAAM,GAAG,kCAAkC,CAAC;IAChD,MAAM,IAAI,gBAAgB,KAAK,CAAC,OAAO,IAAI,CAAC;IAC5C,MAAM,IAAI,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,MAAM,CAAC;IAExE,kBAAkB;IAClB,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1B,MAAM,IAAI,mBAAmB,K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{ OpenMeteoService } from '../services/openmeteo.js';
7
+ export declare function handleGetForecast(args: unknown, noaaService: NOAAService, openMeteoService: OpenMeteoService): Promise<{
8
+ content: Array<{
9
+ type: string;
10
+ text: string;
11
+ }>;
12
+ }>;
13
+ //# sourceMappingURL=forecastHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forecastHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/forecastHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AA+B5D,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA2C7D"}
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Handler for get_forecast tool
3
+ * Supports both NOAA (US) and Open-Meteo (global) forecast sources
4
+ */
5
+ import { validateCoordinates, validateForecastDays, validateGranularity, validateOptionalBoolean, } from '../utils/validation.js';
6
+ /**
7
+ * Determine if coordinates are within the United States (including Alaska, Hawaii, and territories)
8
+ * Uses bounding box approach for simplicity
9
+ */
10
+ function isInUS(latitude, longitude) {
11
+ // Continental US, Alaska, Hawaii, Puerto Rico, and territories
12
+ const inContinentalUS = latitude >= 24.5 && latitude <= 49.4 && longitude >= -125 && longitude <= -66.9;
13
+ const inAlaska = latitude >= 51 && latitude <= 71.4 && longitude >= -180 && longitude <= -129.9;
14
+ const inHawaii = latitude >= 18.9 && latitude <= 28.5 && longitude >= -178.4 && longitude <= -154.8;
15
+ const inPuertoRico = latitude >= 17.9 && latitude <= 18.5 && longitude >= -67.3 && longitude <= -65.2;
16
+ return inContinentalUS || inAlaska || inHawaii || inPuertoRico;
17
+ }
18
+ export async function handleGetForecast(args, noaaService, openMeteoService) {
19
+ // Validate input parameters with runtime checks
20
+ const { latitude, longitude } = validateCoordinates(args);
21
+ const days = validateForecastDays(args);
22
+ const granularity = validateGranularity(args?.granularity);
23
+ const include_precipitation_probability = validateOptionalBoolean(args?.include_precipitation_probability, 'include_precipitation_probability', true);
24
+ // Get source preference or auto-detect
25
+ const requestedSource = args?.source || 'auto';
26
+ let useNOAA;
27
+ if (requestedSource === 'auto') {
28
+ // Auto-detect based on location (US = NOAA, elsewhere = Open-Meteo)
29
+ useNOAA = isInUS(latitude, longitude);
30
+ }
31
+ else {
32
+ useNOAA = requestedSource === 'noaa';
33
+ }
34
+ // Use NOAA for US locations or if explicitly requested
35
+ if (useNOAA) {
36
+ return await formatNOAAForecast(noaaService, latitude, longitude, days, granularity, include_precipitation_probability);
37
+ }
38
+ else {
39
+ // Use Open-Meteo for international locations
40
+ return await formatOpenMeteoForecast(openMeteoService, latitude, longitude, days, granularity, include_precipitation_probability);
41
+ }
42
+ }
43
+ /**
44
+ * Format NOAA forecast data for display
45
+ */
46
+ async function formatNOAAForecast(noaaService, latitude, longitude, days, granularity, include_precipitation_probability) {
47
+ // Get forecast data based on granularity
48
+ const forecast = granularity === 'hourly'
49
+ ? await noaaService.getHourlyForecastByCoordinates(latitude, longitude)
50
+ : await noaaService.getForecastByCoordinates(latitude, longitude);
51
+ // Determine how many periods to show
52
+ let periods;
53
+ if (granularity === 'hourly') {
54
+ // For hourly, show up to days * 24 hours
55
+ periods = forecast.properties.periods.slice(0, days * 24);
56
+ }
57
+ else {
58
+ // For daily, show up to days * 2 (day/night periods)
59
+ periods = forecast.properties.periods.slice(0, days * 2);
60
+ }
61
+ // Format the forecast for display
62
+ let output = `# Weather Forecast (${granularity === 'hourly' ? 'Hourly' : 'Daily'})\n\n`;
63
+ output += `**Location:** ${latitude.toFixed(4)}, ${longitude.toFixed(4)}\n`;
64
+ output += `**Elevation:** ${forecast.properties.elevation.value}m\n`;
65
+ if (forecast.properties.updated) {
66
+ output += `**Updated:** ${new Date(forecast.properties.updated).toLocaleString()}\n`;
67
+ }
68
+ output += `**Showing:** ${periods.length} ${granularity === 'hourly' ? 'hours' : 'periods'}\n\n`;
69
+ for (const period of periods) {
70
+ // For hourly forecasts, use the start time as the header since period names are empty
71
+ const periodHeader = granularity === 'hourly' && !period.name
72
+ ? new Date(period.startTime).toLocaleString()
73
+ : period.name;
74
+ output += `## ${periodHeader}\n`;
75
+ output += `**Temperature:** ${period.temperature}°${period.temperatureUnit}`;
76
+ // Add temperature trend if available
77
+ if (period.temperatureTrend && period.temperatureTrend.trim()) {
78
+ output += ` (${period.temperatureTrend})`;
79
+ }
80
+ output += `\n`;
81
+ // Add precipitation probability if requested and available
82
+ if (include_precipitation_probability && period.probabilityOfPrecipitation?.value !== null && period.probabilityOfPrecipitation?.value !== undefined) {
83
+ output += `**Precipitation Chance:** ${period.probabilityOfPrecipitation.value}%\n`;
84
+ }
85
+ output += `**Wind:** ${period.windSpeed} ${period.windDirection}\n`;
86
+ // Add humidity if available (more common in hourly forecasts)
87
+ if (period.relativeHumidity?.value !== null && period.relativeHumidity?.value !== undefined) {
88
+ output += `**Humidity:** ${period.relativeHumidity.value}%\n`;
89
+ }
90
+ output += `**Forecast:** ${period.shortForecast}\n\n`;
91
+ // For daily forecasts, include detailed forecast
92
+ if (granularity === 'daily' && period.detailedForecast) {
93
+ output += `${period.detailedForecast}\n\n`;
94
+ }
95
+ }
96
+ output += `---\n`;
97
+ output += `*Data source: NOAA National Weather Service (US)*\n`;
98
+ return {
99
+ content: [
100
+ {
101
+ type: 'text',
102
+ text: output
103
+ }
104
+ ]
105
+ };
106
+ }
107
+ /**
108
+ * Format Open-Meteo forecast data for display
109
+ */
110
+ async function formatOpenMeteoForecast(openMeteoService, latitude, longitude, days, granularity, include_precipitation_probability) {
111
+ // Get forecast data from Open-Meteo
112
+ const forecast = await openMeteoService.getForecast(latitude, longitude, days, granularity === 'hourly');
113
+ let output = `# Weather Forecast (${granularity === 'hourly' ? 'Hourly' : 'Daily'})\n\n`;
114
+ output += `**Location:** ${latitude.toFixed(4)}, ${longitude.toFixed(4)}\n`;
115
+ output += `**Elevation:** ${forecast.elevation}m\n`;
116
+ output += `**Timezone:** ${forecast.timezone}\n`;
117
+ output += `**Forecast Days:** ${days}\n\n`;
118
+ if (granularity === 'hourly' && forecast.hourly) {
119
+ // Format hourly data
120
+ const hourly = forecast.hourly;
121
+ const numHours = Math.min(hourly.time.length, days * 24);
122
+ for (let i = 0; i < numHours; i++) {
123
+ const time = new Date(hourly.time[i]);
124
+ output += `## ${time.toLocaleString()}\n`;
125
+ if (hourly.temperature_2m?.[i] !== undefined) {
126
+ output += `**Temperature:** ${Math.round(hourly.temperature_2m[i])}°F`;
127
+ if (hourly.apparent_temperature?.[i] !== undefined) {
128
+ output += ` (feels like ${Math.round(hourly.apparent_temperature[i])}°F)`;
129
+ }
130
+ output += `\n`;
131
+ }
132
+ if (include_precipitation_probability && hourly.precipitation_probability?.[i] !== undefined) {
133
+ output += `**Precipitation Chance:** ${hourly.precipitation_probability[i]}%\n`;
134
+ }
135
+ if (hourly.precipitation?.[i] !== undefined && hourly.precipitation[i] > 0) {
136
+ output += `**Precipitation:** ${hourly.precipitation[i].toFixed(2)} in\n`;
137
+ }
138
+ if (hourly.wind_speed_10m?.[i] !== undefined) {
139
+ const windDir = hourly.wind_direction_10m?.[i] !== undefined
140
+ ? ` ${getWindDirection(hourly.wind_direction_10m[i])}`
141
+ : '';
142
+ output += `**Wind:** ${Math.round(hourly.wind_speed_10m[i])} mph${windDir}\n`;
143
+ if (hourly.wind_gusts_10m?.[i] !== undefined && hourly.wind_gusts_10m[i] > hourly.wind_speed_10m[i] * 1.2) {
144
+ output += `**Wind Gusts:** ${Math.round(hourly.wind_gusts_10m[i])} mph\n`;
145
+ }
146
+ }
147
+ if (hourly.relative_humidity_2m?.[i] !== undefined) {
148
+ output += `**Humidity:** ${hourly.relative_humidity_2m[i]}%\n`;
149
+ }
150
+ if (hourly.weather_code?.[i] !== undefined) {
151
+ output += `**Conditions:** ${openMeteoService.getWeatherDescription(hourly.weather_code[i])}\n`;
152
+ }
153
+ output += `\n`;
154
+ }
155
+ }
156
+ else if (forecast.daily) {
157
+ // Format daily data with sunrise/sunset
158
+ const daily = forecast.daily;
159
+ const numDays = Math.min(daily.time.length, days);
160
+ for (let i = 0; i < numDays; i++) {
161
+ const date = new Date(daily.time[i]);
162
+ output += `## ${date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' })}\n`;
163
+ if (daily.temperature_2m_max?.[i] !== undefined && daily.temperature_2m_min?.[i] !== undefined) {
164
+ output += `**Temperature:** High ${Math.round(daily.temperature_2m_max[i])}°F / Low ${Math.round(daily.temperature_2m_min[i])}°F\n`;
165
+ }
166
+ if (daily.apparent_temperature_max?.[i] !== undefined && daily.apparent_temperature_min?.[i] !== undefined) {
167
+ output += `**Feels Like:** High ${Math.round(daily.apparent_temperature_max[i])}°F / Low ${Math.round(daily.apparent_temperature_min[i])}°F\n`;
168
+ }
169
+ // Include sunrise/sunset data
170
+ if (daily.sunrise?.[i]) {
171
+ const sunrise = new Date(daily.sunrise[i]);
172
+ output += `**Sunrise:** ${sunrise.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })}\n`;
173
+ }
174
+ if (daily.sunset?.[i]) {
175
+ const sunset = new Date(daily.sunset[i]);
176
+ output += `**Sunset:** ${sunset.toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })}\n`;
177
+ }
178
+ if (daily.daylight_duration?.[i] !== undefined) {
179
+ const hours = Math.floor(daily.daylight_duration[i] / 3600);
180
+ const minutes = Math.floor((daily.daylight_duration[i] % 3600) / 60);
181
+ output += `**Daylight Duration:** ${hours}h ${minutes}m\n`;
182
+ }
183
+ if (include_precipitation_probability && daily.precipitation_probability_max?.[i] !== undefined) {
184
+ output += `**Precipitation Chance:** ${daily.precipitation_probability_max[i]}%\n`;
185
+ }
186
+ if (daily.precipitation_sum?.[i] !== undefined && daily.precipitation_sum[i] > 0) {
187
+ output += `**Precipitation:** ${daily.precipitation_sum[i].toFixed(2)} in\n`;
188
+ }
189
+ if (daily.wind_speed_10m_max?.[i] !== undefined) {
190
+ const windDir = daily.wind_direction_10m_dominant?.[i] !== undefined
191
+ ? ` ${getWindDirection(daily.wind_direction_10m_dominant[i])}`
192
+ : '';
193
+ output += `**Wind:** ${Math.round(daily.wind_speed_10m_max[i])} mph${windDir}\n`;
194
+ if (daily.wind_gusts_10m_max?.[i] !== undefined && daily.wind_gusts_10m_max[i] > daily.wind_speed_10m_max[i] * 1.2) {
195
+ output += `**Wind Gusts:** ${Math.round(daily.wind_gusts_10m_max[i])} mph\n`;
196
+ }
197
+ }
198
+ if (daily.weather_code?.[i] !== undefined) {
199
+ output += `**Conditions:** ${openMeteoService.getWeatherDescription(daily.weather_code[i])}\n`;
200
+ }
201
+ if (daily.uv_index_max?.[i] !== undefined) {
202
+ output += `**UV Index:** ${daily.uv_index_max[i].toFixed(1)}\n`;
203
+ }
204
+ output += `\n`;
205
+ }
206
+ }
207
+ output += `---\n`;
208
+ output += `*Data source: Open-Meteo (Global)*\n`;
209
+ return {
210
+ content: [
211
+ {
212
+ type: 'text',
213
+ text: output
214
+ }
215
+ ]
216
+ };
217
+ }
218
+ /**
219
+ * Convert wind direction degrees to cardinal direction
220
+ */
221
+ function getWindDirection(degrees) {
222
+ const directions = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'];
223
+ const index = Math.round(degrees / 22.5) % 16;
224
+ return directions[index];
225
+ }
226
+ //# sourceMappingURL=forecastHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forecastHandler.js","sourceRoot":"","sources":["../../src/handlers/forecastHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,mBAAmB,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
4
+ import { NOAAService } from '../services/noaa.js';
5
+ import { OpenMeteoService } from '../services/openmeteo.js';
6
+ export declare function handleGetHistoricalWeather(args: unknown, noaaService: NOAAService, openMeteoService: OpenMeteoService): Promise<{
7
+ content: Array<{
8
+ type: string;
9
+ text: string;
10
+ }>;
11
+ }>;
12
+ //# sourceMappingURL=historicalWeatherHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historicalWeatherHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/historicalWeatherHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA+N7D"}