get_sea_level_trends
Retrieve sea level trends and error margins for a specific station in JSON, XML, or CSV format using the LocalTides MCP Server tool, designed for analyzing water level data efficiently.
Instructions
Get sea level trends and error margins for a station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| affil | No | Station affiliation (Global or US) | |
| format | No | Output format (json, xml, csv) | |
| station | Yes | Station ID |
Implementation Reference
- src/tools/derived-product-tools.ts:24-34 (handler)The execute handler function for the 'get_sea_level_trends' tool. It calls the DpapiService.getSeaLevelTrends method with the input params, stringifies the result, and includes error handling.execute: async (params) => { try { const result = await dpapiService.getSeaLevelTrends(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get sea level trends: ${error.message}`); } throw new Error('Failed to get sea level trends'); } }
- src/schemas/dpapi.ts:15-19 (schema)Zod schema defining the input parameters for the get_sea_level_trends tool: station (required), affil (optional), format (optional).export const SeaLevelTrendsSchema = z.object({ station: StationSchema, affil: AffiliationSchema, format: FormatSchema }).describe('Get sea level trends for a station');
- src/tools/derived-product-tools.ts:20-35 (registration)Registration of the 'get_sea_level_trends' tool on the FastMCP server within the registerDerivedProductTools function.server.addTool({ name: 'get_sea_level_trends', description: 'Get sea level trends and error margins for a station', parameters: SeaLevelTrendsSchema, execute: async (params) => { try { const result = await dpapiService.getSeaLevelTrends(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get sea level trends: ${error.message}`); } throw new Error('Failed to get sea level trends'); } } });
- src/services/dpapi-service.ts:55-64 (helper)Helper service method in DpapiService that performs the actual API request to NOAA's DPAPI /sltrends endpoint for sea level trends data.async getSeaLevelTrends(params: Record<string, any>): Promise<any> { const { station, affil = 'Global', format = 'json', ...rest } = params; return this.fetchDpapi('/sltrends', { station, affil, format, ...rest }); }