consultar_habitacion
Retrieve detailed information about a specific smart home room, including all connected devices and their current status for home automation management.
Instructions
Obtiene información detallada de una habitación específica.
Args: room_name: nombre de la habitación
Returns: Información completa de la habitación incluyendo todos sus dispositivos.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| room_name | Yes |
Implementation Reference
- servers/mcp_rooms.py:154-166 (handler)The main handler function for the 'consultar_habitacion' MCP tool, decorated with @mcp.tool(). It takes room_name as input and delegates to storage.get_room_info() for the logic.@mcp.tool() def consultar_habitacion(room_name: str) -> dict: """ Obtiene información detallada de una habitación específica. Args: room_name: nombre de la habitación Returns: Información completa de la habitación incluyendo todos sus dispositivos. """ return storage.get_room_info(room_name)
- storage.py:149-167 (helper)Supporting utility method in the storage module that implements the core logic for retrieving detailed information about a specific room, including its devices and counts of certain types.def get_room_info(self, name: str) -> dict: """Obtiene información detallada de una habitación.""" self.reload() # Sincronizar con archivo if name not in self.rooms: raise ValueError(f"Habitación '{name}' no existe") room = self.rooms[name] devices = [self.devices[dev_id].to_dict() for dev_id in room.devices] lights = sum(1 for d in devices if d["type"] == "light") thermos = sum(1 for d in devices if d["type"] == "thermostat") return { "room": name, "type": room.type, "devices": devices, "light_count": lights, "thermostat_count": thermos }