Skip to main content
Glama

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

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.

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