Skip to main content
Glama
ESJavadex

REE MCP Server

by ESJavadex

get_price_analysis

Analyze electricity SPOT market prices over time with statistics and multi-country comparisons. Use geographic filters to focus on specific European markets or compare all countries.

Instructions

Get electricity price analysis over time.

Analyzes SPOT market prices with statistics and multi-country comparison. Note: SPOT price indicator returns data for multiple European countries. Use geo_filter to focus on a specific market.

Args: start_date: Start datetime in ISO format (YYYY-MM-DDTHH:MM) end_date: End datetime in ISO format (YYYY-MM-DDTHH:MM) geo_filter: Optional geographic filter (e.g., "Península", "Portugal", "France") If not specified, returns all countries

Returns: JSON string with price data and analysis.

Examples: Get Spanish hourly prices for a day: >>> await get_price_analysis("2025-10-08T00:00", "2025-10-08T23:59", "Península")

Get all countries' prices for comparison:
>>> await get_price_analysis("2025-10-08T00:00", "2025-10-08T23:59")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateYes
geo_filterNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_price_analysis' MCP tool. It fetches SPOT market electricity price data for a given date range, optionally filters by geographic scope, groups prices by country, computes statistics (min, max, avg per country), and returns a formatted JSON response with analysis.
    async def get_price_analysis(
        start_date: str, end_date: str, geo_filter: str | None = None
    ) -> str:
        """Get electricity price analysis over time.
    
        Analyzes SPOT market prices with statistics and multi-country comparison.
        Note: SPOT price indicator returns data for multiple European countries.
        Use geo_filter to focus on a specific market.
    
        Args:
            start_date: Start datetime in ISO format (YYYY-MM-DDTHH:MM)
            end_date: End datetime in ISO format (YYYY-MM-DDTHH:MM)
            geo_filter: Optional geographic filter (e.g., "Península", "Portugal", "France")
                       If not specified, returns all countries
    
        Returns:
            JSON string with price data and analysis.
    
        Examples:
            Get Spanish hourly prices for a day:
            >>> await get_price_analysis("2025-10-08T00:00", "2025-10-08T23:59", "Península")
    
            Get all countries' prices for comparison:
            >>> await get_price_analysis("2025-10-08T00:00", "2025-10-08T23:59")
        """
        try:
            async with ToolExecutor() as executor:
                use_case = executor.create_get_indicator_data_use_case()
    
                # Get SPOT price data
                request = GetIndicatorDataRequest(
                    indicator_id=IndicatorIDs.SPOT_MARKET_PRICE.id,
                    start_date=start_date,
                    end_date=end_date,
                    time_granularity="hour",
                )
                response = await use_case.execute(request)
                price_data = response.model_dump()
    
            values = price_data.get("values", [])
    
            # Filter by geography if requested
            if geo_filter:
                values = [v for v in values if v["geo_scope"] == geo_filter]
    
            # Group by country
            countries: dict[str, list[dict[str, Any]]] = {}
            for value_point in values:
                geo = value_point["geo_scope"]
                if geo not in countries:
                    countries[geo] = []
                countries[geo].append(
                    {
                        "datetime": value_point["datetime"],
                        "price_eur_per_mwh": value_point["value"],
                    }
                )
    
            # Calculate statistics per country
            country_stats = {}
            for country, prices in countries.items():
                price_values = [p["price_eur_per_mwh"] for p in prices]
                if price_values:
                    country_stats[country] = {
                        "min_eur_per_mwh": round(min(price_values), 2),
                        "max_eur_per_mwh": round(max(price_values), 2),
                        "avg_eur_per_mwh": round(sum(price_values) / len(price_values), 2),
                        "count": len(price_values),
                    }
    
            result = {
                "period": {"start": start_date, "end": end_date},
                "countries": countries,
                "statistics_by_country": country_stats,
                "unit": price_data["indicator"]["unit"],
            }
    
            return ResponseFormatter.success(result)
    
        except Exception as e:
            return ResponseFormatter.unexpected_error(e, context="Error analyzing prices")
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that the tool returns data for multiple European countries and explains the geo_filter parameter's effect. However, it lacks details on rate limits, authentication needs, error handling, or what specific statistics are included in the analysis. The description adds some behavioral context but leaves gaps.

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 well-structured and appropriately sized. It starts with a clear purpose statement, followed by key behavioral notes, parameter explanations with examples, return value description, and practical usage examples. Every sentence adds value with zero waste, and information is front-loaded effectively.

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 has 3 parameters with 0% schema coverage and an output schema exists, the description does a good job compensating. It explains all parameters, provides usage examples, and notes the return format. However, with no annotations and sibling tools present, it could better differentiate from alternatives like 'get_spain_hourly_prices' and provide more behavioral context for a data analysis tool.

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?

Schema description coverage is 0%, so the description must compensate. It provides meaningful semantics for all three parameters: start_date and end_date as datetime in ISO format, and geo_filter as an optional geographic filter with examples ('Península', 'Portugal', 'France'). This adds substantial value beyond the bare schema, though it doesn't cover all possible enum values or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Get electricity price analysis over time' with specific details about analyzing SPOT market prices with statistics and multi-country comparison. It distinguishes from siblings like 'get_spain_hourly_prices' by mentioning multi-country scope, though not explicitly naming alternatives. The verb 'Get' and resource 'electricity price analysis' are specific.

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 usage: 'Use geo_filter to focus on a specific market' and explains default behavior when geo_filter is not specified. It distinguishes from 'get_spain_hourly_prices' by mentioning European countries, but does not explicitly state when to use this tool versus that sibling or other alternatives like 'get_pvpc_rate'.

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