Skip to main content
Glama

get_parameter_definitions

Retrieve valid parameter values for NOAA API requests, such as time zones, datums, units, and output formats, to ensure accurate query configurations.

Instructions

Get information about valid parameter values for NOAA API requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parameterNoParameter type to get information about (time_zones, datums, units, tide_intervals, current_intervals, velocity_types, products, station_types, date_formats, output_formats). If not provided, returns information about all parameter types.

Implementation Reference

  • Handler function that executes the tool logic. Parses input parameter and calls appropriate methods on NoaaParametersService to retrieve and return parameter definitions as JSON.
    execute: async (params) => { try { const { parameter } = params; // If no parameter specified, return all parameter types and their descriptions if (!parameter) { return JSON.stringify({ time_zones: parametersService.getTimeZones(), datums: parametersService.getDatums(), units: parametersService.getUnits(), tide_intervals: parametersService.getTidePredictionIntervals(), current_intervals: parametersService.getCurrentPredictionIntervals(), velocity_types: parametersService.getVelocityTypes(), products: parametersService.getMeteorologicalProducts(), station_types: parametersService.getStationTypes(), date_formats: parametersService.getDateFormats(), output_formats: parametersService.getOutputFormats() }); } // Return specific parameter information based on the parameter type let result; switch (parameter) { case 'time_zones': result = parametersService.getTimeZones(); break; case 'datums': result = parametersService.getDatums(); break; case 'units': result = parametersService.getUnits(); break; case 'tide_intervals': result = parametersService.getTidePredictionIntervals(); break; case 'current_intervals': result = parametersService.getCurrentPredictionIntervals(); break; case 'velocity_types': result = parametersService.getVelocityTypes(); break; case 'products': result = parametersService.getMeteorologicalProducts(); break; case 'station_types': result = parametersService.getStationTypes(); break; case 'date_formats': result = parametersService.getDateFormats(); break; case 'output_formats': result = parametersService.getOutputFormats(); break; default: throw new Error(`Unknown parameter type: ${parameter}`); } return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get parameter definitions: ${error.message}`); } throw new Error('Failed to get parameter definitions'); } }
  • Zod schema defining the input parameters for the tool: optional 'parameter' string specifying the type of parameter definitions to retrieve.
    export const ParameterSchema = z.object({ parameter: z.string().optional().describe('Parameter type to get information about (time_zones, datums, units, tide_intervals, current_intervals, velocity_types, products, station_types, date_formats, output_formats). If not provided, returns information about all parameter types.') });
  • Tool registration via server.addTool in registerParameterTools function, which defines name, description, parameters schema, and execute handler.
    server.addTool({ name: 'get_parameter_definitions', description: 'Get information about valid parameter values for NOAA API requests', parameters: ParameterSchema, execute: async (params) => { try { const { parameter } = params; // If no parameter specified, return all parameter types and their descriptions if (!parameter) { return JSON.stringify({ time_zones: parametersService.getTimeZones(), datums: parametersService.getDatums(), units: parametersService.getUnits(), tide_intervals: parametersService.getTidePredictionIntervals(), current_intervals: parametersService.getCurrentPredictionIntervals(), velocity_types: parametersService.getVelocityTypes(), products: parametersService.getMeteorologicalProducts(), station_types: parametersService.getStationTypes(), date_formats: parametersService.getDateFormats(), output_formats: parametersService.getOutputFormats() }); } // Return specific parameter information based on the parameter type let result; switch (parameter) { case 'time_zones': result = parametersService.getTimeZones(); break; case 'datums': result = parametersService.getDatums(); break; case 'units': result = parametersService.getUnits(); break; case 'tide_intervals': result = parametersService.getTidePredictionIntervals(); break; case 'current_intervals': result = parametersService.getCurrentPredictionIntervals(); break; case 'velocity_types': result = parametersService.getVelocityTypes(); break; case 'products': result = parametersService.getMeteorologicalProducts(); break; case 'station_types': result = parametersService.getStationTypes(); break; case 'date_formats': result = parametersService.getDateFormats(); break; case 'output_formats': result = parametersService.getOutputFormats(); break; default: throw new Error(`Unknown parameter type: ${parameter}`); } return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get parameter definitions: ${error.message}`); } throw new Error('Failed to get parameter definitions'); } } });
  • Invocation of registerParameterTools within registerAllTools, passing the MCP server and NoaaParametersService instance to register the tool.
    registerParameterTools(server, parametersService);
  • Service class providing all the parameter definition data via hardcoded arrays of valid values and descriptions, used by the tool handler.
    export class NoaaParametersService { /** * Get valid time zone values */ getTimeZones(): { id: string, description: string }[] { return [ { id: 'gmt', description: 'Greenwich Mean Time' }, { id: 'lst', description: 'Local Standard Time' }, { id: 'lst_ldt', description: 'Local Standard/Local Daylight Time' } ]; } /** * Get valid datum values */ getDatums(): { id: string, description: string }[] { return [ { id: 'MHHW', description: 'Mean Higher High Water' }, { id: 'MHW', description: 'Mean High Water' }, { id: 'MTL', description: 'Mean Tide Level' }, { id: 'MSL', description: 'Mean Sea Level' }, { id: 'MLW', description: 'Mean Low Water' }, { id: 'MLLW', description: 'Mean Lower Low Water' }, { id: 'NAVD', description: 'North American Vertical Datum' }, { id: 'STND', description: 'Station Datum' } ]; } /** * Get valid units */ getUnits(): { id: string, description: string }[] { return [ { id: 'english', description: 'English units (feet, mph, etc.)' }, { id: 'metric', description: 'Metric units (meters, kph, etc.)' } ]; } /** * Get valid intervals for tide predictions */ getTidePredictionIntervals(): { id: string, description: string }[] { return [ { id: 'hilo', description: 'High/low tide predictions only' }, { id: 'h', description: 'Hourly predictions' }, { id: '6', description: '6-minute predictions' }, { id: '30', description: '30-minute predictions' }, { id: '60', description: '60-minute predictions' } ]; } /** * Get valid intervals for current predictions */ getCurrentPredictionIntervals(): { id: string, description: string }[] { return [ { id: 'MAX_SLACK', description: 'Maximum flood/ebb and slack predictions only' }, { id: '6', description: '6-minute predictions' }, { id: '30', description: '30-minute predictions' }, { id: '60', description: '60-minute predictions' } ]; } /** * Get valid velocity types for current predictions */ getVelocityTypes(): { id: string, description: string }[] { return [ { id: 'default', description: 'Default velocity reporting (flood/ebb direction)' }, { id: 'speed_dir', description: 'Speed and direction format' } ]; } /** * Get valid meteorological products */ getMeteorologicalProducts(): { id: string, description: string }[] { return [ { id: 'air_temperature', description: 'Air temperature' }, { id: 'water_temperature', description: 'Water temperature' }, { id: 'wind', description: 'Wind speed and direction' }, { id: 'air_pressure', description: 'Barometric pressure' }, { id: 'air_gap', description: 'Air gap (distance between bridge and water surface)' }, { id: 'conductivity', description: 'Conductivity' }, { id: 'visibility', description: 'Visibility' }, { id: 'humidity', description: 'Relative humidity' }, { id: 'salinity', description: 'Salinity' }, { id: 'hourly_height', description: 'Verified hourly height water level' }, { id: 'high_low', description: 'Verified high/low water level' }, { id: 'daily_mean', description: 'Verified daily mean water level' }, { id: 'monthly_mean', description: 'Verified monthly mean water level' }, { id: 'one_minute_water_level', description: 'One-minute water level data' }, { id: 'datums', description: 'Datums' } ]; } /** * Get valid station types */ getStationTypes(): { id: string, description: string }[] { return [ { id: 'waterlevels', description: 'Water level stations' }, { id: 'currentpredictions', description: 'Current prediction stations' }, { id: 'currents', description: 'Current observation stations' }, { id: 'tidepredictions', description: 'Tide prediction stations' }, { id: 'weather', description: 'Weather stations' }, { id: 'ports', description: 'Physical Oceanographic Real-Time System (PORTS) stations' } ]; } /** * Get valid date formats */ getDateFormats(): { format: string, description: string, example: string }[] { return [ { format: 'YYYYMMDD', description: 'Year, month, day without separators', example: '20230401' }, { format: 'MM/DD/YYYY', description: 'Month/day/year with separators', example: '04/01/2023' }, { format: 'today', description: 'Current date', example: 'today' }, { format: 'latest', description: 'Latest available data', example: 'latest' }, { format: 'recent', description: 'Most recent data', example: 'recent' } ]; } /** * Get valid output formats */ getOutputFormats(): { id: string, description: string }[] { return [ { id: 'json', description: 'JSON format' }, { id: 'xml', description: 'XML format' }, { id: 'csv', description: 'CSV format (not available for all endpoints)' } ]; } }

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