get_extreme_water_levels
Retrieve extreme water levels and exceedance probabilities for a specified station in JSON, XML, or CSV format using the LocalTides MCP Server. Supports both English and metric units.
Instructions
Get extreme water levels and exceedance probabilities for a station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Output format (json, xml, csv) | |
| station | Yes | Station ID | |
| units | No | Units to use ("english" or "metric") |
Implementation Reference
- src/tools/derived-product-tools.ts:38-53 (registration)Registration of the 'get_extreme_water_levels' tool using server.addTool, including name, description, parameters schema, and execute handler.server.addTool({ name: 'get_extreme_water_levels', description: 'Get extreme water levels and exceedance probabilities for a station', parameters: ExtremeWaterLevelsSchema, execute: async (params) => { try { const result = await dpapiService.getExtremeWaterLevels(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get extreme water levels: ${error.message}`); } throw new Error('Failed to get extreme water levels'); } } });
- src/tools/derived-product-tools.ts:42-52 (handler)The execute handler function for the tool, which delegates to the DPAPI service and handles errors.execute: async (params) => { try { const result = await dpapiService.getExtremeWaterLevels(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get extreme water levels: ${error.message}`); } throw new Error('Failed to get extreme water levels'); } }
- src/schemas/dpapi.ts:22-26 (schema)Zod schema defining the input parameters for the get_extreme_water_levels tool: station, units, and format.export const ExtremeWaterLevelsSchema = z.object({ station: StationSchema, units: UnitsSchema, format: FormatSchema }).describe('Get extreme water levels for a station');
- src/services/dpapi-service.ts:71-80 (helper)Helper method in DpapiService that constructs the API request to NOAA's /ewl endpoint for extreme water levels data.async getExtremeWaterLevels(params: Record<string, any>): Promise<any> { const { station, units = 'english', format = 'json', ...rest } = params; return this.fetchDpapi('/ewl', { station, units, format, ...rest }); }