Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

restart_device

Restart a UniFi network device using its MAC address to resolve connectivity issues or apply configuration changes.

Instructions

Restart a UniFi network device by its MAC address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
macYesMAC address of the device to restart (e.g., '00:11:22:33:44:55')

Implementation Reference

  • MCP server tool handler for 'restart_device': extracts 'mac' from arguments, calls UniFiClient.restart_device(mac), and returns success TextContent message.
    case "restart_device":
        mac = arguments.get("mac", "")
        await client.restart_device(mac)
        return [
            TextContent(
                type="text",
                text=f"Restart command sent to device {mac}",
            )
        ]
  • Registers the 'restart_device' tool in the MCP server's list_tools() with name, description, and input schema requiring 'mac' string.
    Tool(
        name="restart_device",
        description="Restart a UniFi network device by its MAC address",
        inputSchema={
            "type": "object",
            "properties": {
                "mac": {
                    "type": "string",
                    "description": "MAC address of the device to restart (e.g., '00:11:22:33:44:55')",
                }
            },
            "required": ["mac"],
        },
    ),
  • Tool schema definition for 'restart_device': object with required 'mac' property (string).
    Tool(
        name="restart_device",
        description="Restart a UniFi network device by its MAC address",
        inputSchema={
            "type": "object",
            "properties": {
                "mac": {
                    "type": "string",
                    "description": "MAC address of the device to restart (e.g., '00:11:22:33:44:55')",
                }
            },
            "required": ["mac"],
        },
    ),
  • UniFiClient helper method: sends POST request to UniFi API endpoint /api/s/{site}/cmd/devmgr with JSON {"cmd": "restart", "mac": mac.lower()} to restart the device.
    async def restart_device(self, mac: str) -> bool:
        """Restart a network device.
    
        Args:
            mac: Device MAC address.
    
        Returns:
            True if restart command was sent successfully.
        """
        await self._request(
            "POST",
            "/api/s/{site}/cmd/devmgr",
            json={"cmd": "restart", "mac": mac.lower()},
        )
        return True

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/nntkio/unifiMCP'

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