get_high_tide_flooding_likelihoods
Analyze daily high tide flooding probabilities by station, flood threshold, and date. Choose output format (json, xml, csv) and datum reference to assess flood risks.
Instructions
Get high tide flooding daily likelihoods for a station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Specific date (YYYYMMDD format) | |
| datum | No | Datum reference for DPAPI | |
| format | No | Output format (json, xml, csv) | |
| station | Yes | Station ID | |
| threshold | No | Flood threshold level |
Implementation Reference
- The tool's execute handler: thin wrapper that invokes the service method and returns JSON stringified result, with error handling.execute: async (params) => { try { const result = await dpapiService.getHighTideFloodingLikelihoods(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get high tide flooding likelihoods: ${error.message}`); } throw new Error('Failed to get high tide flooding likelihoods'); } }
- src/schemas/dpapi.ts:84-90 (schema)Zod schema defining input parameters for the tool: station, format, datum, threshold, optional date.export const HighTideFloodingLikelihoodsSchema = z.object({ station: StationSchema, format: FormatSchema, datum: DpapiDatumSchema, threshold: ThresholdSchema, date: z.string().optional().describe('Specific date (YYYYMMDD format)') }).describe('Get high tide flooding daily likelihoods');
- src/tools/derived-product-tools.ts:146-161 (registration)Registration of the tool with the MCP server using server.addTool, including name, description, schema, and handler.server.addTool({ name: 'get_high_tide_flooding_likelihoods', description: 'Get high tide flooding daily likelihoods for a station', parameters: HighTideFloodingLikelihoodsSchema, execute: async (params) => { try { const result = await dpapiService.getHighTideFloodingLikelihoods(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get high tide flooding likelihoods: ${error.message}`); } throw new Error('Failed to get high tide flooding likelihoods'); } } });
- Supporting service method in DpapiService that performs the actual API fetch to the /htf/likelihoods endpoint.async getHighTideFloodingLikelihoods(params: Record<string, any>): Promise<any> { const { station, format = 'json', ...rest } = params; return this.fetchDpapi('/htf/likelihoods', { station, format, ...rest }); }