get_active_admin_calls
Retrieve active water management orders in Colorado by specifying a water division number to access current administrative calls data.
Instructions
Get active administrative calls
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| division | No | Water division number |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"division": {
"description": "Water division number",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:106-114 (registration)Tool registration in the list of tools provided by ListToolsRequestHandler, including name, description, and Zod-based input schema for optional division parameter.{ name: "get_active_admin_calls", description: "Get active administrative calls", inputSchema: zodToJsonSchema( z.object({ division: z.number().optional().describe("Water division number"), }) ), },
- src/index.ts:152-155 (handler)Handler logic in the CallToolRequestHandler switch statement; extracts arguments and delegates to the generic handleApiCall method with the specific DWR API endpoint 'administrativecalls/active'.case "get_active_admin_calls": { const args = request.params.arguments as any; return await this.handleApiCall("administrativecalls/active", args); }
- src/index.ts:184-217 (helper)Generic helper method that performs the actual HTTP GET request to the DWR API using axios, formats parameters, adds API key, and returns JSON-formatted response content. This is the core execution logic delegated to by the tool 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), }, ], }; }