get_meteorological_data
Retrieve meteorological data for specific stations, products, and date ranges using customizable parameters like units, time zones, and output formats with the LocalTides MCP Server.
Instructions
Get meteorological data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| begin_date | No | Start date (YYYYMMDD or MM/DD/YYYY) | |
| date | No | Date to retrieve data for ("today", "latest", "recent", or specific date) | |
| end_date | No | End date (YYYYMMDD or MM/DD/YYYY) | |
| format | No | Output format (json, xml, csv) | |
| product | Yes | Product (air_temperature, wind, etc.) | |
| range | No | Number of hours to retrieve data for | |
| station | Yes | Station ID | |
| time_zone | No | Time zone (gmt, lst, lst_ldt) | |
| units | No | Units to use ("english" or "metric") |
Implementation Reference
- src/services/noaa-service.ts:114-120 (handler)The core handler function that implements the logic for fetching meteorological data from the NOAA API by delegating to fetchDataApi with the product parameter.async getMeteorologicalData(params: Record<string, any>): Promise<any> { const { product, ...rest } = params; return this.fetchDataApi({ ...rest, product }); }
- src/interfaces/noaa.ts:84-97 (schema)Zod schema defining the input parameters and validation for the get_meteorological_data tool.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'" } );
- src/server/mcp-server.ts:74-81 (registration)Registration of the get_meteorological_data tool in the custom McpServer class, using the schema and delegating to NoaaService.const getMeteorologicalData: MCPTool = { name: "get_meteorological_data", description: "Get meteorological data", inputSchema: GetMeteorologicalDataSchema, handler: async (params) => { return this.noaaService.getMeteorologicalData(params); } };
- src/tools/water-tools.ts:140-165 (registration)Registration of the get_meteorological_data tool for the FastMCP server, with inline schema and delegation to 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'); } } });