@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.
- package/README.md +295 -52
- package/dist/config/cache.d.ts +30 -0
- package/dist/config/cache.d.ts.map +1 -0
- package/dist/config/cache.js +105 -0
- package/dist/config/cache.js.map +1 -0
- package/dist/config/displayThresholds.d.ts +83 -0
- package/dist/config/displayThresholds.d.ts.map +1 -0
- package/dist/config/displayThresholds.js +83 -0
- package/dist/config/displayThresholds.js.map +1 -0
- package/dist/errors/ApiError.d.ts +62 -0
- package/dist/errors/ApiError.d.ts.map +1 -0
- package/dist/errors/ApiError.js +147 -0
- package/dist/errors/ApiError.js.map +1 -0
- package/dist/handlers/alertsHandler.d.ts +11 -0
- package/dist/handlers/alertsHandler.d.ts.map +1 -0
- package/dist/handlers/alertsHandler.js +79 -0
- package/dist/handlers/alertsHandler.js.map +1 -0
- package/dist/handlers/currentConditionsHandler.d.ts +11 -0
- package/dist/handlers/currentConditionsHandler.d.ts.map +1 -0
- package/dist/handlers/currentConditionsHandler.js +168 -0
- package/dist/handlers/currentConditionsHandler.js.map +1 -0
- package/dist/handlers/forecastHandler.d.ts +13 -0
- package/dist/handlers/forecastHandler.d.ts.map +1 -0
- package/dist/handlers/forecastHandler.js +226 -0
- package/dist/handlers/forecastHandler.js.map +1 -0
- package/dist/handlers/historicalWeatherHandler.d.ts +12 -0
- package/dist/handlers/historicalWeatherHandler.d.ts.map +1 -0
- package/dist/handlers/historicalWeatherHandler.js +188 -0
- package/dist/handlers/historicalWeatherHandler.js.map +1 -0
- package/dist/handlers/locationHandler.d.ts +11 -0
- package/dist/handlers/locationHandler.d.ts.map +1 -0
- package/dist/handlers/locationHandler.js +113 -0
- package/dist/handlers/locationHandler.js.map +1 -0
- package/dist/handlers/statusHandler.d.ts +12 -0
- package/dist/handlers/statusHandler.d.ts.map +1 -0
- package/dist/handlers/statusHandler.js +106 -0
- package/dist/handlers/statusHandler.js.map +1 -0
- package/dist/index.js +149 -343
- package/dist/index.js.map +1 -1
- package/dist/services/noaa.d.ts +23 -1
- package/dist/services/noaa.d.ts.map +1 -1
- package/dist/services/noaa.js +154 -41
- package/dist/services/noaa.js.map +1 -1
- package/dist/services/openmeteo.d.ts +63 -3
- package/dist/services/openmeteo.d.ts.map +1 -1
- package/dist/services/openmeteo.js +284 -50
- package/dist/services/openmeteo.js.map +1 -1
- package/dist/types/noaa.d.ts +64 -12
- package/dist/types/noaa.d.ts.map +1 -1
- package/dist/types/openmeteo.d.ts +156 -0
- package/dist/types/openmeteo.d.ts.map +1 -1
- package/dist/utils/cache.d.ts +69 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +164 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +128 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/temperatureConversion.d.ts +12 -0
- package/dist/utils/temperatureConversion.d.ts.map +1 -0
- package/dist/utils/temperatureConversion.js +17 -0
- package/dist/utils/temperatureConversion.js.map +1 -0
- package/dist/utils/validation.d.ts +89 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +177 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +10 -3
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for get_historical_weather tool
|
|
3
|
+
*/
|
|
4
|
+
import { validateHistoricalWeatherParams } from '../utils/validation.js';
|
|
5
|
+
import { convertToFahrenheit } from '../utils/temperatureConversion.js';
|
|
6
|
+
import { ApiConstants, FormatConstants } from '../config/displayThresholds.js';
|
|
7
|
+
export async function handleGetHistoricalWeather(args, noaaService, openMeteoService) {
|
|
8
|
+
// Validate input parameters with runtime checks
|
|
9
|
+
const { latitude, longitude, start_date, end_date, limit = FormatConstants.defaultHistoricalLimit } = validateHistoricalWeatherParams(args);
|
|
10
|
+
// Parse dates
|
|
11
|
+
const startTime = new Date(start_date);
|
|
12
|
+
const endTime = new Date(end_date);
|
|
13
|
+
// Validate dates are not in the future
|
|
14
|
+
const now = new Date();
|
|
15
|
+
if (startTime > now) {
|
|
16
|
+
throw new Error(`Start date (${start_date}) cannot be in the future. Current date is ${now.toISOString().split('T')[0]}.`);
|
|
17
|
+
}
|
|
18
|
+
if (endTime > now) {
|
|
19
|
+
throw new Error(`End date (${end_date}) cannot be in the future. Current date is ${now.toISOString().split('T')[0]}.`);
|
|
20
|
+
}
|
|
21
|
+
// Determine which API to use based on date range
|
|
22
|
+
// If start date is older than threshold, use archival API
|
|
23
|
+
const thresholdDate = new Date(now.getTime() - ApiConstants.historicalDataThresholdDays * 24 * 60 * 60 * 1000);
|
|
24
|
+
const useArchivalData = startTime < thresholdDate;
|
|
25
|
+
if (useArchivalData) {
|
|
26
|
+
// Use Open-Meteo API for historical/archival data
|
|
27
|
+
try {
|
|
28
|
+
// Determine whether to use hourly or daily data based on date range
|
|
29
|
+
const daysDiff = Math.ceil((endTime.getTime() - startTime.getTime()) / (1000 * 60 * 60 * 24));
|
|
30
|
+
const useHourly = daysDiff <= ApiConstants.maxHourlyHistoricalDays;
|
|
31
|
+
const weatherData = await openMeteoService.getHistoricalWeather(latitude, longitude, start_date.split('T')[0], // Ensure YYYY-MM-DD format
|
|
32
|
+
end_date.split('T')[0], useHourly);
|
|
33
|
+
// Format the response based on data granularity
|
|
34
|
+
if (useHourly && weatherData.hourly) {
|
|
35
|
+
// Format hourly observations
|
|
36
|
+
let output = `# Historical Weather Observations (Hourly)\n\n`;
|
|
37
|
+
output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
|
|
38
|
+
output += `**Location:** ${weatherData.latitude.toFixed(4)}°N, ${Math.abs(weatherData.longitude).toFixed(4)}°${weatherData.longitude >= 0 ? 'E' : 'W'} (${weatherData.elevation}m elevation)\n`;
|
|
39
|
+
output += `**Number of observations:** ${weatherData.hourly.time.length}\n`;
|
|
40
|
+
output += `**Data source:** Open-Meteo Historical Weather API (Reanalysis)\n\n`;
|
|
41
|
+
const maxObservations = Math.min(limit, weatherData.hourly.time.length);
|
|
42
|
+
for (let i = 0; i < maxObservations; i++) {
|
|
43
|
+
const time = new Date(weatherData.hourly.time[i]);
|
|
44
|
+
output += `## ${time.toLocaleString()}\n`;
|
|
45
|
+
if (weatherData.hourly.temperature_2m?.[i] !== null && weatherData.hourly.temperature_2m?.[i] !== undefined) {
|
|
46
|
+
output += `- **Temperature:** ${Math.round(weatherData.hourly.temperature_2m[i])}°F\n`;
|
|
47
|
+
}
|
|
48
|
+
if (weatherData.hourly.apparent_temperature?.[i] !== null && weatherData.hourly.apparent_temperature?.[i] !== undefined) {
|
|
49
|
+
output += `- **Feels Like:** ${Math.round(weatherData.hourly.apparent_temperature[i])}°F\n`;
|
|
50
|
+
}
|
|
51
|
+
if (weatherData.hourly.weather_code?.[i] !== null && weatherData.hourly.weather_code?.[i] !== undefined) {
|
|
52
|
+
output += `- **Conditions:** ${openMeteoService.getWeatherDescription(weatherData.hourly.weather_code[i])}\n`;
|
|
53
|
+
}
|
|
54
|
+
if (weatherData.hourly.precipitation?.[i] !== null && weatherData.hourly.precipitation?.[i] !== undefined && weatherData.hourly.precipitation[i] > 0) {
|
|
55
|
+
output += `- **Precipitation:** ${weatherData.hourly.precipitation[i].toFixed(2)} in\n`;
|
|
56
|
+
}
|
|
57
|
+
if (weatherData.hourly.snowfall?.[i] !== null && weatherData.hourly.snowfall?.[i] !== undefined && weatherData.hourly.snowfall[i] > 0) {
|
|
58
|
+
output += `- **Snowfall:** ${weatherData.hourly.snowfall[i].toFixed(1)} in\n`;
|
|
59
|
+
}
|
|
60
|
+
if (weatherData.hourly.wind_speed_10m?.[i] !== null && weatherData.hourly.wind_speed_10m?.[i] !== undefined) {
|
|
61
|
+
output += `- **Wind:** ${Math.round(weatherData.hourly.wind_speed_10m[i])} mph`;
|
|
62
|
+
if (weatherData.hourly.wind_direction_10m?.[i] !== null && weatherData.hourly.wind_direction_10m?.[i] !== undefined) {
|
|
63
|
+
output += ` from ${Math.round(weatherData.hourly.wind_direction_10m[i])}°`;
|
|
64
|
+
}
|
|
65
|
+
output += `\n`;
|
|
66
|
+
}
|
|
67
|
+
if (weatherData.hourly.relative_humidity_2m?.[i] !== null && weatherData.hourly.relative_humidity_2m?.[i] !== undefined) {
|
|
68
|
+
output += `- **Humidity:** ${Math.round(weatherData.hourly.relative_humidity_2m[i])}%\n`;
|
|
69
|
+
}
|
|
70
|
+
if (weatherData.hourly.pressure_msl?.[i] !== null && weatherData.hourly.pressure_msl?.[i] !== undefined) {
|
|
71
|
+
const pressureInHg = weatherData.hourly.pressure_msl[i] * 0.02953;
|
|
72
|
+
output += `- **Pressure:** ${pressureInHg.toFixed(2)} inHg\n`;
|
|
73
|
+
}
|
|
74
|
+
if (weatherData.hourly.cloud_cover?.[i] !== null && weatherData.hourly.cloud_cover?.[i] !== undefined) {
|
|
75
|
+
output += `- **Cloud Cover:** ${weatherData.hourly.cloud_cover[i]}%\n`;
|
|
76
|
+
}
|
|
77
|
+
output += `\n`;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: 'text',
|
|
83
|
+
text: output
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else if (weatherData.daily) {
|
|
89
|
+
// Format daily summaries
|
|
90
|
+
let output = `# Historical Weather Data (Daily Summaries)\n\n`;
|
|
91
|
+
output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
|
|
92
|
+
output += `**Location:** ${weatherData.latitude.toFixed(4)}°N, ${Math.abs(weatherData.longitude).toFixed(4)}°${weatherData.longitude >= 0 ? 'E' : 'W'} (${weatherData.elevation}m elevation)\n`;
|
|
93
|
+
output += `**Number of days:** ${weatherData.daily.time.length}\n`;
|
|
94
|
+
output += `**Data source:** Open-Meteo Historical Weather API (Reanalysis)\n\n`;
|
|
95
|
+
for (let i = 0; i < weatherData.daily.time.length; i++) {
|
|
96
|
+
const date = new Date(weatherData.daily.time[i]);
|
|
97
|
+
output += `## ${date.toLocaleDateString()}\n`;
|
|
98
|
+
if (weatherData.daily.temperature_2m_max?.[i] !== null && weatherData.daily.temperature_2m_max?.[i] !== undefined) {
|
|
99
|
+
output += `- **High Temperature:** ${Math.round(weatherData.daily.temperature_2m_max[i])}°F\n`;
|
|
100
|
+
}
|
|
101
|
+
if (weatherData.daily.temperature_2m_min?.[i] !== null && weatherData.daily.temperature_2m_min?.[i] !== undefined) {
|
|
102
|
+
output += `- **Low Temperature:** ${Math.round(weatherData.daily.temperature_2m_min[i])}°F\n`;
|
|
103
|
+
}
|
|
104
|
+
if (weatherData.daily.temperature_2m_mean?.[i] !== null && weatherData.daily.temperature_2m_mean?.[i] !== undefined) {
|
|
105
|
+
output += `- **Average Temperature:** ${Math.round(weatherData.daily.temperature_2m_mean[i])}°F\n`;
|
|
106
|
+
}
|
|
107
|
+
if (weatherData.daily.weather_code?.[i] !== null && weatherData.daily.weather_code?.[i] !== undefined) {
|
|
108
|
+
output += `- **Conditions:** ${openMeteoService.getWeatherDescription(weatherData.daily.weather_code[i])}\n`;
|
|
109
|
+
}
|
|
110
|
+
if (weatherData.daily.precipitation_sum?.[i] !== null && weatherData.daily.precipitation_sum?.[i] !== undefined) {
|
|
111
|
+
output += `- **Precipitation:** ${weatherData.daily.precipitation_sum[i].toFixed(2)} in\n`;
|
|
112
|
+
}
|
|
113
|
+
if (weatherData.daily.snowfall_sum?.[i] !== null && weatherData.daily.snowfall_sum?.[i] !== undefined && weatherData.daily.snowfall_sum[i] > 0) {
|
|
114
|
+
output += `- **Snowfall:** ${weatherData.daily.snowfall_sum[i].toFixed(1)} in\n`;
|
|
115
|
+
}
|
|
116
|
+
if (weatherData.daily.wind_speed_10m_max?.[i] !== null && weatherData.daily.wind_speed_10m_max?.[i] !== undefined) {
|
|
117
|
+
output += `- **Max Wind Speed:** ${Math.round(weatherData.daily.wind_speed_10m_max[i])} mph\n`;
|
|
118
|
+
}
|
|
119
|
+
output += `\n`;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
content: [
|
|
123
|
+
{
|
|
124
|
+
type: 'text',
|
|
125
|
+
text: output
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
throw new Error('No weather data available in response');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
// If Open-Meteo API fails, provide helpful error message
|
|
136
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
137
|
+
throw new Error(`Unable to retrieve historical data: ${errorMessage}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// Use real-time NOAA API for recent data (last 7 days)
|
|
142
|
+
const observations = await noaaService.getHistoricalObservations(latitude, longitude, startTime, endTime, limit);
|
|
143
|
+
if (!observations.features || observations.features.length === 0) {
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: 'text',
|
|
148
|
+
text: `No historical observations found for the specified date range (${start_date} to ${end_date}).\n\nThis may occur because:\n- The dates are outside the station's available data range\n- There are gaps in the observation records for this location\n- The weather station near this location may not have archived data for these dates\n\nNote: Historical weather data availability varies by location and weather station. Some stations have limited historical records.`
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// Format the observations
|
|
154
|
+
let output = `# Historical Weather Observations\n\n`;
|
|
155
|
+
output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
|
|
156
|
+
output += `**Number of observations:** ${observations.features.length}\n`;
|
|
157
|
+
output += `**Data source:** NOAA Real-time API\n\n`;
|
|
158
|
+
for (const obs of observations.features) {
|
|
159
|
+
const props = obs.properties;
|
|
160
|
+
output += `## ${new Date(props.timestamp).toLocaleString()}\n`;
|
|
161
|
+
if (props.temperature.value !== null) {
|
|
162
|
+
const tempF = convertToFahrenheit(props.temperature.value, props.temperature.unitCode);
|
|
163
|
+
if (tempF !== null) {
|
|
164
|
+
output += `- **Temperature:** ${Math.round(tempF)}°F\n`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (props.textDescription) {
|
|
168
|
+
output += `- **Conditions:** ${props.textDescription}\n`;
|
|
169
|
+
}
|
|
170
|
+
if (props.windSpeed.value !== null) {
|
|
171
|
+
const windMph = props.windSpeed.unitCode.includes('km_h')
|
|
172
|
+
? props.windSpeed.value * 0.621371
|
|
173
|
+
: props.windSpeed.value * 2.23694;
|
|
174
|
+
output += `- **Wind:** ${Math.round(windMph)} mph\n`;
|
|
175
|
+
}
|
|
176
|
+
output += `\n`;
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
content: [
|
|
180
|
+
{
|
|
181
|
+
type: 'text',
|
|
182
|
+
text: output
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=historicalWeatherHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historicalWeatherHandler.js","sourceRoot":"","sources":["../../src/handlers/historicalWeatherHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAE/E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAAa,EACb,WAAwB,EACxB,gBAAkC;IAElC,gDAAgD;IAChD,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,GAAG,e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oBACZ,IAAI,EAAE,MAAM;iBACb;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for search_location tool
|
|
3
|
+
*/
|
|
4
|
+
import { OpenMeteoService } from '../services/openmeteo.js';
|
|
5
|
+
export declare function handleSearchLocation(args: unknown, openMeteoService: OpenMeteoService): Promise<{
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=locationHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locationHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/locationHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAQ5D,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,OAAO,EACb,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,CA0F7D"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for search_location tool
|
|
3
|
+
*/
|
|
4
|
+
import { DataNotFoundError } from '../errors/ApiError.js';
|
|
5
|
+
export async function handleSearchLocation(args, openMeteoService) {
|
|
6
|
+
// Validate input parameters
|
|
7
|
+
const locationArgs = args;
|
|
8
|
+
if (!locationArgs.query || typeof locationArgs.query !== 'string') {
|
|
9
|
+
throw new Error('query parameter is required and must be a string');
|
|
10
|
+
}
|
|
11
|
+
const query = locationArgs.query.trim();
|
|
12
|
+
const limit = typeof locationArgs.limit === 'number' ?
|
|
13
|
+
Math.min(Math.max(1, locationArgs.limit), 100) : 5;
|
|
14
|
+
// Search for locations
|
|
15
|
+
const response = await openMeteoService.searchLocation(query, limit);
|
|
16
|
+
if (!response.results || response.results.length === 0) {
|
|
17
|
+
throw new DataNotFoundError('OpenMeteo', `No locations found matching "${query}". Try:\n` +
|
|
18
|
+
`- Using a different spelling\n` +
|
|
19
|
+
`- Being more specific (e.g., "Paris, France" instead of "Paris")\n` +
|
|
20
|
+
`- Using a nearby city or landmark`);
|
|
21
|
+
}
|
|
22
|
+
// Format the results for display
|
|
23
|
+
let output = `# Location Search Results\n\n`;
|
|
24
|
+
output += `**Query:** "${query}"\n`;
|
|
25
|
+
output += `**Found:** ${response.results.length} location${response.results.length > 1 ? 's' : ''}\n\n`;
|
|
26
|
+
output += `---\n\n`;
|
|
27
|
+
for (let i = 0; i < response.results.length; i++) {
|
|
28
|
+
const location = response.results[i];
|
|
29
|
+
output += `## ${i + 1}. ${location.name}\n\n`;
|
|
30
|
+
// Build location description
|
|
31
|
+
const parts = [location.name];
|
|
32
|
+
if (location.admin1)
|
|
33
|
+
parts.push(location.admin1);
|
|
34
|
+
if (location.admin2 && location.admin2 !== location.admin1)
|
|
35
|
+
parts.push(location.admin2);
|
|
36
|
+
if (location.country)
|
|
37
|
+
parts.push(location.country);
|
|
38
|
+
output += `**Full Name:** ${parts.join(', ')}\n`;
|
|
39
|
+
output += `**Coordinates:** ${location.latitude.toFixed(4)}°, ${location.longitude.toFixed(4)}°\n`;
|
|
40
|
+
if (location.country_code) {
|
|
41
|
+
output += `**Country Code:** ${location.country_code.toUpperCase()}\n`;
|
|
42
|
+
}
|
|
43
|
+
if (location.timezone) {
|
|
44
|
+
output += `**Timezone:** ${location.timezone}\n`;
|
|
45
|
+
}
|
|
46
|
+
if (location.elevation !== undefined) {
|
|
47
|
+
const elevationFt = Math.round(location.elevation * 3.28084);
|
|
48
|
+
output += `**Elevation:** ${location.elevation}m (${elevationFt}ft)\n`;
|
|
49
|
+
}
|
|
50
|
+
if (location.population !== undefined && location.population > 0) {
|
|
51
|
+
output += `**Population:** ${location.population.toLocaleString()}\n`;
|
|
52
|
+
}
|
|
53
|
+
if (location.feature_code) {
|
|
54
|
+
const featureDescription = getFeatureDescription(location.feature_code);
|
|
55
|
+
if (featureDescription) {
|
|
56
|
+
output += `**Type:** ${featureDescription}\n`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
output += `\n`;
|
|
60
|
+
// Add usage example
|
|
61
|
+
output += `*To get weather for this location, use these coordinates:*\n`;
|
|
62
|
+
output += `*Latitude: ${location.latitude}, Longitude: ${location.longitude}*\n\n`;
|
|
63
|
+
if (i < response.results.length - 1) {
|
|
64
|
+
output += `---\n\n`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
output += `---\n`;
|
|
68
|
+
output += `*Data source: Open-Meteo Geocoding API*\n`;
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: output
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get human-readable description for feature code
|
|
80
|
+
* Based on GeoNames feature codes: https://www.geonames.org/export/codes.html
|
|
81
|
+
*/
|
|
82
|
+
function getFeatureDescription(code) {
|
|
83
|
+
const featureCodes = {
|
|
84
|
+
'PPL': 'Populated place',
|
|
85
|
+
'PPLA': 'Administrative capital',
|
|
86
|
+
'PPLA2': 'Second-order administrative capital',
|
|
87
|
+
'PPLA3': 'Third-order administrative capital',
|
|
88
|
+
'PPLA4': 'Fourth-order administrative capital',
|
|
89
|
+
'PPLC': 'National capital',
|
|
90
|
+
'PPLG': 'Seat of government',
|
|
91
|
+
'PPLS': 'Populated places',
|
|
92
|
+
'PPLX': 'Section of populated place',
|
|
93
|
+
'ADM1': 'First-order administrative division',
|
|
94
|
+
'ADM2': 'Second-order administrative division',
|
|
95
|
+
'ADM3': 'Third-order administrative division',
|
|
96
|
+
'ADM4': 'Fourth-order administrative division',
|
|
97
|
+
'PCLI': 'Independent political entity',
|
|
98
|
+
'PCLD': 'Dependent political entity',
|
|
99
|
+
'ISL': 'Island',
|
|
100
|
+
'MT': 'Mountain',
|
|
101
|
+
'MTS': 'Mountains',
|
|
102
|
+
'LAKE': 'Lake',
|
|
103
|
+
'RSTN': 'Railroad station',
|
|
104
|
+
'AIRP': 'Airport',
|
|
105
|
+
'AIRF': 'Airfield',
|
|
106
|
+
'PRK': 'Park',
|
|
107
|
+
'RES': 'Reserve',
|
|
108
|
+
'RESN': 'Nature reserve',
|
|
109
|
+
'RESW': 'Wildlife reserve'
|
|
110
|
+
};
|
|
111
|
+
return featureCodes[code] || null;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=locationHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locationHandler.js","sourceRoot":"","sources":["../../src/handlers/locationHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAa,EACb,gBAAkC;IAElC,4BAA4B;IAC5B,MAAM,YAAY,GAAG,IAAoB,CAAC;IAE1C,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,OAAO,YAAY,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,uBAAuB;IACvB,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC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status tool
|
|
3
|
+
*/
|
|
4
|
+
import { NOAAService } from '../services/noaa.js';
|
|
5
|
+
import { OpenMeteoService } from '../services/openmeteo.js';
|
|
6
|
+
export declare function handleCheckServiceStatus(noaaService: NOAAService, openMeteoService: OpenMeteoService): Promise<{
|
|
7
|
+
content: Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=statusHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/statusHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,wBAAsB,wBAAwB,CAC5C,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+G7D"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for check_service_status tool
|
|
3
|
+
*/
|
|
4
|
+
import { CacheConfig } from '../config/cache.js';
|
|
5
|
+
export async function handleCheckServiceStatus(noaaService, openMeteoService) {
|
|
6
|
+
// Check status of both services
|
|
7
|
+
const noaaStatus = await noaaService.checkServiceStatus();
|
|
8
|
+
const openMeteoStatus = await openMeteoService.checkServiceStatus();
|
|
9
|
+
// Format the status report
|
|
10
|
+
let output = `# Weather API Service Status\n\n`;
|
|
11
|
+
output += `**Check Time:** ${new Date().toLocaleString()}\n\n`;
|
|
12
|
+
// NOAA Status
|
|
13
|
+
output += `## NOAA Weather API (Forecasts & Current Conditions)\n\n`;
|
|
14
|
+
output += `**Status:** ${noaaStatus.operational ? '✅ Operational' : '❌ Issues Detected'}\n`;
|
|
15
|
+
output += `**Message:** ${noaaStatus.message}\n`;
|
|
16
|
+
output += `**Status Page:** ${noaaStatus.statusPage}\n`;
|
|
17
|
+
output += `**Coverage:** United States locations only\n\n`;
|
|
18
|
+
if (!noaaStatus.operational) {
|
|
19
|
+
output += `**Recommended Actions:**\n`;
|
|
20
|
+
output += `- Check planned outages: https://weather-gov.github.io/api/planned-outages\n`;
|
|
21
|
+
output += `- View service notices: https://www.weather.gov/notification\n`;
|
|
22
|
+
output += `- Report issues: nco.ops@noaa.gov or (301) 683-1518\n\n`;
|
|
23
|
+
}
|
|
24
|
+
// Open-Meteo Status
|
|
25
|
+
output += `## Open-Meteo API (Historical Weather Data)\n\n`;
|
|
26
|
+
output += `**Status:** ${openMeteoStatus.operational ? '✅ Operational' : '❌ Issues Detected'}\n`;
|
|
27
|
+
output += `**Message:** ${openMeteoStatus.message}\n`;
|
|
28
|
+
output += `**Status Page:** ${openMeteoStatus.statusPage}\n`;
|
|
29
|
+
output += `**Coverage:** Global (worldwide locations)\n\n`;
|
|
30
|
+
if (!openMeteoStatus.operational) {
|
|
31
|
+
output += `**Recommended Actions:**\n`;
|
|
32
|
+
output += `- Check production status: https://open-meteo.com/en/docs/model-updates\n`;
|
|
33
|
+
output += `- View GitHub issues: https://github.com/open-meteo/open-meteo/issues\n`;
|
|
34
|
+
output += `- Review documentation: https://open-meteo.com/en/docs\n\n`;
|
|
35
|
+
}
|
|
36
|
+
// Cache Statistics
|
|
37
|
+
if (CacheConfig.enabled) {
|
|
38
|
+
output += `## Cache Statistics\n\n`;
|
|
39
|
+
const noaaStats = noaaService.getCacheStats();
|
|
40
|
+
const openMeteoStats = openMeteoService.getCacheStats();
|
|
41
|
+
const totalHits = noaaStats.hits + openMeteoStats.hits;
|
|
42
|
+
const totalMisses = noaaStats.misses + openMeteoStats.misses;
|
|
43
|
+
const totalRequests = totalHits + totalMisses;
|
|
44
|
+
const overallHitRate = totalRequests > 0 ? ((totalHits / totalRequests) * 100).toFixed(1) : '0.0';
|
|
45
|
+
output += `**Cache Status:** ✅ Enabled\n`;
|
|
46
|
+
output += `**Overall Hit Rate:** ${overallHitRate}%\n`;
|
|
47
|
+
output += `**Total Cache Hits:** ${totalHits}\n`;
|
|
48
|
+
output += `**Total Cache Misses:** ${totalMisses}\n`;
|
|
49
|
+
output += `**Total Requests:** ${totalRequests}\n\n`;
|
|
50
|
+
const noaaHitRate = (noaaStats.hits + noaaStats.misses) > 0
|
|
51
|
+
? ((noaaStats.hits / (noaaStats.hits + noaaStats.misses)) * 100).toFixed(1)
|
|
52
|
+
: '0.0';
|
|
53
|
+
const openMeteoHitRate = (openMeteoStats.hits + openMeteoStats.misses) > 0
|
|
54
|
+
? ((openMeteoStats.hits / (openMeteoStats.hits + openMeteoStats.misses)) * 100).toFixed(1)
|
|
55
|
+
: '0.0';
|
|
56
|
+
output += `### NOAA Service Cache\n`;
|
|
57
|
+
output += `- Entries: ${noaaStats.size} / ${noaaStats.maxSize}\n`;
|
|
58
|
+
output += `- Hit Rate: ${noaaHitRate}%\n`;
|
|
59
|
+
output += `- Hits: ${noaaStats.hits}\n`;
|
|
60
|
+
output += `- Misses: ${noaaStats.misses}\n`;
|
|
61
|
+
output += `- Evictions: ${noaaStats.evictions}\n\n`;
|
|
62
|
+
output += `### Open-Meteo Service Cache\n`;
|
|
63
|
+
output += `- Entries: ${openMeteoStats.size} / ${openMeteoStats.maxSize}\n`;
|
|
64
|
+
output += `- Hit Rate: ${openMeteoHitRate}%\n`;
|
|
65
|
+
output += `- Hits: ${openMeteoStats.hits}\n`;
|
|
66
|
+
output += `- Misses: ${openMeteoStats.misses}\n`;
|
|
67
|
+
output += `- Evictions: ${openMeteoStats.evictions}\n\n`;
|
|
68
|
+
output += `*Cache reduces API calls and improves performance for repeated queries.*\n\n`;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
output += `## Cache Statistics\n\n`;
|
|
72
|
+
output += `**Cache Status:** ❌ Disabled\n`;
|
|
73
|
+
output += `*Set CACHE_ENABLED=true in environment to enable caching.*\n\n`;
|
|
74
|
+
}
|
|
75
|
+
// Overall status summary
|
|
76
|
+
const bothOperational = noaaStatus.operational && openMeteoStatus.operational;
|
|
77
|
+
const neitherOperational = !noaaStatus.operational && !openMeteoStatus.operational;
|
|
78
|
+
if (bothOperational) {
|
|
79
|
+
output += `## Overall Status: ✅ All Services Operational\n\n`;
|
|
80
|
+
output += `Both NOAA and Open-Meteo APIs are functioning normally. Weather data requests should succeed.\n`;
|
|
81
|
+
}
|
|
82
|
+
else if (neitherOperational) {
|
|
83
|
+
output += `## Overall Status: ❌ Multiple Service Issues\n\n`;
|
|
84
|
+
output += `Both weather APIs are experiencing issues. Please check the status pages above for updates.\n`;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
output += `## Overall Status: ⚠️ Partial Service Availability\n\n`;
|
|
88
|
+
if (noaaStatus.operational) {
|
|
89
|
+
output += `NOAA API is operational: Forecasts and current conditions for US locations are available.\n`;
|
|
90
|
+
output += `Open-Meteo API has issues: Historical weather data may be unavailable.\n`;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
output += `Open-Meteo API is operational: Historical weather data is available globally.\n`;
|
|
94
|
+
output += `NOAA API has issues: Forecasts and current conditions for US locations may be unavailable.\n`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
content: [
|
|
99
|
+
{
|
|
100
|
+
type: 'text',
|
|
101
|
+
text: output
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=statusHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusHandler.js","sourceRoot":"","sources":["../../src/handlers/statusHandler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,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