Skip to main content
Glama
ESJavadex

REE MCP Server

by ESJavadex

get_generation_mix

Retrieve electricity generation breakdown by source (nuclear, wind, solar, etc.) for a specific date and hour from Spain's grid data.

Instructions

Get the electricity generation mix at a specific time.

Returns the power generation breakdown by source (nuclear, wind, solar, etc.) for a specific hour.

Args: date: Date in YYYY-MM-DD format hour: Hour in HH format (00-23, default: 12)

Returns: JSON string with generation mix by source.

Examples: Get generation mix at noon on Oct 8: >>> await get_generation_mix("2025-10-08", "12")

Get overnight generation mix:
>>> await get_generation_mix("2025-10-08", "02")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes
hourNo12

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary MCP tool handler and registration for 'get_generation_mix'. Processes date/hour inputs, orchestrates data fetching via GenerationMixService, and returns formatted JSON response.
    @mcp.tool()
    async def get_generation_mix(date: str, hour: str = "12") -> str:
        """Get the electricity generation mix at a specific time.
    
        Returns the power generation breakdown by source (nuclear, wind, solar, etc.)
        for a specific hour.
    
        Args:
            date: Date in YYYY-MM-DD format
            hour: Hour in HH format (00-23, default: 12)
    
        Returns:
            JSON string with generation mix by source.
    
        Examples:
            Get generation mix at noon on Oct 8:
            >>> await get_generation_mix("2025-10-08", "12")
    
            Get overnight generation mix:
            >>> await get_generation_mix("2025-10-08", "02")
        """
        try:
            start_datetime, end_datetime = DateTimeHelper.build_datetime_range(date, hour)
    
            async with ToolExecutor() as executor:
                use_case = executor.create_get_indicator_data_use_case()
                data_fetcher = DataFetcher(use_case)
                service = GenerationMixService(data_fetcher)
    
                result = await service.get_generation_mix(start_datetime, end_datetime)
    
            return ResponseFormatter.success(result)
    
        except Exception as e:
            return ResponseFormatter.unexpected_error(e, context="Error getting generation mix")
  • Core logic in GenerationMixService.get_generation_mix that fetches parallel data for generation sources defined in IndicatorIDs.get_generation_mix_sources() and constructs the mix dictionary from the first value of each.
    async def get_generation_mix(self, start_date: str, end_date: str) -> dict[str, Any]:
        """Get generation mix for a specific time.
    
        Args:
            start_date: Start datetime in ISO format
            end_date: End datetime in ISO format
    
        Returns:
            Generation mix data with sources and values
        """
        sources = IndicatorIDs.get_generation_mix_sources()
        raw_data = await self.data_fetcher.fetch_multiple_indicators(
            sources, start_date, end_date, "hour"
        )
    
        generation_mix: dict[str, Any] = {
            "datetime": start_date,
            "sources": {},
        }
    
        for source_name, response_data in raw_data.items():
            if "error" in response_data:
                generation_mix["sources"][source_name] = response_data
            else:
                values = response_data.get("values", [])
                if values:
                    generation_mix["sources"][source_name] = {
                        "value_mw": values[0]["value"],
                        "unit": response_data["indicator"]["unit"],
                    }
                else:
                    generation_mix["sources"][source_name] = {"error": "No data available"}
    
        return generation_mix
  • IndicatorIDs.get_generation_mix_sources() class method providing the mapping of generation source names to specific REE indicator metadata used by the service.
    def get_generation_mix_sources(cls) -> dict[str, IndicatorMetadata]:
        """Get indicators for generation mix analysis.
    
        Returns:
            Dictionary mapping source names to indicator metadata.
        """
        return {
            "nuclear": cls.NUCLEAR,
            "wind_national": cls.WIND_NATIONAL,
            "solar_pv_peninsular": cls.SOLAR_PV_PENINSULAR,
            "solar_thermal_peninsular": cls.SOLAR_THERMAL_PENINSULAR,
            "hydro_national": cls.HYDRO_NATIONAL,
            "combined_cycle_national": cls.COMBINED_CYCLE_NATIONAL,
        }
Behavior3/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 that the tool returns a JSON string with generation mix by source and includes default behavior (hour defaults to 12). However, it does not mention potential limitations such as data availability, rate limits, or error conditions, leaving gaps in behavioral 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 appropriately sized and front-loaded, starting with the core purpose, followed by returns, args, returns, and examples. Every sentence adds value, with no redundant information, making it efficient 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 moderate complexity (2 parameters, no annotations, but with an output schema), the description is mostly complete. It explains the purpose, parameters, and return format, and the output schema likely covers return values. However, it could improve by mentioning data sources or constraints to enhance completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by specifying the date format (YYYY-MM-DD), hour format (HH, 00-23), and default value (12), which are not in the schema. This covers both parameters adequately, though it could note that hour is optional due to the default.

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 ('Get') and resource ('electricity generation mix'), specifying it returns a breakdown by source (nuclear, wind, solar, etc.) for a specific hour. It distinguishes from siblings like 'get_generation_mix_timeline' by focusing on a single time point rather than a timeline.

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

Usage Guidelines3/5

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

The description implies usage when needing generation data for a specific hour, but does not explicitly state when to use this tool versus alternatives like 'get_generation_mix_timeline' (which might cover multiple hours) or 'get_renewable_summary' (which might focus on renewables only). It provides context through examples but lacks explicit guidance on tool selection.

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/ESJavadex/ree-mcp'

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