get_station_details
Retrieve detailed station information, including ID, output format (JSON/XML), and units (English/Metric), for accurate water level and tide data analysis.
Instructions
Get detailed information about a station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Output format (json, xml) | |
| station | Yes | Station ID | |
| units | No | Units to use ("english" or "metric") |
Implementation Reference
- src/services/noaa-service.ts:165-170 (handler)Implements the core logic to fetch detailed station information from NOAA's metadata API by constructing the endpoint `/stations/{station}/details.{format}` and calling fetchMetadataApi.async getStationDetails(params: Record<string, any>): Promise<any> { const { station, ...rest } = params; const endpoint = `/stations/${station}/details.` + (rest.format || 'json'); return this.fetchMetadataApi(endpoint, rest); }
- src/server/mcp-server.ts:94-101 (registration)Registers the get_station_details tool in the McpServer class using the MCPTool interface, with schema validation and delegation to NoaaService.const getStationDetails: MCPTool = { name: "get_station_details", description: "Get detailed information about a station", inputSchema: GetStationDetailsSchema, handler: async (params) => { return this.noaaService.getStationDetails(params); } };
- src/interfaces/noaa.ts:117-121 (schema)Zod schema defining input parameters for get_station_details: required station ID, optional units (english/metric), optional format (json/xml).export const GetStationDetailsSchema = z.object({ station: StationSchema, units: UnitsSchema, format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'), });
- src/tools/station-tools.ts:37-56 (registration)Alternative registration of get_station_details tool using FastMCP's addTool method, with inline Zod parameters schema, error handling, and JSON stringification of result.server.addTool({ name: 'get_station_details', description: 'Get detailed information about a station', parameters: z.object({ station: StationSchema, format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'), units: UnitsSchema, }), execute: async (params) => { try { const result = await noaaService.getStationDetails(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get station details: ${error.message}`); } throw new Error('Failed to get station details'); } } });