get_stations_in_cell
Retrieve WeatherXM station data within a specified H3 cell index to analyze localized weather conditions and enhance monitoring capabilities.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell_index | Yes | The H3 index of the cell to return stations for |
Implementation Reference
- src/index.ts:193-208 (handler)The handler function executes the tool logic by making an API call to fetch stations within the specified H3 cell index from the WeatherXM API, handling success and error responses appropriately.async ({ cell_index }) => { try { const response = await axiosInstance.get(`/cells/${cell_index}/stations`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error: any) { if (axios.isAxiosError(error)) { return { content: [{ type: "text", text: `WeatherXM API error: ${error.response?.data.message ?? error.message}` }], isError: true, }; } throw error; } }
- src/index.ts:190-192 (schema)Zod schema defining the input parameter 'cell_index' as a string with description for validation.{ cell_index: z.string().describe("The H3 index of the cell to return stations for"), },
- src/index.ts:188-209 (registration)The MCP server.tool call that registers the 'get_stations_in_cell' tool, including its name, input schema, and handler function.server.tool( "get_stations_in_cell", { cell_index: z.string().describe("The H3 index of the cell to return stations for"), }, async ({ cell_index }) => { try { const response = await axiosInstance.get(`/cells/${cell_index}/stations`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error: any) { if (axios.isAxiosError(error)) { return { content: [{ type: "text", text: `WeatherXM API error: ${error.response?.data.message ?? error.message}` }], isError: true, }; } throw error; } } );