Skip to main content
Glama
CrisDeCrisis

MCP Domotica Backend

by CrisDeCrisis

modificar_habitacion

Change the name of an existing smart home room and automatically update all associated devices with the new room name for consistent home automation management.

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 MCP tool handler function for 'modificar_habitacion'. It invokes the storage layer to update the room name and associated devices.
    @mcp.tool() 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 method in the storage class that implements the room renaming logic, including validation, updating device room assignments, and persisting 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"}
  • The @mcp.tool() decorator registers the modificar_habitacion function as an MCP tool.
    @mcp.tool()

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