get_surface_water_stations
Search for surface water monitoring stations in Colorado using filters like station name, water division, county, or water district to access hydrological data.
Instructions
Search for surface water stations in Colorado
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stationName | No | Name of the station (supports wildcards like *AB*) | |
| division | No | Water division number (1-7) | |
| county | No | County name | |
| waterDistrict | No | Water district number | |
| pageSize | No | Number of results to return (default 50) |
Implementation Reference
- src/index.ts:131-134 (handler)Handler case for the get_surface_water_stations tool, dispatching to the generic API call handler with the specific endpoint 'surfacewater/surfacewaterstations'.case "get_surface_water_stations": { const args = request.params.arguments as any; return await this.handleApiCall("surfacewater/surfacewaterstations", args); }
- src/index.ts:63-71 (schema)Zod schema defining the input parameters for the get_surface_water_stations tool, converted to JSON schema for MCP.inputSchema: zodToJsonSchema( z.object({ stationName: z.string().optional().describe("Name of the station (supports wildcards like *AB*)"), division: z.number().optional().describe("Water division number (1-7)"), county: z.string().optional().describe("County name"), waterDistrict: z.number().optional().describe("Water district number"), pageSize: z.number().optional().describe("Number of results to return (default 50)"), }) ),
- src/index.ts:60-72 (registration)Registration of the get_surface_water_stations tool in the list of tools returned by ListToolsRequestHandler.{ name: "get_surface_water_stations", description: "Search for surface water stations in Colorado", inputSchema: zodToJsonSchema( z.object({ stationName: z.string().optional().describe("Name of the station (supports wildcards like *AB*)"), division: z.number().optional().describe("Water division number (1-7)"), county: z.string().optional().describe("County name"), waterDistrict: z.number().optional().describe("Water district number"), pageSize: z.number().optional().describe("Number of results to return (default 50)"), }) ), },
- src/index.ts:184-217 (helper)Generic helper method that executes the HTTP GET request to the Colorado DWR REST API, formats parameters, handles API key, and returns the JSON response as tool output. This is the core logic executed for get_surface_water_stations.public async handleApiCall(endpoint: string, params: any) { const url = `${BASE_URL}/${endpoint}`; const headers: Record<string, string> = {}; if (this.apiKey) { headers["Authorization"] = this.apiKey; // Or however DWR expects it, docs say 'Token: ...' or query param } // DWR docs say: "Token: B9xxxxx-xxxx-4D47-y" in header OR apiKey query param // I'll use query param if apiKey is present to be safe/easy, or header if I can confirm. // Docs: "Request Header: ... Token: ..." // Let's stick to query params for simplicity if header format is custom. // Actually, let's use the params object. const finalParams = formatParams(params); if (this.apiKey) { finalParams["apiKey"] = this.apiKey; } console.error(`Fetching ${url} with params ${JSON.stringify(finalParams)}`); const response = await axios.get(url, { params: finalParams, headers, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; }