get_price_and_home_info
Retrieve current and hourly energy prices, price breakdowns, price levels, and home information like address and timezone for Tibber customers. All prices are displayed in the applicable currency.
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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "get_price_and_home_infoArguments",
"type": "object"
}
Implementation Reference
- server.py:20-47 (handler)This is the handler function for the 'get_price_and_home_info' tool. It is decorated with @mcp.tool() for registration. It connects to the Tibber API using the provided token, retrieves home information and current/today/tomorrow price info, and returns it as a 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)}"