Skip to main content
Glama

get_stations

Retrieve a list of tide and current stations by specifying station type, output format, and unit preferences using the LocalTides MCP Server.

Instructions

Get list of stations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput format (json, xml)
typeNoStation type (waterlevels, currents, etc.)
unitsNoUnits to use ("english" or "metric")

Implementation Reference

  • Core handler function that implements the logic to retrieve NOAA stations list from the metadata API, processing parameters and constructing the API request.
    async getStations(params: Record<string, any>): Promise<any> { const { type, name, lat_min, lat_max, lon_min, lon_max, state, limit, offset, sort_by, sort_order, ...rest } = params; const endpoint = '/stations.' + (rest.format || 'json'); // Build query parameters with all the filters const queryParams: Record<string, any> = { ...rest }; // Add filters only if they are defined if (type) queryParams.type = type; if (name) queryParams.name = name; if (lat_min !== undefined) queryParams.lat_min = lat_min; if (lat_max !== undefined) queryParams.lat_max = lat_max; if (lon_min !== undefined) queryParams.lon_min = lon_min; if (lon_max !== undefined) queryParams.lon_max = lon_max; if (state) queryParams.state = state; if (limit !== undefined) queryParams.limit = limit; if (offset !== undefined) queryParams.offset = offset; if (sort_by) queryParams.sort_by = sort_by; if (sort_order) queryParams.sort_order = sort_order; return this.fetchMetadataApi(endpoint, queryParams); }
  • Zod schema for validating input parameters to the get_stations tool.
    export const GetStationsSchema = z.object({ type: z.string().optional().describe('Station type (waterlevels, currents, etc.)'), units: UnitsSchema, format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'), name: z.string().optional().describe('Filter stations by name (partial match)'), lat_min: z.number().optional().describe('Minimum latitude boundary'), lat_max: z.number().optional().describe('Maximum latitude boundary'), lon_min: z.number().optional().describe('Minimum longitude boundary'), lon_max: z.number().optional().describe('Maximum longitude boundary'), state: z.string().optional().describe('Filter stations by state code (e.g., CA, NY)'), limit: z.number().optional().describe('Maximum number of stations to return'), offset: z.number().optional().describe('Number of stations to skip for pagination'), sort_by: z.enum(['name', 'id', 'state']).optional().describe('Field to sort results by'), sort_order: z.enum(['asc', 'desc']).optional().describe('Sort order (ascending or descending)'), });
  • Tool registration in MCP server: defines the MCPTool for get_stations including name, description, schema, and handler delegating to noaaService.
    const getStations: MCPTool = { name: "get_stations", description: "Get list of stations", inputSchema: GetStationsSchema, handler: async (params) => { return this.noaaService.getStations(params); } };
  • Alternative tool registration using FastMCP.addTool for get_stations, with inline schema and execute handler.
    server.addTool({ name: 'get_stations', description: 'Get list of stations', parameters: z.object({ type: z.string().optional().describe('Station type (waterlevels, currents, etc.)'), format: z.enum(['json', 'xml']).optional().describe('Output format (json, xml)'), units: UnitsSchema, }), execute: async (params) => { try { const result = await noaaService.getStations(params); return JSON.stringify(result); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to get stations: ${error.message}`); } throw new Error('Failed to get stations'); } } });

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-TidesAndCurrents-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server