search_dams
Search Swiss dams and reservoirs under federal supervision by name to find details like dam type, height, reservoir volume, purpose, and construction year. Uses official Swiss Federal Office of Energy data.
Instructions
Search Swiss dams and reservoirs under federal supervision by name. Searches both dam names and reservoir names. Returns dam type, height, crest length, reservoir volume, purpose, canton, and year built. Data source: Swiss Federal Office of Energy (SFOE) via swisstopo BGDI.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Dam or reservoir name to search (e.g. 'Grimsel', 'Grande Dixence', 'Mattmark', 'Lac des Dix'). Partial names are supported. |
Implementation Reference
- src/modules/dams.ts:257-307 (handler)The handler for the "search_dams" tool, which processes the user's query, fetches matching dam data, and formats it for output.
case "search_dams": { const query = args.query as string; if (!query?.trim()) { throw new Error("query is required"); } // Try damname first, fall back to reservoirname if no results let results = await findDams(query, "damname"); if (!results.length) { results = await findDams(query, "reservoirname"); } if (!results.length) { return JSON.stringify({ results: [], count: 0, message: `No dams found matching "${query}". Try a shorter search term or reservoir name.`, source: `${BASE}/find?layer=${DAMS_LAYER}`, }, null, 2); } // For up to 5 results, resolve canton via coordinate identify const enriched = await Promise.all( results.slice(0, MAX_RESULTS).map(async (dam) => { let canton: string | null = null; if (dam.geometry?.x != null && dam.geometry?.y != null) { canton = await fetchCantonForCoords(dam.geometry.x, dam.geometry.y).catch(() => null); } return formatDamSummary(dam, canton); }) ); const response = { results: enriched, count: enriched.length, total_found: results.length, source: `${BASE}/find?layer=${DAMS_LAYER}`, }; const json = JSON.stringify(response, null, 2); if (json.length > 49000) { return JSON.stringify({ results: enriched.slice(0, 10), count: 10, total_found: results.length, truncated: true, source: `${BASE}/find?layer=${DAMS_LAYER}`, }, null, 2); } return json; } - src/modules/dams.ts:200-215 (registration)The definition of the "search_dams" tool, including its name, description, and input schema.
{ name: "search_dams", description: "Search Swiss dams and reservoirs under federal supervision by name. Searches both dam names and reservoir names. Returns dam type, height, crest length, reservoir volume, purpose, canton, and year built. Data source: Swiss Federal Office of Energy (SFOE) via swisstopo BGDI.", inputSchema: { type: "object", required: ["query"], properties: { query: { type: "string", description: "Dam or reservoir name to search (e.g. 'Grimsel', 'Grande Dixence', 'Mattmark', 'Lac des Dix'). Partial names are supported.", }, }, }, },