Skip to main content
Glama
RyanCardin15

LocalTides MCP Server

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
NameRequiredDescriptionDefault
affilNoStation affiliation (Global or US)
formatNoOutput format (json, xml, csv)
stationYesStation ID

Implementation Reference

  • 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');
      }
    }
  • 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');
  • 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');
        }
      }
    });
  • 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
      });
    }

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-TidesAndCurrents-MCP'

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