Skip to main content
Glama
EdgeworthHitbox

Colorado DWR MCP Server

query_dwr_api

Query Colorado Division of Water Resources REST API endpoints to access water data including surface water stations, streamflow time series, water rights, well permits, and administrative calls.

Instructions

Generic tool to query any Colorado DWR REST API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesAPI endpoint path (e.g., 'surfacewater/surfacewaterstations')
paramsNoQuery parameters

Implementation Reference

  • Handler logic for the 'query_dwr_api' tool. Extracts arguments and delegates to the shared handleApiCall method with the specified endpoint and parameters.
    case "query_dwr_api": {
        const args = request.params.arguments as any;
        return await this.handleApiCall(args.endpoint, args.params || {});
    }
  • Zod input schema for the query_dwr_api tool, defining 'endpoint' (required string) and 'params' (optional record). Converted to JSON schema for MCP registration.
        z.object({
            endpoint: z.string().describe("API endpoint path (e.g., 'surfacewater/surfacewaterstations')"),
            params: z.record(z.any()).optional().describe("Query parameters"),
        })
    ),
  • src/index.ts:115-124 (registration)
    Tool registration in the ListTools response, including name, description, and inputSchema derived from Zod.
    {
        name: "query_dwr_api",
        description: "Generic tool to query any Colorado DWR REST API endpoint",
        inputSchema: zodToJsonSchema(
            z.object({
                endpoint: z.string().describe("API endpoint path (e.g., 'surfacewater/surfacewaterstations')"),
                params: z.record(z.any()).optional().describe("Query parameters"),
            })
        ),
    },
  • Shared helper method that performs the actual API request to the DWR REST API, handles parameters, API key, and formats the response for MCP.
    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),
                },
            ],
        };
    }
  • Utility function to filter out undefined and null values from query parameters before making the API call.
    const formatParams = (params: Record<string, any>) => {
        const formatted: Record<string, any> = {};
        for (const [key, value] of Object.entries(params)) {
            if (value !== undefined && value !== null) {
                formatted[key] = value;
            }
        }
        return formatted;
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'query any Colorado DWR REST API endpoint,' which implies a read-only operation, but doesn't specify authentication needs, rate limits, error handling, or response formats. For a generic API tool with no annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary details. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every word earns its place, avoiding redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a generic API query tool with 2 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how to handle errors, or provide context on API constraints. This makes it inadequate for an agent to use the tool effectively without additional assumptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters (endpoint and params). The description adds no additional meaning beyond what the schema provides, such as examples of valid endpoints or common query parameters. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but no extra value is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as 'Generic tool to query any Colorado DWR REST API endpoint,' which is clear but vague. It specifies the verb 'query' and the resource 'Colorado DWR REST API endpoint,' but lacks specificity about what types of queries or endpoints are supported. It doesn't distinguish from sibling tools like get_surface_water_stations, which suggests overlap in functionality without clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or comparisons to sibling tools such as get_surface_water_stations or get_well_permits. This leaves the agent without context for selecting the appropriate tool, relying solely on the generic nature of the description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EdgeworthHitbox/dwr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server