get_active_admin_calls
Retrieve active administrative calls for Colorado water divisions to monitor current water management restrictions and allocations.
Instructions
Get active administrative calls
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| division | No | Water division number |
Implementation Reference
- src/index.ts:152-155 (handler)Handler for the 'get_active_admin_calls' tool. Extracts arguments and delegates to the shared handleApiCall method with the specific 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:106-114 (registration)Registration of the 'get_active_admin_calls' tool in the list of available tools, including name, description, and input schema (optional division number).{ 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:110-112 (schema)Zod schema defining the input parameters for the tool: optional division number.z.object({ division: z.number().optional().describe("Water division number"), })
- src/index.ts:184-219 (helper)Shared helper function that performs the actual API call to the DWR REST API endpoint, handles parameters, API key, and formats the response as MCP content.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), }, ], }; } async run(transport: any) {