get_all_stations
Retrieve data for all stations connected to the WeatherXM Pro MCP Server, enabling comprehensive access to weather information. Simplify station management and monitoring.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_all_stations"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:92-107 (handler)The handler function for the 'get_all_stations' tool. It fetches all stations from the WeatherXM API endpoint '/stations', stringifies the response data as JSON, and handles errors by returning an error message.
async () => { try { const response = await axiosInstance.get('/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:89-108 (registration)Registration of the 'get_all_stations' MCP tool using server.tool, with empty input schema (no parameters) and inline handler function.
server.tool( "get_all_stations", {}, async () => { try { const response = await axiosInstance.get('/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:91-91 (schema)Empty Zod schema object indicating the tool takes no input parameters.
{},