get_surface_water_stations
Search for surface water monitoring stations in Colorado using filters like station name, water division, county, or water district to locate hydrological data collection points.
Instructions
Search for surface water stations in Colorado
Input 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) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"county": {
"description": "County name",
"type": "string"
},
"division": {
"description": "Water division number (1-7)",
"type": "number"
},
"pageSize": {
"description": "Number of results to return (default 50)",
"type": "number"
},
"stationName": {
"description": "Name of the station (supports wildcards like *AB*)",
"type": "string"
},
"waterDistrict": {
"description": "Water district number",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:131-134 (handler)The switch case handler for the 'get_surface_water_stations' tool. It extracts the input arguments and invokes the generic handleApiCall helper with the specific DWR API 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:64-70 (schema)Zod schema that defines the input validation for the 'get_surface_water_stations' tool, converted to JSON schema for MCP.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)Tool registration object for 'get_surface_water_stations' provided in the ListTools handler.{ 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 performs the HTTP GET request to the DWR REST API endpoint, handles API key, formats parameters, and returns the JSON response as tool output. Used by the get_surface_water_stations handler.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), }, ], }; }