dk_energy_mix
Retrieve real-time Danish electricity production data including wind, solar, conventional sources, and cross-border exchange. Updated every 5 minutes for DK1, DK2, or specific regions.
Instructions
Get the real-time Danish electricity production mix: wind (offshore/onshore), solar, conventional, and cross-border exchange. Updated every 5 minutes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area | No | Price area: DK1 or DK2, or a city/region name. Default: both areas. |
Implementation Reference
- src/servers/danish-energy.js:160-229 (handler)The implementation of the `dk_energy_mix` MCP tool, which fetches real-time Danish electricity production mix data from the Energi Data Service API.
server.tool( "dk_energy_mix", "Get the real-time Danish electricity production mix: wind (offshore/onshore), solar, conventional, and cross-border exchange. Updated every 5 minutes.", { area: z.string().optional().describe("Price area: DK1 or DK2, or a city/region name. Default: both areas."), }, async ({ area }) => { const priceArea = area ? resolvePriceArea(area) : null; const filter = priceArea ? JSON.stringify({ PriceArea: priceArea }) : undefined; const data = await fetchDataset("ElectricityProdex5MinRealtime", { limit: priceArea ? 1 : 2, sort: "Minutes5DK desc", filter, }); if (!data.records?.length) { return { content: [{ type: "text", text: "No production data available." }] }; } let output = "# Danish Electricity Production Mix\n\n"; for (const r of data.records) { const offshore = r.OffshoreWindPower || 0; const onshore = r.OnshoreWindPower || 0; const solar = r.SolarPower || 0; const smallPlants = r.ProductionLt100MW || 0; const largePlants = r.ProductionGe100MW || 0; const totalProduction = smallPlants + largePlants; const totalRenewable = offshore + onshore + solar; const renewableShare = totalProduction > 0 ? (totalRenewable / totalProduction * 100) : 0; output += `## ${r.PriceArea} β ${PRICE_AREAS[r.PriceArea] || r.PriceArea}\n`; output += `*${r.Minutes5DK?.replace("T", " ").slice(0, 16)}*\n\n`; output += `### Production\n`; output += `| Source | MW |\n|---|---|\n`; output += `| β‘ Offshore wind | ${offshore.toFixed(1)} |\n`; output += `| π¬οΈ Onshore wind | ${onshore.toFixed(1)} |\n`; output += `| βοΈ Solar | ${solar.toFixed(1)} |\n`; output += `| π Large plants (β₯100MW) | ${largePlants.toFixed(1)} |\n`; output += `| π§ Small plants (<100MW) | ${smallPlants.toFixed(1)} |\n`; output += `| **Total** | **${totalProduction.toFixed(1)}** |\n`; output += `| **Renewable share** | **${renewableShare.toFixed(1)}%** |\n\n`; // Cross-border exchanges (positive = import, negative = export) const exchanges = [ ["π©πͺ Germany", r.ExchangeGermany], ["π³π± Netherlands", r.ExchangeNetherlands], ["π¬π§ Great Britain", r.ExchangeGreatBritain], ["π³π΄ Norway", r.ExchangeNorway], ["πΈπͺ Sweden", r.ExchangeSweden], ["π Great Belt", r.ExchangeGreatBelt], ].filter(([, v]) => v != null); if (exchanges.length) { output += `### Cross-border Exchange (MW)\n`; output += `| Connection | MW | Direction |\n|---|---|---|\n`; for (const [name, mw] of exchanges) { const dir = mw > 0 ? "β Import" : mw < 0 ? "β Export" : "β"; output += `| ${name} | ${Math.abs(mw).toFixed(1)} | ${dir} |\n`; } output += "\n"; } } output += "*Source: Energi Data Service (Energinet). Real-time 5-minute resolution.*\n"; return { content: [{ type: "text", text: output }] }; } );