Skip to main content
Glama

agregar_habitacion

Add a new room to your smart home system by specifying room type (living room, kitchen, bathroom, bedroom, dining room). The system automatically numbers duplicate room names and maintains a maximum of 6 rooms.

Instructions

Crea una nueva habitación en el sistema.

Args: room_type: tipo de habitación (comedor, cocina, baño, living, dormitorio)

Returns: Confirmación de creación con el nombre generado de la habitación.

Restricciones: - Máximo 6 habitaciones en el sistema - Solo tipos permitidos: comedor, cocina, baño, living, dormitorio - El sistema numera automáticamente (ej: si ya existe "dormitorio", crea "dormitorio 2")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
room_typeYes

Implementation Reference

  • MCP tool handler for 'agregar_habitacion', decorated with @mcp.tool(). Delegates to storage.add_room after implicit validation via the storage layer.
    @mcp.tool() def agregar_habitacion(room_type: str) -> dict: """ Crea una nueva habitación en el sistema. Args: room_type: tipo de habitación (comedor, cocina, baño, living, dormitorio) Returns: Confirmación de creación con el nombre generado de la habitación. Restricciones: - Máximo 6 habitaciones en el sistema - Solo tipos permitidos: comedor, cocina, baño, living, dormitorio - El sistema numera automáticamente (ej: si ya existe "dormitorio", crea "dormitorio 2") """ return storage.add_room(room_type)
  • Core helper method implementing room creation logic: checks limits, validates room_type against ALLOWED_ROOM_TYPES, auto-generates unique room name, instantiates Room object, persists to JSON file.
    def add_room(self, room_type: str) -> dict: """Crea una nueva habitación.""" self.reload() # Sincronizar con archivo if len(self.rooms) >= self.MAX_ROOMS: raise ValueError(f"Máximo {self.MAX_ROOMS} habitaciones") # Validar que el tipo sea permitido if room_type not in self.ALLOWED_ROOM_TYPES: raise ValueError(f"Tipo de habitación '{room_type}' no válido. Tipos permitidos: {', '.join(self.ALLOWED_ROOM_TYPES)}") # Generar nombre único con numeración count = sum(1 for room in self.rooms.values() if room.type == room_type) if count == 0: room_name = room_type else: room_name = f"{room_type} {count + 1}" self.rooms[room_name] = Room(name=room_name, type=room_type) self._save_to_file() return {"room": room_name, "type": room_type, "status": "created"}
  • main.py:90-98 (registration)
    Registration of the MCP rooms server in MultiServerMCPClient configuration. This spawns the mcp_rooms.py process exposing the 'agregar_habitacion' tool via stdio transport.
    { "mcp_rooms": { "transport": "stdio", "command": "uv", "args": [ "run", "./servers/mcp_rooms.py" ] },
  • main.py:19-19 (schema)
    Schema description in the system prompt for the agent, specifying input parameter room_type and allowed values.
    - agregar_habitacion(room_type: str) → Tipos: "comedor", "cocina", "baño", "living", "dormitorio"

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