@ryancardin/noaa-tides-currents-mcp-server 2.0.0 → 2.1.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/LICENSE +1 -1
  2. package/README.md +18 -5
  3. package/dist/client/deadline.d.ts +6 -0
  4. package/dist/client/deadline.js +23 -0
  5. package/dist/client/http.d.ts +2 -0
  6. package/dist/client/http.js +75 -4
  7. package/dist/constants.d.ts +11 -0
  8. package/dist/constants.js +11 -0
  9. package/dist/format/respond.d.ts +37 -1
  10. package/dist/format/respond.js +45 -10
  11. package/dist/index.js +0 -0
  12. package/dist/reference/content.d.ts +1 -1
  13. package/dist/reference/content.js +24 -0
  14. package/dist/resources/index.js +8 -0
  15. package/dist/services/nws-api.d.ts +115 -0
  16. package/dist/services/nws-api.js +267 -0
  17. package/dist/tools/astronomy.js +6 -1
  18. package/dist/tools/currents.js +3 -1
  19. package/dist/tools/derived.js +6 -1
  20. package/dist/tools/index.js +12 -0
  21. package/dist/tools/marine-forecast.d.ts +7 -0
  22. package/dist/tools/marine-forecast.js +177 -0
  23. package/dist/tools/met.js +2 -1
  24. package/dist/tools/reference.js +4 -0
  25. package/dist/tools/station-metadata.js +4 -1
  26. package/dist/tools/stations.js +4 -1
  27. package/dist/tools/water.js +4 -1
  28. package/package.json +6 -6
  29. package/dist/interfaces/config.d.ts +0 -6
  30. package/dist/interfaces/config.js +0 -1
  31. package/dist/interfaces/noaa.d.ts +0 -334
  32. package/dist/interfaces/noaa.js +0 -98
  33. package/dist/interfaces/parameters.d.ts +0 -18
  34. package/dist/interfaces/parameters.js +0 -5
  35. package/dist/mcp-server.d.ts +0 -12
  36. package/dist/mcp-server.js +0 -103
  37. package/dist/moon-phase-service.d.ts +0 -122
  38. package/dist/moon-phase-service.js +0 -187
  39. package/dist/noaa-service.d.ts +0 -60
  40. package/dist/noaa-service.js +0 -159
  41. package/dist/schemas/dpapi.d.ts +0 -198
  42. package/dist/schemas/dpapi.js +0 -89
  43. package/dist/server/config.d.ts +0 -9
  44. package/dist/server/config.js +0 -40
  45. package/dist/server/mcp-server.d.ts +0 -12
  46. package/dist/server/mcp-server.js +0 -103
  47. package/dist/services/dpapi-service.d.ts +0 -72
  48. package/dist/services/dpapi-service.js +0 -164
  49. package/dist/services/noaa-parameters-service.d.ts +0 -76
  50. package/dist/services/noaa-parameters-service.js +0 -128
  51. package/dist/services/noaa-service.d.ts +0 -52
  52. package/dist/services/noaa-service.js +0 -151
  53. package/dist/sun-service.d.ts +0 -184
  54. package/dist/sun-service.js +0 -218
  55. package/dist/tools/derived-product-tools.d.ts +0 -6
  56. package/dist/tools/derived-product-tools.js +0 -168
  57. package/dist/tools/moon-tools.d.ts +0 -6
  58. package/dist/tools/moon-tools.js +0 -69
  59. package/dist/tools/parameter-tools.d.ts +0 -6
  60. package/dist/tools/parameter-tools.js +0 -77
  61. package/dist/tools/station-tools.d.ts +0 -6
  62. package/dist/tools/station-tools.js +0 -51
  63. package/dist/tools/sun-tools.d.ts +0 -6
  64. package/dist/tools/sun-tools.js +0 -109
  65. package/dist/tools/water-tools.d.ts +0 -6
  66. package/dist/tools/water-tools.js +0 -150
  67. package/dist/types.d.ts +0 -337
  68. package/dist/types.js +0 -98
@@ -1,184 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Sun event types
4
- */
5
- export declare enum SunEventType {
6
- SUNRISE = "sunrise",
7
- SUNSET = "sunset",
8
- DAWN = "dawn",
9
- DUSK = "dusk",
10
- SOLAR_NOON = "solarNoon",
11
- NIGHT_START = "night",
12
- NIGHT_END = "nightEnd",
13
- GOLDEN_HOUR_START = "goldenHourStart",
14
- GOLDEN_HOUR_END = "goldenHourEnd",
15
- NAUTICAL_DAWN = "nauticalDawn",
16
- NAUTICAL_DUSK = "nauticalDusk",
17
- ASTRONOMICAL_DAWN = "astronomicalDawn",
18
- ASTRONOMICAL_DUSK = "astronomicalDusk"
19
- }
20
- /**
21
- * Sun times information
22
- */
23
- export interface SunTimesInfo {
24
- date: string;
25
- sunrise: string | null;
26
- sunset: string | null;
27
- solarNoon: string | null;
28
- dawn: string | null;
29
- dusk: string | null;
30
- nightStart: string | null;
31
- nightEnd: string | null;
32
- goldenHourStart: string | null;
33
- goldenHourEnd: string | null;
34
- nauticalDawn: string | null;
35
- nauticalDusk: string | null;
36
- astronomicalDawn: string | null;
37
- astronomicalDusk: string | null;
38
- dayLength: number;
39
- }
40
- /**
41
- * Sun position information
42
- */
43
- export interface SunPositionInfo {
44
- date: string;
45
- time: string;
46
- azimuth: number;
47
- altitude: number;
48
- declination: number;
49
- rightAscension: number;
50
- }
51
- /**
52
- * Parameters for getting sun times
53
- */
54
- export declare const SunTimesParamsSchema: z.ZodObject<{
55
- date: z.ZodOptional<z.ZodString>;
56
- latitude: z.ZodNumber;
57
- longitude: z.ZodNumber;
58
- format: z.ZodOptional<z.ZodEnum<["json", "text"]>>;
59
- timezone: z.ZodOptional<z.ZodString>;
60
- }, "strip", z.ZodTypeAny, {
61
- latitude: number;
62
- longitude: number;
63
- date?: string | undefined;
64
- format?: "text" | "json" | undefined;
65
- timezone?: string | undefined;
66
- }, {
67
- latitude: number;
68
- longitude: number;
69
- date?: string | undefined;
70
- format?: "text" | "json" | undefined;
71
- timezone?: string | undefined;
72
- }>;
73
- export type SunTimesParams = z.infer<typeof SunTimesParamsSchema>;
74
- /**
75
- * Parameters for getting sun times for a date range
76
- */
77
- export declare const SunTimesRangeParamsSchema: z.ZodObject<{
78
- start_date: z.ZodString;
79
- end_date: z.ZodString;
80
- latitude: z.ZodNumber;
81
- longitude: z.ZodNumber;
82
- format: z.ZodOptional<z.ZodEnum<["json", "text"]>>;
83
- timezone: z.ZodOptional<z.ZodString>;
84
- }, "strip", z.ZodTypeAny, {
85
- latitude: number;
86
- longitude: number;
87
- start_date: string;
88
- end_date: string;
89
- format?: "text" | "json" | undefined;
90
- timezone?: string | undefined;
91
- }, {
92
- latitude: number;
93
- longitude: number;
94
- start_date: string;
95
- end_date: string;
96
- format?: "text" | "json" | undefined;
97
- timezone?: string | undefined;
98
- }>;
99
- export type SunTimesRangeParams = z.infer<typeof SunTimesRangeParamsSchema>;
100
- /**
101
- * Parameters for getting sun position
102
- */
103
- export declare const SunPositionParamsSchema: z.ZodObject<{
104
- date: z.ZodOptional<z.ZodString>;
105
- time: z.ZodOptional<z.ZodString>;
106
- latitude: z.ZodNumber;
107
- longitude: z.ZodNumber;
108
- format: z.ZodOptional<z.ZodEnum<["json", "text"]>>;
109
- }, "strip", z.ZodTypeAny, {
110
- latitude: number;
111
- longitude: number;
112
- time?: string | undefined;
113
- date?: string | undefined;
114
- format?: "text" | "json" | undefined;
115
- }, {
116
- latitude: number;
117
- longitude: number;
118
- time?: string | undefined;
119
- date?: string | undefined;
120
- format?: "text" | "json" | undefined;
121
- }>;
122
- export type SunPositionParams = z.infer<typeof SunPositionParamsSchema>;
123
- /**
124
- * Parameters for finding the next sun event
125
- */
126
- export declare const NextSunEventParamsSchema: z.ZodObject<{
127
- event: z.ZodNativeEnum<typeof SunEventType>;
128
- date: z.ZodOptional<z.ZodString>;
129
- latitude: z.ZodNumber;
130
- longitude: z.ZodNumber;
131
- count: z.ZodOptional<z.ZodNumber>;
132
- format: z.ZodOptional<z.ZodEnum<["json", "text"]>>;
133
- timezone: z.ZodOptional<z.ZodString>;
134
- }, "strip", z.ZodTypeAny, {
135
- event: SunEventType;
136
- latitude: number;
137
- longitude: number;
138
- date?: string | undefined;
139
- format?: "text" | "json" | undefined;
140
- count?: number | undefined;
141
- timezone?: string | undefined;
142
- }, {
143
- event: SunEventType;
144
- latitude: number;
145
- longitude: number;
146
- date?: string | undefined;
147
- format?: "text" | "json" | undefined;
148
- count?: number | undefined;
149
- timezone?: string | undefined;
150
- }>;
151
- export type NextSunEventParams = z.infer<typeof NextSunEventParamsSchema>;
152
- /**
153
- * Service for sun calculations
154
- */
155
- export declare class SunService {
156
- /**
157
- * Get sun times for a specific date and location
158
- * @param params Parameters for the request
159
- * @returns Sun times information
160
- */
161
- getSunTimes(params: SunTimesParams): SunTimesInfo;
162
- /**
163
- * Get sun times for a date range
164
- * @param params Parameters for the request
165
- * @returns Array of sun times information
166
- */
167
- getSunTimesRange(params: SunTimesRangeParams): SunTimesInfo[];
168
- /**
169
- * Get sun position for a specific date, time, and location
170
- * @param params Parameters for the request
171
- * @returns Sun position information
172
- */
173
- getSunPosition(params: SunPositionParams): SunPositionInfo;
174
- /**
175
- * Get the next occurrence(s) of a specific sun event
176
- * @param params Parameters for the request
177
- * @returns Array of dates for the next occurrences of the specified event
178
- */
179
- getNextSunEvent(params: NextSunEventParams): {
180
- date: string;
181
- time: string;
182
- event: string;
183
- }[];
184
- }
@@ -1,218 +0,0 @@
1
- import SunCalc from 'suncalc';
2
- import { z } from 'zod';
3
- /**
4
- * Sun event types
5
- */
6
- export var SunEventType;
7
- (function (SunEventType) {
8
- SunEventType["SUNRISE"] = "sunrise";
9
- SunEventType["SUNSET"] = "sunset";
10
- SunEventType["DAWN"] = "dawn";
11
- SunEventType["DUSK"] = "dusk";
12
- SunEventType["SOLAR_NOON"] = "solarNoon";
13
- SunEventType["NIGHT_START"] = "night";
14
- SunEventType["NIGHT_END"] = "nightEnd";
15
- SunEventType["GOLDEN_HOUR_START"] = "goldenHourStart";
16
- SunEventType["GOLDEN_HOUR_END"] = "goldenHourEnd";
17
- SunEventType["NAUTICAL_DAWN"] = "nauticalDawn";
18
- SunEventType["NAUTICAL_DUSK"] = "nauticalDusk";
19
- SunEventType["ASTRONOMICAL_DAWN"] = "astronomicalDawn";
20
- SunEventType["ASTRONOMICAL_DUSK"] = "astronomicalDusk";
21
- })(SunEventType || (SunEventType = {}));
22
- /**
23
- * Parameters for getting sun times
24
- */
25
- export const SunTimesParamsSchema = z.object({
26
- date: z.string().optional().describe('Date to get sun times for (YYYY-MM-DD format). Defaults to current date.'),
27
- latitude: z.number().min(-90).max(90).describe('Latitude for location-specific calculations'),
28
- longitude: z.number().min(-180).max(180).describe('Longitude for location-specific calculations'),
29
- format: z.enum(['json', 'text']).optional().describe('Output format (json or text)'),
30
- timezone: z.string().optional().describe('Timezone for the results. Defaults to UTC.')
31
- });
32
- /**
33
- * Parameters for getting sun times for a date range
34
- */
35
- export const SunTimesRangeParamsSchema = z.object({
36
- start_date: z.string().describe('Start date (YYYY-MM-DD format)'),
37
- end_date: z.string().describe('End date (YYYY-MM-DD format)'),
38
- latitude: z.number().min(-90).max(90).describe('Latitude for location-specific calculations'),
39
- longitude: z.number().min(-180).max(180).describe('Longitude for location-specific calculations'),
40
- format: z.enum(['json', 'text']).optional().describe('Output format (json or text)'),
41
- timezone: z.string().optional().describe('Timezone for the results. Defaults to UTC.')
42
- });
43
- /**
44
- * Parameters for getting sun position
45
- */
46
- export const SunPositionParamsSchema = z.object({
47
- date: z.string().optional().describe('Date to get sun position for (YYYY-MM-DD format). Defaults to current date.'),
48
- time: z.string().optional().describe('Time to get sun position for (HH:MM:SS format). Defaults to current time.'),
49
- latitude: z.number().min(-90).max(90).describe('Latitude for location-specific calculations'),
50
- longitude: z.number().min(-180).max(180).describe('Longitude for location-specific calculations'),
51
- format: z.enum(['json', 'text']).optional().describe('Output format (json or text)')
52
- });
53
- /**
54
- * Parameters for finding the next sun event
55
- */
56
- export const NextSunEventParamsSchema = z.object({
57
- event: z.nativeEnum(SunEventType).describe('Sun event to find'),
58
- date: z.string().optional().describe('Starting date (YYYY-MM-DD format). Defaults to current date.'),
59
- latitude: z.number().min(-90).max(90).describe('Latitude for location-specific calculations'),
60
- longitude: z.number().min(-180).max(180).describe('Longitude for location-specific calculations'),
61
- count: z.number().positive().optional().describe('Number of occurrences to return. Defaults to 1.'),
62
- format: z.enum(['json', 'text']).optional().describe('Output format (json or text)'),
63
- timezone: z.string().optional().describe('Timezone for the results. Defaults to UTC.')
64
- });
65
- /**
66
- * Service for sun calculations
67
- */
68
- export class SunService {
69
- /**
70
- * Get sun times for a specific date and location
71
- * @param params Parameters for the request
72
- * @returns Sun times information
73
- */
74
- getSunTimes(params) {
75
- const date = params.date ? new Date(params.date) : new Date();
76
- const { latitude, longitude } = params;
77
- // Get sun times data
78
- const sunTimes = SunCalc.getTimes(date, latitude, longitude);
79
- // Format times or return null if not available
80
- const formatTime = (time) => {
81
- if (!time || isNaN(time.getTime()))
82
- return null;
83
- if (params.timezone) {
84
- try {
85
- return time.toLocaleTimeString('en-US', { timeZone: params.timezone });
86
- }
87
- catch (error) {
88
- // If timezone is invalid, fall back to ISO string
89
- console.warn(`Invalid timezone: ${params.timezone}. Using UTC.`);
90
- }
91
- }
92
- return time.toISOString();
93
- };
94
- // Calculate day length in minutes
95
- const sunrise = sunTimes.sunrise;
96
- const sunset = sunTimes.sunset;
97
- let dayLength = 0;
98
- if (sunrise && sunset && !isNaN(sunrise.getTime()) && !isNaN(sunset.getTime())) {
99
- dayLength = (sunset.getTime() - sunrise.getTime()) / (60 * 1000);
100
- }
101
- return {
102
- date: date.toISOString().split('T')[0],
103
- sunrise: formatTime(sunTimes.sunrise),
104
- sunset: formatTime(sunTimes.sunset),
105
- solarNoon: formatTime(sunTimes.solarNoon),
106
- dawn: formatTime(sunTimes.dawn),
107
- dusk: formatTime(sunTimes.dusk),
108
- nightStart: formatTime(sunTimes.night),
109
- nightEnd: formatTime(sunTimes.nightEnd),
110
- goldenHourStart: formatTime(sunTimes.goldenHour),
111
- goldenHourEnd: formatTime(sunTimes.goldenHourEnd),
112
- nauticalDawn: formatTime(sunTimes.nauticalDawn),
113
- nauticalDusk: formatTime(sunTimes.nauticalDusk),
114
- astronomicalDawn: formatTime(sunTimes.astronomicalDawn),
115
- astronomicalDusk: formatTime(sunTimes.astronomicalDusk),
116
- dayLength
117
- };
118
- }
119
- /**
120
- * Get sun times for a date range
121
- * @param params Parameters for the request
122
- * @returns Array of sun times information
123
- */
124
- getSunTimesRange(params) {
125
- const startDate = new Date(params.start_date);
126
- const endDate = new Date(params.end_date);
127
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
128
- throw new Error('Invalid date format. Please use YYYY-MM-DD format.');
129
- }
130
- if (startDate > endDate) {
131
- throw new Error('Start date must be before end date.');
132
- }
133
- const result = [];
134
- const currentDate = new Date(startDate);
135
- while (currentDate <= endDate) {
136
- result.push(this.getSunTimes({
137
- date: currentDate.toISOString().split('T')[0],
138
- latitude: params.latitude,
139
- longitude: params.longitude,
140
- timezone: params.timezone
141
- }));
142
- // Move to next day
143
- currentDate.setDate(currentDate.getDate() + 1);
144
- }
145
- return result;
146
- }
147
- /**
148
- * Get sun position for a specific date, time, and location
149
- * @param params Parameters for the request
150
- * @returns Sun position information
151
- */
152
- getSunPosition(params) {
153
- const date = params.date ? new Date(params.date) : new Date();
154
- // If time is provided, set it on the date object
155
- if (params.time) {
156
- const [hours, minutes, seconds] = params.time.split(':').map(Number);
157
- date.setHours(hours || 0, minutes || 0, seconds || 0);
158
- }
159
- const { latitude, longitude } = params;
160
- // Get sun position data
161
- const position = SunCalc.getPosition(date, latitude, longitude);
162
- // Calculate additional astronomical data
163
- const declination = Math.asin(Math.sin(23.44 * Math.PI / 180) * Math.sin(position.azimuth));
164
- const rightAscension = Math.atan2(Math.cos(23.44 * Math.PI / 180) * Math.sin(position.azimuth), Math.cos(position.azimuth));
165
- return {
166
- date: date.toISOString().split('T')[0],
167
- time: date.toISOString().split('T')[1].split('.')[0],
168
- azimuth: position.azimuth * (180 / Math.PI), // Convert to degrees
169
- altitude: position.altitude * (180 / Math.PI), // Convert to degrees
170
- declination: declination * (180 / Math.PI), // Convert to degrees
171
- rightAscension: rightAscension * (180 / Math.PI) // Convert to degrees
172
- };
173
- }
174
- /**
175
- * Get the next occurrence(s) of a specific sun event
176
- * @param params Parameters for the request
177
- * @returns Array of dates for the next occurrences of the specified event
178
- */
179
- getNextSunEvent(params) {
180
- const startDate = params.date ? new Date(params.date) : new Date();
181
- const count = params.count || 1;
182
- const { latitude, longitude, event } = params;
183
- const results = [];
184
- let currentDate = new Date(startDate);
185
- // Find the next occurrences
186
- while (results.length < count) {
187
- // Get sun times for the current date
188
- const sunTimes = SunCalc.getTimes(currentDate, latitude, longitude);
189
- const eventTime = sunTimes[event];
190
- // If the event time is valid and in the future
191
- if (eventTime && !isNaN(eventTime.getTime()) && eventTime > startDate) {
192
- let timeString = eventTime.toISOString();
193
- // Format time based on timezone if provided
194
- if (params.timezone) {
195
- try {
196
- timeString = eventTime.toLocaleTimeString('en-US', { timeZone: params.timezone });
197
- }
198
- catch (error) {
199
- // If timezone is invalid, fall back to ISO string
200
- console.warn(`Invalid timezone: ${params.timezone}. Using UTC.`);
201
- }
202
- }
203
- results.push({
204
- date: eventTime.toISOString().split('T')[0],
205
- time: timeString.split('T')[1]?.split('.')[0] || timeString,
206
- event
207
- });
208
- }
209
- // Move to next day
210
- currentDate.setDate(currentDate.getDate() + 1);
211
- // Safety check to prevent infinite loops
212
- if (results.length === 0 && currentDate.getTime() - startDate.getTime() > 366 * 24 * 60 * 60 * 1000) {
213
- throw new Error('Could not find the specified sun event within a year.');
214
- }
215
- }
216
- return results;
217
- }
218
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { DpapiService } from '../services/dpapi-service.js';
3
- /**
4
- * Register derived product tools with the MCP server
5
- */
6
- export declare function registerDerivedProductTools(server: FastMCP, dpapiService: DpapiService): void;
@@ -1,168 +0,0 @@
1
- import { SeaLevelTrendsSchema, ExtremeWaterLevelsSchema, HighTideFloodingDailySchema, HighTideFloodingMonthlySchema, HighTideFloodingSeasonalSchema, HighTideFloodingAnnualSchema, HighTideFloodingProjectionsSchema, HighTideFloodingLikelihoodsSchema, TopTenWaterLevelsSchema } from '../schemas/dpapi.js';
2
- /**
3
- * Register derived product tools with the MCP server
4
- */
5
- export function registerDerivedProductTools(server, dpapiService) {
6
- // Sea Level Trends tool
7
- server.addTool({
8
- name: 'get_sea_level_trends',
9
- description: 'Get sea level trends and error margins for a station',
10
- parameters: SeaLevelTrendsSchema,
11
- execute: async (params) => {
12
- try {
13
- const result = await dpapiService.getSeaLevelTrends(params);
14
- return JSON.stringify(result);
15
- }
16
- catch (error) {
17
- if (error instanceof Error) {
18
- throw new Error(`Failed to get sea level trends: ${error.message}`);
19
- }
20
- throw new Error('Failed to get sea level trends');
21
- }
22
- }
23
- });
24
- // Extreme Water Levels tool
25
- server.addTool({
26
- name: 'get_extreme_water_levels',
27
- description: 'Get extreme water levels and exceedance probabilities for a station',
28
- parameters: ExtremeWaterLevelsSchema,
29
- execute: async (params) => {
30
- try {
31
- const result = await dpapiService.getExtremeWaterLevels(params);
32
- return JSON.stringify(result);
33
- }
34
- catch (error) {
35
- if (error instanceof Error) {
36
- throw new Error(`Failed to get extreme water levels: ${error.message}`);
37
- }
38
- throw new Error('Failed to get extreme water levels');
39
- }
40
- }
41
- });
42
- // High Tide Flooding Daily tool
43
- server.addTool({
44
- name: 'get_high_tide_flooding_daily',
45
- description: 'Get high tide flooding daily count data for a station',
46
- parameters: HighTideFloodingDailySchema,
47
- execute: async (params) => {
48
- try {
49
- const result = await dpapiService.getHighTideFloodingDaily(params);
50
- return JSON.stringify(result);
51
- }
52
- catch (error) {
53
- if (error instanceof Error) {
54
- throw new Error(`Failed to get high tide flooding daily data: ${error.message}`);
55
- }
56
- throw new Error('Failed to get high tide flooding daily data');
57
- }
58
- }
59
- });
60
- // High Tide Flooding Monthly tool
61
- server.addTool({
62
- name: 'get_high_tide_flooding_monthly',
63
- description: 'Get high tide flooding monthly count data for a station',
64
- parameters: HighTideFloodingMonthlySchema,
65
- execute: async (params) => {
66
- try {
67
- const result = await dpapiService.getHighTideFloodingMonthly(params);
68
- return JSON.stringify(result);
69
- }
70
- catch (error) {
71
- if (error instanceof Error) {
72
- throw new Error(`Failed to get high tide flooding monthly data: ${error.message}`);
73
- }
74
- throw new Error('Failed to get high tide flooding monthly data');
75
- }
76
- }
77
- });
78
- // High Tide Flooding Seasonal tool
79
- server.addTool({
80
- name: 'get_high_tide_flooding_seasonal',
81
- description: 'Get high tide flooding seasonal count data for a station',
82
- parameters: HighTideFloodingSeasonalSchema,
83
- execute: async (params) => {
84
- try {
85
- const result = await dpapiService.getHighTideFloodingSeasonal(params);
86
- return JSON.stringify(result);
87
- }
88
- catch (error) {
89
- if (error instanceof Error) {
90
- throw new Error(`Failed to get high tide flooding seasonal data: ${error.message}`);
91
- }
92
- throw new Error('Failed to get high tide flooding seasonal data');
93
- }
94
- }
95
- });
96
- // High Tide Flooding Annual tool
97
- server.addTool({
98
- name: 'get_high_tide_flooding_annual',
99
- description: 'Get high tide flooding annual count data for a station',
100
- parameters: HighTideFloodingAnnualSchema,
101
- execute: async (params) => {
102
- try {
103
- const result = await dpapiService.getHighTideFloodingAnnual(params);
104
- return JSON.stringify(result);
105
- }
106
- catch (error) {
107
- if (error instanceof Error) {
108
- throw new Error(`Failed to get high tide flooding annual data: ${error.message}`);
109
- }
110
- throw new Error('Failed to get high tide flooding annual data');
111
- }
112
- }
113
- });
114
- // High Tide Flooding Projections tool
115
- server.addTool({
116
- name: 'get_high_tide_flooding_projections',
117
- description: 'Get high tide flooding decadal projections for sea level rise scenarios',
118
- parameters: HighTideFloodingProjectionsSchema,
119
- execute: async (params) => {
120
- try {
121
- const result = await dpapiService.getHighTideFloodingProjections(params);
122
- return JSON.stringify(result);
123
- }
124
- catch (error) {
125
- if (error instanceof Error) {
126
- throw new Error(`Failed to get high tide flooding projections: ${error.message}`);
127
- }
128
- throw new Error('Failed to get high tide flooding projections');
129
- }
130
- }
131
- });
132
- // High Tide Flooding Likelihoods tool
133
- server.addTool({
134
- name: 'get_high_tide_flooding_likelihoods',
135
- description: 'Get high tide flooding daily likelihoods for a station',
136
- parameters: HighTideFloodingLikelihoodsSchema,
137
- execute: async (params) => {
138
- try {
139
- const result = await dpapiService.getHighTideFloodingLikelihoods(params);
140
- return JSON.stringify(result);
141
- }
142
- catch (error) {
143
- if (error instanceof Error) {
144
- throw new Error(`Failed to get high tide flooding likelihoods: ${error.message}`);
145
- }
146
- throw new Error('Failed to get high tide flooding likelihoods');
147
- }
148
- }
149
- });
150
- // Top Ten Water Levels tool
151
- server.addTool({
152
- name: 'get_top_ten_water_levels',
153
- description: 'Get top ten highest or lowest water levels for a station',
154
- parameters: TopTenWaterLevelsSchema,
155
- execute: async (params) => {
156
- try {
157
- const result = await dpapiService.getTopTenWaterLevels(params);
158
- return JSON.stringify(result);
159
- }
160
- catch (error) {
161
- if (error instanceof Error) {
162
- throw new Error(`Failed to get top ten water levels: ${error.message}`);
163
- }
164
- throw new Error('Failed to get top ten water levels');
165
- }
166
- }
167
- });
168
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { MoonPhaseService } from '../services/moon-phase-service.js';
3
- /**
4
- * Register moon-related tools with the MCP server
5
- */
6
- export declare function registerMoonTools(server: FastMCP, moonPhaseService: MoonPhaseService): void;
@@ -1,69 +0,0 @@
1
- import { MoonPhaseParamsSchema, MoonPhasesRangeParamsSchema, NextMoonPhaseParamsSchema } from '../interfaces/moon.js';
2
- /**
3
- * Register moon-related tools with the MCP server
4
- */
5
- export function registerMoonTools(server, moonPhaseService) {
6
- // Add moon phase tool
7
- server.addTool({
8
- name: 'get_moon_phase',
9
- description: 'Get moon phase information for a specific date',
10
- parameters: MoonPhaseParamsSchema,
11
- execute: async (params) => {
12
- try {
13
- const result = moonPhaseService.getMoonPhase(params);
14
- if (params.format === 'text') {
15
- return `Moon phase for ${result.date}: ${result.phaseName} (${(result.illumination * 100).toFixed(1)}% illuminated)`;
16
- }
17
- return JSON.stringify(result);
18
- }
19
- catch (error) {
20
- if (error instanceof Error) {
21
- throw new Error(`Failed to get moon phase: ${error.message}`);
22
- }
23
- throw new Error('Failed to get moon phase');
24
- }
25
- }
26
- });
27
- // Add moon phases range tool
28
- server.addTool({
29
- name: 'get_moon_phases_range',
30
- description: 'Get moon phase information for a date range',
31
- parameters: MoonPhasesRangeParamsSchema,
32
- execute: async (params) => {
33
- try {
34
- const results = moonPhaseService.getMoonPhasesRange(params);
35
- if (params.format === 'text') {
36
- return results.map(result => `${result.date}: ${result.phaseName} (${(result.illumination * 100).toFixed(1)}% illuminated)`).join('\n');
37
- }
38
- return JSON.stringify(results);
39
- }
40
- catch (error) {
41
- if (error instanceof Error) {
42
- throw new Error(`Failed to get moon phases: ${error.message}`);
43
- }
44
- throw new Error('Failed to get moon phases');
45
- }
46
- }
47
- });
48
- // Add next moon phase tool
49
- server.addTool({
50
- name: 'get_next_moon_phase',
51
- description: 'Get the next occurrence(s) of a specific moon phase',
52
- parameters: NextMoonPhaseParamsSchema,
53
- execute: async (params) => {
54
- try {
55
- const results = moonPhaseService.getNextMoonPhase(params);
56
- if (params.format === 'text') {
57
- return results.map(result => `Next ${result.phase}: ${result.date}`).join('\n');
58
- }
59
- return JSON.stringify(results);
60
- }
61
- catch (error) {
62
- if (error instanceof Error) {
63
- throw new Error(`Failed to get next moon phase: ${error.message}`);
64
- }
65
- throw new Error('Failed to get next moon phase');
66
- }
67
- }
68
- });
69
- }
@@ -1,6 +0,0 @@
1
- import { FastMCP } from 'fastmcp';
2
- import { NoaaParametersService } from '../services/noaa-parameters-service.js';
3
- /**
4
- * Register parameter tools with the MCP server
5
- */
6
- export declare function registerParameterTools(server: FastMCP, parametersService: NoaaParametersService): void;