get_price_and_home_info
Retrieve current and forecasted hourly electricity prices with detailed breakdowns, price levels, and associated home information including address and timezone for energy management decisions.
Instructions
Get the infomation of: 1. current price, with price break down, price level, and currency 2. hourly price and price level of today 3. hourly price and price level of tomorrow 4. home address info, timezone etc the currency is applying to all prices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:20-47 (handler)The handler function for the 'get_price_and_home_info' tool. It is registered via the @mcp.tool() decorator. Fetches Tibber API connection, updates info, retrieves home data including current and hourly prices for today/tomorrow, and home details, returning as string. Handles errors gracefully.@mcp.tool() async def get_price_and_home_info() -> str: """Get the infomation of: 1. current price, with price break down, price level, and currency 2. hourly price and price level of today 3. hourly price and price level of tomorrow 4. home address info, timezone etc the currency is applying to all prices """ try: tibber_connection = tibber.Tibber(tibber_api_token, user_agent="tibber-mcp") await tibber_connection.update_info() homes = tibber_connection.get_homes() if not homes: logger.error("No homes found for this Tibber account") return "No homes found" home = homes[0] await home.update_info_and_price_info() #using predefined query UPDATE_INFO_PRICE for getting most of info such as current price, today and tomorrow price, home info and subscription etc result = home.info await tibber_connection.close_connection() return str(result) except Exception as e: logger.error(f"Error retrieving price info: {e}") return f"Error: {str(e)}"