get_water_rights_net_amount
Calculate net water amounts for specific rights in Colorado by providing water right name and division number to retrieve accurate allocation data.
Instructions
Get net amounts for water rights
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| waterRightName | No | Name of the water right | |
| division | No | Water division number | |
| pageSize | No | Number of results to return |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"division": {
"description": "Water division number",
"type": "number"
},
"pageSize": {
"description": "Number of results to return",
"type": "number"
},
"waterRightName": {
"description": "Name of the water right",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:144-147 (handler)The switch case handler for the "get_water_rights_net_amount" tool, which extracts arguments and delegates to the generic handleApiCall method with endpoint "waterrights/netamount".case "get_water_rights_net_amount": { const args = request.params.arguments as any; return await this.handleApiCall("waterrights/netamount", args); }
- src/index.ts:88-92 (schema)Zod schema defining input parameters for the get_water_rights_net_amount tool: optional waterRightName (string), division (number), and pageSize (number).z.object({ waterRightName: z.string().optional().describe("Name of the water right"), division: z.number().optional().describe("Water division number"), pageSize: z.number().optional().describe("Number of results to return"), })
- src/index.ts:84-94 (registration)Registration of the "get_water_rights_net_amount" tool in the tools list for ListToolsRequestSchema, including name, description, and converted JSON input schema.{ name: "get_water_rights_net_amount", description: "Get net amounts for water rights", inputSchema: zodToJsonSchema( z.object({ waterRightName: z.string().optional().describe("Name of the water right"), division: z.number().optional().describe("Water division number"), pageSize: z.number().optional().describe("Number of results to return"), }) ), },
- src/index.ts:184-217 (helper)Generic helper method invoked by the tool handler to perform HTTP GET requests to the Colorado DWR REST API (base URL: https://dwr.state.co.us/Rest/GET/api/v2), formatting parameters, adding API key if available, and returning JSON-formatted response data.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), }, ], }; }