get_current_predictions
Retrieve real-time tide and current predictions for specific stations using NOAA Tides and Currents API. Specify station ID, date range, interval, units, and time zone to fetch data in JSON, XML, or CSV format.
Instructions
Get current predictions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| begin_date | No | Start date (YYYYMMDD or MM/DD/YYYY) | |
| bin | No | Bin number | |
| date | No | Date to retrieve data for ("today", "latest", "recent", or specific date) | |
| end_date | No | End date (YYYYMMDD or MM/DD/YYYY) | |
| format | No | Output format (json, xml, csv) | |
| interval | No | Interval (MAX_SLACK or a number for minutes) | |
| range | No | Number of hours to retrieve data for | |
| station | Yes | Station ID | |
| time_zone | No | Time zone (gmt, lst, lst_ldt) | |
| units | No | Units to use ("english" or "metric") | |
| vel_type | No | Velocity type (speed_dir or default) |
Implementation Reference
- src/services/noaa-service.ts:104-109 (handler)Core handler function in NoaaService that executes the NOAA API call for current predictions by setting product to 'currents_predictions' and delegating to fetchDataApi.async getCurrentPredictions(params: Record<string, any>): Promise<any> { return this.fetchDataApi({ ...params, product: 'currents_predictions' }); }
- src/interfaces/noaa.ts:66-81 (schema)Zod input schema for the get_current_predictions tool, validating parameters like station, date ranges, bin, interval, with refinement ensuring date parameters are provided.export const GetCurrentPredictionsSchema = z.object({ station: StationSchema, date: DateSchema, begin_date: BeginDateSchema, end_date: EndDateSchema, range: RangeSchema, bin: BinSchema, interval: z.string().optional().describe('Interval (MAX_SLACK or a number for minutes)'), vel_type: z.enum(['speed_dir', 'default']).optional().describe('Velocity type (speed_dir or default)'), units: UnitsSchema, time_zone: TimeZoneSchema, format: FormatSchema, }).refine( data => (data.date || (data.begin_date && data.end_date) || (data.begin_date && data.range) || (data.end_date && data.range) || data.range), { message: "You must provide either 'date', 'begin_date' and 'end_date', 'begin_date' and 'range', 'end_date' and 'range', or just 'range'" } );
- src/server/mcp-server.ts:64-71 (registration)Tool registration in McpServer class: defines the MCPTool object for get_current_predictions, including name, description, input schema, and handler that calls NoaaService.getCurrentPredictions.const getCurrentPredictions: MCPTool = { name: "get_current_predictions", description: "Get current predictions", inputSchema: GetCurrentPredictionsSchema, handler: async (params) => { return this.noaaService.getCurrentPredictions(params); } };
- src/tools/water-tools.ts:110-137 (registration)Alternative tool registration using FastMCP server.addTool for get_current_predictions, with inline Zod parameters schema and execute function that calls NoaaService and stringifies result.server.addTool({ name: 'get_current_predictions', description: 'Get current predictions', parameters: z.object({ station: StationSchema, date: DateSchema, begin_date: BeginDateSchema, end_date: EndDateSchema, range: RangeSchema, bin: BinSchema, interval: z.string().optional().describe('Interval (MAX_SLACK or a number for minutes)'), vel_type: z.enum(['speed_dir', 'default']).optional().describe('Velocity type (speed_dir or default)'), units: UnitsSchema, time_zone: TimeZoneSchema, format: FormatSchema, }).refine(refineDateParams, { message: dateRefinementMessage }), execute: async (params) => { try { const result = await noaaService.getCurrentPredictions(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get current predictions: ${error.message}`); } throw new Error('Failed to get current predictions'); } } });