get_well_permits
Search for Colorado well permits by name or receipt number to access water resource data from the DWR REST API.
Instructions
Search for well permits
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wellName | No | Name of the well | |
| receipt | No | Receipt number | |
| pageSize | No | Number of results to return |
Implementation Reference
- src/index.ts:148-151 (handler)The switch case handler for the 'get_well_permits' tool, which extracts arguments and calls the shared 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:95-105 (registration)Registration of the 'get_well_permits' tool in the ListTools response, including name, description, and inputSchema.{ 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)The handleApiCall method that performs the actual API request to the DWR REST API, formats parameters, adds apiKey if available, and returns the JSON response. This is the core logic executed by the get_well_permits 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), }, ], }; }