Skip to main content
Glama

modificar_habitacion

Update an existing room name and automatically sync the change across all connected smart devices in your home automation system.

Instructions

Modifica el nombre de una habitación existente. Actualiza automáticamente todos los dispositivos asociados.

Args: old_name: nombre actual de la habitación new_name: nuevo nombre para la habitación

Returns: Confirmación con ambos nombres (antiguo y nuevo).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
old_nameYes
new_nameYes

Implementation Reference

  • The primary handler for the 'modificar_habitacion' MCP tool. It is decorated with @mcp.tool() which registers it and defines the input schema via type hints and docstring. The function delegates the logic to the storage layer.
    def modificar_habitacion(old_name: str, new_name: str) -> dict: """ Modifica el nombre de una habitación existente. Actualiza automáticamente todos los dispositivos asociados. Args: old_name: nombre actual de la habitación new_name: nuevo nombre para la habitación Returns: Confirmación con ambos nombres (antiguo y nuevo). """ return storage.update_room(old_name, new_name)
  • Supporting utility method in the DomoticaStorage class that performs the actual room renaming logic, updates device room assignments, validates existence and uniqueness, and persists changes to JSON file.
    def update_room(self, old_name: str, new_name: str) -> dict: """Renombra una habitación y actualiza sus dispositivos.""" self.reload() # Sincronizar con archivo if old_name not in self.rooms: raise ValueError(f"Habitación '{old_name}' no existe") if new_name in self.rooms and new_name != old_name: raise ValueError(f"Habitación '{new_name}' ya existe") room = self.rooms.pop(old_name) room.name = new_name self.rooms[new_name] = room # Actualizar room en dispositivos for device_id in room.devices: self.devices[device_id].room = new_name self._save_to_file() return {"old_name": old_name, "new_name": new_name, "status": "updated"}
  • main.py:19-23 (schema)
    Informal schema definition in the system prompt for the agent, listing the tool signature to guide usage.
    - agregar_habitacion(room_type: str) → Tipos: "comedor", "cocina", "baño", "living", "dormitorio" - consultar_habitaciones() → Sin parámetros - consultar_habitacion(room_name: str) - modificar_habitacion(old_name: str, new_name: str) - eliminar_habitacion(room_name: str)

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/CrisDeCrisis/mcp-domotica-backend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server