Skip to main content
Glama
ESJavadex

REE MCP Server

by ESJavadex

get_demand_summary

Retrieve electricity demand data for a specific date, including real demand, forecast, and maximum/minimum values from Spain's electrical grid.

Instructions

Get a summary of electricity demand for a specific date.

Convenience tool that fetches key demand indicators (real demand, forecast, max/min) for a given date.

Args: date: Date in YYYY-MM-DD format (default: 2025-10-08)

Returns: JSON string with demand summary.

Examples: Get today's demand summary: >>> await get_demand_summary("2025-10-11")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo2025-10-08

Implementation Reference

  • The handler function for the get_demand_summary MCP tool. It is decorated with @mcp.tool() which registers it automatically with the FastMCP server. The function fetches real demand data for the specified date using the REE indicator API and returns a JSON summary including statistics and unit information.
    @mcp.tool()
    async def get_demand_summary(date: str = "2025-10-08") -> str:
        """Get a summary of electricity demand for a specific date.
    
        Convenience tool that fetches key demand indicators (real demand, forecast,
        max/min) for a given date.
    
        Args:
            date: Date in YYYY-MM-DD format (default: 2025-10-08)
    
        Returns:
            JSON string with demand summary.
    
        Examples:
            Get today's demand summary:
            >>> await get_demand_summary("2025-10-11")
        """
        try:
            start_date, end_date = DateTimeHelper.build_day_range(date)
    
            # Fetch demand data directly
            async with ToolExecutor() as executor:
                use_case = executor.create_get_indicator_data_use_case()
                request = GetIndicatorDataRequest(
                    indicator_id=IndicatorIDs.REAL_DEMAND_PENINSULAR.id,
                    start_date=start_date,
                    end_date=end_date,
                    time_granularity="hour",
                )
                response = await use_case.execute(request)
                demand_data = response.model_dump()
    
            result = {
                "date": date,
                "real_demand": {
                    "statistics": demand_data.get("statistics"),
                    "unit": demand_data["indicator"]["unit"],
                    "values_count": len(demand_data.get("values", [])),
                },
            }
            return ResponseFormatter.success(result)
    
        except Exception as e:
            return ResponseFormatter.unexpected_error(e, context="Error getting demand summary")

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