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
| 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:167-175 (handler)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}", ) ]
- src/unifi_mcp/server.py:30-43 (registration)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"], }, ),
- src/unifi_mcp/server.py:30-43 (schema)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