Skip to main content
Glama

get_surface_water_ts_day

Retrieve daily surface water time series data for Colorado 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

TableJSON Schema
NameRequiredDescriptionDefault
abbrevYesStation abbreviation (e.g., 'PLAPLACO')
startDateYesStart date (MM/DD/YYYY or YYYY-MM-DD)
endDateYesEnd date (MM/DD/YYYY or YYYY-MM-DD)

Implementation Reference

  • Handler for the get_surface_water_ts_day tool. Extracts input arguments (abbrev, startDate, endDate), maps them to API parameters (abbrev, min-measDate, max-measDate), and delegates to handleApiCall to fetch daily time series data from the DWR surfacewatertsday endpoint.
    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); }
  • Zod schema definition for input validation of the tool parameters: station abbrev, start date, and end date.
    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:73-83 (registration)
    Registration of the tool in the listTools response, including name, description, and input schema.
    { 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)"), }) ), },
  • Helper method that performs the actual HTTP GET request to the DWR API endpoint, handles API key, formats parameters, logs the request, and returns the JSON response as tool output.
    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), }, ], }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EdgeworthHitbox/dwr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server