get_well_permits
Search for well permits in Colorado using well names or receipt numbers to access Division of Water Resources permit data.
Instructions
Search for well permits
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wellName | No | Name of the well | |
| receipt | No | Receipt number | |
| pageSize | No | Number of results to return |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"pageSize": {
"description": "Number of results to return",
"type": "number"
},
"receipt": {
"description": "Receipt number",
"type": "string"
},
"wellName": {
"description": "Name of the well",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:148-151 (handler)Handler for the 'get_well_permits' tool. Extracts arguments from the request and delegates to the generic handleApiCall method with the specific endpoint 'wellpermits/wellpermit'.case "get_well_permits": { const args = request.params.arguments as any; return await this.handleApiCall("wellpermits/wellpermit", args); }
- src/index.ts:99-103 (schema)Zod schema defining the input parameters for the 'get_well_permits' tool: wellName, receipt, pageSize.z.object({ wellName: z.string().optional().describe("Name of the well"), receipt: z.string().optional().describe("Receipt number"), pageSize: z.number().optional().describe("Number of results to return"), })
- src/index.ts:96-105 (registration)Registration of the 'get_well_permits' tool in the ListTools response, including name, description, and input schema.name: "get_well_permits", description: "Search for well permits", inputSchema: zodToJsonSchema( z.object({ wellName: z.string().optional().describe("Name of the well"), receipt: z.string().optional().describe("Receipt number"), pageSize: z.number().optional().describe("Number of results to return"), }) ), },
- src/index.ts:184-217 (helper)Generic helper method used by all tools, including 'get_well_permits', to make HTTP GET requests to the DWR API, handle parameters, API key, and return 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), }, ], }; }