restart_device
Restart UniFi network devices using their MAC addresses to resolve connectivity issues or apply configuration changes.
Instructions
Restart a UniFi network device by its MAC address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mac | Yes | MAC address of the device to restart (e.g., '00:11:22:33:44:55') |
Implementation Reference
- src/unifi_mcp/server.py:30-44 (registration)Registers the 'restart_device' tool including name, description, and input schema within the MCP server's list_tools() function.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"], }, ), # Client tools
- src/unifi_mcp/server.py:167-175 (handler)MCP tool handler in call_tool() that processes 'restart_device' arguments, invokes UniFiClient.restart_device(mac), and returns success TextContent.case "restart_device": mac = arguments.get("mac", "") await client.restart_device(mac) return [ TextContent( type="text", text=f"Restart command sent to device {mac}", ) ]
- src/unifi_mcp/unifi_client.py:189-203 (handler)Executes the actual UniFi API call to restart the device by posting to /api/s/{site}/cmd/devmgr with restart command and normalized MAC address.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