Skip to main content
Glama
RyanCardin15

noaa-tidesandcurrents-mcp

get_currents

Retrieve currents data for a specific station by providing station ID, date range, time zone, and output format. Supports JSON, XML, and CSV formats.

Instructions

Get currents data for a station

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
begin_dateNoStart date (YYYYMMDD or MM/DD/YYYY)
binNoBin number
dateNoDate to retrieve data for ("today", "latest", "recent", or specific date)
end_dateNoEnd date (YYYYMMDD or MM/DD/YYYY)
formatNoOutput format (json, xml, csv)
rangeNoNumber of hours to retrieve data for
stationYesStation ID
time_zoneNoTime zone (gmt, lst, lst_ldt)
unitsNoUnits to use ("english" or "metric")

Implementation Reference

  • Core handler function that fetches currents data from the NOAA API by setting product='currents' and calling the internal fetchDataApi method.
    async getCurrents(params: Record<string, any>): Promise<any> {
      return this.fetchDataApi({
        ...params,
        product: 'currents'
      });
    }
  • Registers the 'get_currents' tool in the MCP server by defining an MCPTool object that delegates to noaaService.getCurrents.
    const getCurrents: MCPTool = {
      name: "get_currents",
      description: "Get currents data for a station",
      inputSchema: GetCurrentsSchema,
      handler: async (params) => {
        return this.noaaService.getCurrents(params);
      }
    };
  • Defines the Zod input schema (GetCurrentsSchema) for validating parameters to the get_currents tool.
    export const GetCurrentsSchema = z.object({
      station: StationSchema,
      date: DateSchema,
      begin_date: BeginDateSchema,
      end_date: EndDateSchema,
      range: RangeSchema,
      bin: BinSchema,
      units: UnitsSchema,
      time_zone: TimeZoneSchema,
      format: FormatSchema,
    }).refine(
      data => (data.date || (data.begin_date && data.end_date) || (data.begin_date && data.range) || (data.end_date && data.range) || data.range),
      { message: "You must provide either 'date', 'begin_date' and 'end_date', 'begin_date' and 'range', 'end_date' and 'range', or just 'range'" }
    );
  • Alternative registration of the 'get_currents' tool using FastMCP, with inline Zod schema and execution handler calling noaaService.getCurrents.
    server.addTool({
      name: 'get_currents',
      description: 'Get currents data for a station',
      parameters: z.object({
        station: StationSchema,
        date: DateSchema,
        begin_date: BeginDateSchema,
        end_date: EndDateSchema,
        range: RangeSchema,
        bin: BinSchema,
        units: UnitsSchema,
        time_zone: TimeZoneSchema,
        format: FormatSchema,
      }).refine(refineDateParams, { message: dateRefinementMessage }),
      execute: async (params) => {
        try {
          const result = await noaaService.getCurrents(params);
          return JSON.stringify(result);
        } catch (error) {
          if (error instanceof Error) {
            throw new Error(`Failed to get currents: ${error.message}`);
          }
          throw new Error('Failed to get currents');
        }
      }
    });

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