Skip to main content
Glama
RyanCardin15

noaa-tidesandcurrents-mcp

get_meteorological_data

Retrieve meteorological data from NOAA Tides and Currents API by specifying station, product (e.g., air_temperature, wind), date range, units, time zone, and output format (JSON, XML, CSV).

Instructions

Get meteorological data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
begin_dateNoStart date (YYYYMMDD or MM/DD/YYYY)
dateNoDate to retrieve data for ("today", "latest", "recent", or specific date)
end_dateNoEnd date (YYYYMMDD or MM/DD/YYYY)
formatNoOutput format (json, xml, csv)
productYesProduct (air_temperature, wind, etc.)
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 meteorological data from NOAA API by calling fetchDataApi with the provided parameters including the product type.
    async getMeteorologicalData(params: Record<string, any>): Promise<any> {
      const { product, ...rest } = params;
      return this.fetchDataApi({
        ...rest,
        product
      });
    }
  • Zod schema defining input parameters for the get_meteorological_data tool, including station, product, date parameters, with validation refinement.
    export const GetMeteorologicalDataSchema = z.object({
      station: StationSchema,
      product: z.string().min(1).describe('Product (air_temperature, wind, etc.)'),
      date: DateSchema,
      begin_date: BeginDateSchema,
      end_date: EndDateSchema,
      range: RangeSchema,
      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'" }
    );
  • Tool registration in McpServer class: defines the MCPTool object with name, description, schema, and handler delegating to NoaaService.
    const getMeteorologicalData: MCPTool = {
      name: "get_meteorological_data",
      description: "Get meteorological data",
      inputSchema: GetMeteorologicalDataSchema,
      handler: async (params) => {
        return this.noaaService.getMeteorologicalData(params);
      }
    };
  • Alternative tool registration using FastMCP server.addTool, with inline Zod parameters schema and execute handler calling NoaaService.
    server.addTool({
      name: 'get_meteorological_data',
      description: 'Get meteorological data',
      parameters: z.object({
        station: StationSchema,
        product: z.string().min(1).describe('Product (air_temperature, wind, etc.)'),
        date: DateSchema,
        begin_date: BeginDateSchema,
        end_date: EndDateSchema,
        range: RangeSchema,
        units: UnitsSchema,
        time_zone: TimeZoneSchema,
        format: FormatSchema,
      }).refine(refineDateParams, { message: dateRefinementMessage }),
      execute: async (params) => {
        try {
          const result = await noaaService.getMeteorologicalData(params);
          return JSON.stringify(result);
        } catch (error) {
          if (error instanceof Error) {
            throw new Error(`Failed to get meteorological data: ${error.message}`);
          }
          throw new Error('Failed to get meteorological data');
        }
      }
    });

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