get_log
Retrieve the main system log filtered by time and severity to monitor home automation events.
Instructions
Retrieve the main system log. lastlogtime is seconds since epoch, loglevel is bitmask.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lastlogtime | No | ||
| loglevel | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:1027-1032 (handler)The MCP tool handler for 'get_log'. It retrieves the main Domoticz system log with parameters lastlogtime (seconds since epoch) and loglevel (bitmask).
@mcp.tool() async def get_log(lastlogtime: int = 0, loglevel: int = 268435455) -> str: """Retrieve the main system log. lastlogtime is seconds since epoch, loglevel is bitmask.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getlog&lastlogtime={lastlogtime}&loglevel={loglevel}") return response.text - src/domoticz_mcp/server.py:1027-1028 (registration)The tool is registered with the MCP framework using the @mcp.tool() decorator on line 1027.
@mcp.tool() async def get_log(lastlogtime: int = 0, loglevel: int = 268435455) -> str: - src/domoticz_mcp/server.py:1028-1032 (schema)Input schema: lastlogtime (int, default 0) and loglevel (int, default 268435455 which is all log levels) as described in the docstring.
async def get_log(lastlogtime: int = 0, loglevel: int = 268435455) -> str: """Retrieve the main system log. lastlogtime is seconds since epoch, loglevel is bitmask.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getlog&lastlogtime={lastlogtime}&loglevel={loglevel}") return response.text - src/domoticz_mcp/server.py:1154-1159 (helper)A related resource 'domoticz://log' that also reads the system log using getlog with all log levels (268435455 = 0xFFFFFFF).
@mcp.resource("domoticz://log") async def get_log_resource() -> str: """Read the current Domoticz system log.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getlog&lastlogtime=0&loglevel=268435455") return response.text - src/domoticz_mcp/server.py:510-516 (helper)Another related resource 'domoticz://logs/error' that reads only Error-level (loglevel=4) log entries.
@mcp.resource("domoticz://logs/error") async def get_error_logs_resource() -> str: """Read only the 'Error' level entries from the Domoticz system log.""" async with create_client() as client: # loglevel 4 is ERR response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getlog&lastlogtime=0&loglevel=4") return response.text