get_surface_water_ts_day
Retrieve daily surface water time series data for Colorado water stations to analyze streamflow patterns and monitor water resources over specified date ranges.
Instructions
Get daily time series data for a surface water station
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abbrev | Yes | Station abbreviation (e.g., 'PLAPLACO') | |
| startDate | Yes | Start date (MM/DD/YYYY or YYYY-MM-DD) | |
| endDate | Yes | End date (MM/DD/YYYY or YYYY-MM-DD) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"abbrev": {
"description": "Station abbreviation (e.g., 'PLAPLACO')",
"type": "string"
},
"endDate": {
"description": "End date (MM/DD/YYYY or YYYY-MM-DD)",
"type": "string"
},
"startDate": {
"description": "Start date (MM/DD/YYYY or YYYY-MM-DD)",
"type": "string"
}
},
"required": [
"abbrev",
"startDate",
"endDate"
],
"type": "object"
}
Implementation Reference
- src/index.ts:135-142 (handler)Handler case for 'get_surface_water_ts_day' tool. Extracts arguments, formats parameters for the DWR API endpoint 'surfacewater/surfacewatertsday', and delegates to the shared handleApiCall method.case "get_surface_water_ts_day": { const args = request.params.arguments as any; const params = { abbrev: args.abbrev, "min-measDate": args.startDate, "max-measDate": args.endDate }; return await this.handleApiCall("surfacewater/surfacewatertsday", params);
- src/index.ts:77-81 (schema)Zod schema defining the input parameters for the 'get_surface_water_ts_day' tool: abbrev (required), startDate, endDate.z.object({ abbrev: z.string().describe("Station abbreviation (e.g., 'PLAPLACO')"), startDate: z.string().describe("Start date (MM/DD/YYYY or YYYY-MM-DD)"), endDate: z.string().describe("End date (MM/DD/YYYY or YYYY-MM-DD)"), })
- src/index.ts:73-83 (registration)Tool registration in ListToolsRequestHandler, including name, description, and input schema for 'get_surface_water_ts_day'.{ name: "get_surface_water_ts_day", description: "Get daily time series data for a surface water station", inputSchema: zodToJsonSchema( z.object({ abbrev: z.string().describe("Station abbreviation (e.g., 'PLAPLACO')"), startDate: z.string().describe("Start date (MM/DD/YYYY or YYYY-MM-DD)"), endDate: z.string().describe("End date (MM/DD/YYYY or YYYY-MM-DD)"), }) ), },
- src/index.ts:184-217 (helper)Shared helper method handleApiCall used by all tools, including 'get_surface_water_ts_day', to make HTTP GET requests to the DWR API with formatted parameters and API key.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), }, ], }; }