Skip to main content
Glama

get_top_ten_water_levels

Retrieve the top ten highest or lowest water levels for a NOAA tide station, specifying output format, units, and datum reference for analysis.

Instructions

Get top ten highest or lowest water levels for a station

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysis_typeNoAnalysis type (highest or lowest)
datumNoDatum reference for DPAPI
formatNoOutput format (json, xml, csv)
stationYesStation ID
unitsNoUnits to use ("english" or "metric")

Implementation Reference

  • The execute handler function for the 'get_top_ten_water_levels' tool. It calls the DpapiService.getTopTenWaterLevels method with the input params, stringifies the result, and handles errors by throwing descriptive messages.
    execute: async (params) => { try { const result = await dpapiService.getTopTenWaterLevels(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get top ten water levels: ${error.message}`); } throw new Error('Failed to get top ten water levels'); }
  • Zod schema defining the input parameters for the 'get_top_ten_water_levels' tool, including required station, format, datum, units, and optional analysis_type.
    export const TopTenWaterLevelsSchema = z.object({ station: StationSchema, format: FormatSchema, datum: DpapiDatumSchema, units: UnitsSchema, analysis_type: z.enum(['highest', 'lowest']).optional().describe('Analysis type (highest or lowest)') }).describe('Get top ten water levels for a station');
  • Registration of the 'get_top_ten_water_levels' tool via server.addTool within the registerDerivedProductTools function.
    server.addTool({ name: 'get_top_ten_water_levels', description: 'Get top ten highest or lowest water levels for a station', parameters: TopTenWaterLevelsSchema, execute: async (params) => { try { const result = await dpapiService.getTopTenWaterLevels(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get top ten water levels: ${error.message}`); } throw new Error('Failed to get top ten water levels'); } } });
  • Helper method in DpapiService that prepares parameters and fetches data from the NOAA DPAPI /topten endpoint to get top ten water levels.
    async getTopTenWaterLevels(params: Record<string, any>): Promise<any> { const { station, format = 'json', ...rest } = params; return this.fetchDpapi('/topten', { station, format, ...rest }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RyanCardin15/NOAA'

If you have feedback or need assistance with the MCP directory API, please join our Discord server