Skip to main content
Glama

get_solar_potential

Calculate rooftop solar energy potential for Swiss locations using latitude and longitude coordinates to assess renewable energy feasibility.

Instructions

Get rooftop solar energy potential for a location in Switzerland

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesLatitude (WGS84)
lngYesLongitude (WGS84)

Implementation Reference

  • The implementation of the get_solar_potential tool logic. It queries the swisstopo identify service for the 'ch.bfe.solarenergie-eignung-daecher' layer and aggregates the results by building.
    case "get_solar_potential": {
      const lat = args.lat as number;
      const lng = args.lng as number;
      // Use tight tolerance to get only the closest building
      const extent = `${lng - 0.001},${lat - 0.001},${lng + 0.001},${lat + 0.001}`;
      const url = buildUrl(`${BASE}/rest/services/all/MapServer/identify`, {
        geometry: `${lng},${lat}`,
        geometryType: "esriGeometryPoint",
        layers: "all:ch.bfe.solarenergie-eignung-daecher",
        mapExtent: extent,
        imageDisplay: "500,500,96",
        tolerance: 10,
        sr: 4326,
        returnGeometry: false,
      });
      const data = await fetchJSON<IdentifyResponse>(url);
      const roofs = data.results.map(slimSolarResult);
    
      // Group by building and summarize
      const buildingMap = new Map<number, typeof roofs>();
      for (const r of roofs) {
        const id = r.buildingId;
        if (!buildingMap.has(id)) buildingMap.set(id, []);
        buildingMap.get(id)!.push(r);
      }
    
      const buildings = [...buildingMap.entries()].map(([buildingId, surfaces]) => ({
        buildingId,
        totalArea_m2: Math.round(surfaces.reduce((s, r) => s + (r.area_m2 ?? 0), 0)),
        totalElectricity_kWh: Math.round(surfaces.reduce((s, r) => s + (r.electricityYield_kWh ?? 0), 0)),
        totalFinancialReturn_CHF: Math.round(surfaces.reduce((s, r) => s + (r.financialReturn_CHF ?? 0), 0)),
        roofSurfaces: surfaces.length,
        bestClass: Math.min(...surfaces.map((r) => r.class).filter((c) => c != null)),
        surfaces: surfaces.slice(0, 5), // Cap at 5 surfaces per building
      }));
    
      return JSON.stringify({
        count: buildings.length,
        buildings: buildings.slice(0, 10), // Cap at 10 buildings
        source: "Swiss Federal Office of Energy (BFE)",
      });
    }
  • Tool definition and input schema for 'get_solar_potential' in the geodataTools array.
      name: "get_solar_potential",
      description: "Get rooftop solar energy potential for a location in Switzerland",
      inputSchema: {
        type: "object",
        required: ["lat", "lng"],
        properties: {
          lat: { type: "number", description: "Latitude (WGS84)" },
          lng: { type: "number", description: "Longitude (WGS84)" },
        },
      },
    },
  • Registration of geodata tools, including 'get_solar_potential'.
    export const geodataTools = [

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