restart_system
Trigger a system restart for Domoticz. Requires setting confirm to true to prevent accidental reboots.
Instructions
Restart the Domoticz system. Requires confirm=True.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:910-917 (handler)The actual handler for the restart_system tool. It's an async function decorated with @mcp.tool(), requiring confirm=True to proceed. If confirmed, it calls the Domoticz API endpoint 'system_reboot' to restart the system.
@mcp.tool() async def restart_system(confirm: bool = False) -> str: """Restart the Domoticz system. Requires confirm=True.""" if not confirm: return '{"status": "error", "message": "You must set confirm=True to restart the system"}' async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=system_reboot") return response.text - src/domoticz_mcp/server.py:910-910 (registration)The @mcp.tool() decorator registers restart_system as an MCP tool on the FastMCP instance named 'Domoticz'.
@mcp.tool() - tests/test_server.py:684-684 (registration)Import of restart_system in the test file, showing it's exported from domoticz_mcp.server.
from domoticz_mcp.server import call_domoticz_api, check_for_updates, restart_system, get_camera_snapshot - tests/test_server.py:702-710 (helper)Test code for restart_system. Tests that confirm=False returns an error, and confirm=True successfully triggers the system_reboot API call.
# restart_system respx.get(f"{DOMOTICZ_API_URL}?type=command¶m=system_reboot").mock( return_value=Response(200, json={"status": "OK"}) ) response_fail = await restart_system(confirm=False) assert "error" in json.loads(response_fail)["status"] response_ok = await restart_system(confirm=True) assert json.loads(response_ok)["status"] == "OK"