Skip to main content
Glama
robobobby
by robobobby

dk_cheapest_hours

Identify low-cost electricity periods in Denmark to schedule energy-intensive tasks like EV charging or appliance use, optimizing for price areas DK1 or DK2.

Instructions

Find the cheapest hours to use electricity today/tomorrow. Useful for scheduling EV charging, laundry, dishwasher, heat pumps, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
areaYesPrice area: DK1 or DK2, or a city/region name.
countNoNumber of cheapest hours to return (default: 5)
consecutiveNoIf true, find the cheapest consecutive block of 'count' hours (default: false)

Implementation Reference

  • The handler function for 'dk_cheapest_hours' which fetches spot price data and calculates either the cheapest individual hours or the cheapest consecutive block of hours.
    async ({ area, count = 5, consecutive = false }) => {
      const priceArea = resolvePriceArea(area);
      if (!priceArea) {
        return { content: [{ type: "text", text: "Could not determine price area. Use DK1 (western Denmark) or DK2 (eastern Denmark), or a city name." }] };
      }
    
      const data = await fetchDataset("Elspotprices", {
        limit: 48,
        sort: "HourDK asc",
        filter: JSON.stringify({ PriceArea: priceArea }),
        start: "now-PT1H",
      });
    
      if (!data.records?.length) {
        return { content: [{ type: "text", text: "No price data available." }] };
      }
    
      const records = data.records.filter(r => r.SpotPriceDKK != null);
    
      let output = `# Cheapest Hours — ${priceArea} (${PRICE_AREAS[priceArea]})\n\n`;
    
      if (consecutive && count > 1) {
        // Find cheapest consecutive block
        let bestStart = 0;
        let bestAvg = Infinity;
        for (let i = 0; i <= records.length - count; i++) {
          const block = records.slice(i, i + count);
          const avg = block.reduce((s, r) => s + r.SpotPriceDKK, 0) / count;
          if (avg < bestAvg) {
            bestAvg = avg;
            bestStart = i;
          }
        }
    
        const block = records.slice(bestStart, bestStart + count);
        output += `**Best ${count}-hour block:**\n`;
        output += `**Start:** ${block[0].HourDK?.replace("T", " ").slice(0, 16)}\n`;
        output += `**End:** ${block[block.length - 1].HourDK?.replace("T", " ").slice(0, 16)} + 1h\n`;
        output += `**Average price:** ${formatPrice(bestAvg)}\n\n`;
    
        output += "| Hour | Price |\n|---|---|\n";
        for (const r of block) {
          output += `| ${r.HourDK?.replace("T", " ").slice(0, 16)} | ${formatPrice(r.SpotPriceDKK)} |\n`;
        }
      } else {
        // Find N cheapest individual hours
        const sorted = [...records].sort((a, b) => a.SpotPriceDKK - b.SpotPriceDKK);
        const cheapest = sorted.slice(0, count);
    
        output += `**${count} cheapest hours:**\n\n`;
        output += "| Rank | Hour | Price |\n|---|---|---|\n";
        for (let i = 0; i < cheapest.length; i++) {
          const r = cheapest[i];
          output += `| ${i + 1} | ${r.HourDK?.replace("T", " ").slice(0, 16)} | ${formatPrice(r.SpotPriceDKK)} |\n`;
        }
      }
    
      output += "\n*Prices are spot prices excl. taxes, tariffs, and VAT. Source: Energi Data Service.*\n";
      return { content: [{ type: "text", text: output }] };
    }
  • The registration of the 'dk_cheapest_hours' tool, including its schema definition for input parameters (area, count, consecutive).
    server.tool(
      "dk_cheapest_hours",
      "Find the cheapest hours to use electricity today/tomorrow. Useful for scheduling EV charging, laundry, dishwasher, heat pumps, etc.",
      {
        area: z.string().describe("Price area: DK1 or DK2, or a city/region name."),
        count: z.number().optional().describe("Number of cheapest hours to return (default: 5)"),
        consecutive: z.boolean().optional().describe("If true, find the cheapest consecutive block of 'count' hours (default: false)"),
      },
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 the tool finds cheapest hours 'today/tomorrow,' which hints at temporal scope, but does not disclose critical behavioral traits such as data sources, update frequency, rate limits, authentication needs, or error handling. The description adds minimal context beyond the basic purpose.

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 appropriately sized and front-loaded, with two concise sentences: the first states the core purpose, and the second adds practical use cases. Every sentence earns its place without redundancy or unnecessary elaboration, making it efficient and easy to parse.

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is adequate but has clear gaps. It covers the purpose and usage context well, but lacks details on behavioral traits, output format, or error handling. Without annotations or output schema, the description should do more to compensate, but it meets minimum viability.

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%, so the schema already documents all parameters (area, count, consecutive) with their types and defaults. The description does not add any meaning beyond what the schema provides, such as explaining parameter interactions or providing examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Find') and resource ('cheapest hours to use electricity today/tomorrow'), and distinguishes it from siblings like 'dk_electricity_prices' by focusing on identifying optimal time slots rather than just providing price data. The inclusion of use cases (EV charging, laundry, etc.) further clarifies its practical application.

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 provides clear context for when to use this tool ('useful for scheduling EV charging, laundry, dishwasher, heat pumps, etc.'), but does not explicitly state when not to use it or name alternatives. It implies usage for cost optimization in electricity consumption, though lacks explicit exclusions or comparisons to siblings like 'dk_electricity_prices'.

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/robobobby/mcp-nordic'

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