Skip to main content
Glama

get_dams_by_canton

Retrieve Swiss dams under federal supervision for a specific canton using 2-letter canton codes. Provides up to 20 dams with basic details from official Swiss energy data.

Instructions

List all Swiss dams under federal supervision in a given canton. Returns up to 20 dams with basic details. Data source: Swiss Federal Office of Energy (SFOE) via swisstopo BGDI.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cantonYesSwiss canton 2-letter abbreviation code (e.g. 'VS' for Valais, 'GR' for Graubünden, 'BE' for Bern, 'UR' for Uri, 'TI' for Ticino, 'VD' for Vaud).

Implementation Reference

  • The handler implementation for the `get_dams_by_canton` tool, which validates the input canton code, fetches its bounding box, and filters dams within that area.
    case "get_dams_by_canton": {
      const canton = args.canton as string;
      if (!canton?.trim()) {
        throw new Error("canton is required (2-letter code, e.g. 'VS', 'GR', 'BE')");
      }
    
      const cantonCode = canton.trim().toUpperCase();
      if (!/^[A-Z]{2}$/.test(cantonCode)) {
        throw new Error("canton must be a 2-letter Swiss canton code (e.g. 'VS', 'GR', 'BE', 'ZH')");
      }
    
      // Get canton bounding box
      const bbox = await fetchCantonBbox(cantonCode);
      if (!bbox) {
        throw new Error(`Unknown canton code: "${cantonCode}". Use standard 2-letter Swiss canton abbreviations (VS, GR, BE, UR, TI, VD, etc.)`);
      }
    
      const [xmin, ymin, xmax, ymax] = bbox;
    
      // Fetch all dams with geometry to filter by canton bbox
      const allDams = await findDams("%", "damname", true);
    
      // Filter dams whose coordinates fall within the canton bbox
      const cantonDams = allDams.filter((dam) => {
        const x = dam.geometry?.x;
        const y = dam.geometry?.y;
        if (x == null || y == null) return false;
        return x >= xmin && x <= xmax && y >= ymin && y <= ymax;
      });
    
      if (!cantonDams.length) {
        return JSON.stringify({
          canton: cantonCode,
          dams: [],
          count: 0,
          message: `No dams found in canton ${cantonCode}. This canton may not have any dams under federal supervision.`,
          source: `${BASE}/find?layer=${DAMS_LAYER}`,
        }, null, 2);
      }
    
      const limited = cantonDams.slice(0, MAX_RESULTS);
      const formatted = limited.map((dam) => formatDamSummary(dam, cantonCode));
    
      const response = {
        canton: cantonCode,
        dams: formatted,
        count: formatted.length,
        total_in_canton: cantonDams.length,
        note: cantonDams.length > MAX_RESULTS
          ? `Showing first ${MAX_RESULTS} of ${cantonDams.length} dams in canton ${cantonCode}.`
          : undefined,
        source: `${BASE}/find?layer=${DAMS_LAYER}`,
  • The tool definition and input schema for `get_dams_by_canton`.
    {
      name: "get_dams_by_canton",
      description:
        "List all Swiss dams under federal supervision in a given canton. Returns up to 20 dams with basic details. Data source: Swiss Federal Office of Energy (SFOE) via swisstopo BGDI.",
      inputSchema: {
        type: "object",
        required: ["canton"],
        properties: {
          canton: {
            type: "string",
            description:
              "Swiss canton 2-letter abbreviation code (e.g. 'VS' for Valais, 'GR' for Graubünden, 'BE' for Bern, 'UR' for Uri, 'TI' for Ticino, 'VD' for Vaud).",
          },
        },
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it returns up to 20 dams with basic details (implying a limit and partial data), specifies the data source (SFOE via swisstopo BGDI), and indicates it's a read operation ('List'). It does not cover aspects like error handling, authentication needs, or rate limits, but provides useful operational context.

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 front-loaded with the core purpose, followed by operational details (limit, data source) in two efficient sentences. Every sentence adds value without redundancy, making it appropriately sized and well-structured.

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

Completeness4/5

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

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is largely complete: it states purpose, scope, data source, and result limits. However, it lacks details on output format (e.g., what 'basic details' include) and error cases, which could enhance completeness for agent use.

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?

The input schema has 100% description coverage, fully documenting the 'canton' parameter with examples. The description adds no additional parameter semantics beyond what the schema provides, such as format details or constraints, so it meets the baseline score of 3 for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('List all Swiss dams under federal supervision'), resource ('dams'), and scope ('in a given canton'), distinguishing it from sibling tools like 'get_dam_details' or 'search_dams' by specifying the canton-based filtering and federal supervision criteria.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'in a given canton' and 'under federal supervision,' which helps differentiate it from broader search tools. However, it does not explicitly state when to use this tool versus alternatives like 'search_dams' or 'get_dam_details,' missing explicit exclusions or comparisons.

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/vikramgorla/mcp-swiss'

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