Skip to main content
Glama
ESJavadex

REE MCP Server

by ESJavadex

get_pvpc_rate

Retrieve Spain's regulated retail electricity price (PVPC) for a specific date and hour. Use this tool to access current electricity rates for consumers in Spain.

Instructions

Get the PVPC regulated electricity rate at a specific time.

Returns the PVPC (Precio Voluntario para el Pequeño Consumidor) rate, which is the regulated retail electricity price for consumers in Spain.

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

Returns: JSON string with PVPC rate data.

Examples: Get PVPC rate at noon on Oct 8: >>> await get_pvpc_rate("2025-10-08", "12")

Get PVPC rate at midnight:
>>> await get_pvpc_rate("2025-10-08", "00")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes
hourNo12

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the get_pvpc_rate tool. It fetches PVPC electricity rate data from REE API using a use case, processes the response, and returns formatted JSON.
    @mcp.tool()
    async def get_pvpc_rate(date: str, hour: str = "12") -> str:
        """Get the PVPC regulated electricity rate at a specific time.
    
        Returns the PVPC (Precio Voluntario para el Pequeño Consumidor) rate,
        which is the regulated retail electricity price for consumers in Spain.
    
        Args:
            date: Date in YYYY-MM-DD format
            hour: Hour in HH format (00-23, default: 12)
    
        Returns:
            JSON string with PVPC rate data.
    
        Examples:
            Get PVPC rate at noon on Oct 8:
            >>> await get_pvpc_rate("2025-10-08", "12")
    
            Get PVPC rate at midnight:
            >>> await get_pvpc_rate("2025-10-08", "00")
        """
        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()
                request = GetIndicatorDataRequest(
                    indicator_id=IndicatorIDs.PVPC_RATE.id,
                    start_date=start_datetime,
                    end_date=end_datetime,
                    time_granularity="hour",
                )
                response = await use_case.execute(request)
                pvpc_data = response.model_dump()
    
            # Extract value
            values = pvpc_data.get("values", [])
            if values:
                result = {
                    "datetime": start_datetime,
                    "pvpc_rate": {
                        "value_eur_mwh": values[0]["value"],
                        "unit": pvpc_data["indicator"]["unit"],
                        "description": "PVPC regulated retail electricity rate for consumers",
                    },
                    "note": (
                        "PVPC (Precio Voluntario para el Pequeño Consumidor) is the "
                        "regulated electricity price in Spain"
                    ),
                }
            else:
                result = {
                    "datetime": start_datetime,
                    "error": "No PVPC rate data available for this period",
                    "note": "PVPC data may not be available for all time periods",
                }
    
            return ResponseFormatter.success(result)
    
        except DomainException as e:
            return ResponseFormatter.domain_exception(e)
        except Exception as e:
            return ResponseFormatter.unexpected_error(e, context="Error getting PVPC rate")
  • The @mcp.tool() decorator registers the get_pvpc_rate function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameters and docstring; output is str (JSON).
    async def get_pvpc_rate(date: str, hour: str = "12") -> str:
        """Get the PVPC regulated electricity rate at a specific time.
    
        Returns the PVPC (Precio Voluntario para el Pequeño Consumidor) rate,
        which is the regulated retail electricity price for consumers in Spain.
    
        Args:
            date: Date in YYYY-MM-DD format
            hour: Hour in HH format (00-23, default: 12)
    
        Returns:
            JSON string with PVPC rate data.
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 the tool's behavior by specifying it returns JSON data and includes examples, but lacks details on error handling, rate limits, authentication needs, or data freshness. The description doesn't contradict annotations (none exist), but provides only basic operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with purpose statement, argument details, return format, and examples. Every sentence adds value, though the examples could be slightly more concise. It's appropriately sized for a simple data retrieval tool with two parameters.

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 low complexity, two parameters, no annotations, but with an output schema (implied by 'Returns: JSON string'), the description is reasonably complete. It covers purpose, parameters, return format, and usage examples. The main gap is lack of behavioral details like error conditions or data source limitations.

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 adds significant value by explaining parameter formats (date in YYYY-MM-DD, hour in HH format with range 00-23 and default 12) and providing concrete examples. However, it doesn't detail validation rules or edge cases beyond the basic format.

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 specific action ('Get the PVPC regulated electricity rate at a specific time'), identifies the resource (PVPC rate for Spain), and distinguishes it from siblings by focusing on regulated retail electricity prices rather than analysis, forecasts, or other energy metrics. The title 'null' doesn't detract from this clarity.

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 context through the examples (getting rates at specific times) but doesn't explicitly state when to use this tool versus alternatives like 'get_spain_hourly_prices' or 'get_price_analysis'. No guidance is provided on prerequisites, limitations, or comparative use cases with sibling tools.

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