add_log_message
Add a custom message to the Domoticz system log with selectable severity levels: normal, status, or error.
Instructions
Add a custom message to the Domoticz system log. level: 1=normal, 2=status, 4=error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| level | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:1034-1039 (handler)The add_log_message async function is the tool handler that calls the Domoticz API to add a custom log message. It is decorated with @mcp.tool() which registers it as an MCP tool.
@mcp.tool() async def add_log_message(message: str, level: int = 2) -> str: """Add a custom message to the Domoticz system log. level: 1=normal, 2=status, 4=error.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=addlogmessage&message={urllib.parse.quote(message)}&level={level}") return response.text - src/domoticz_mcp/server.py:1034-1035 (schema)Input definition/schema for add_log_message: 'message' (str, required) and 'level' (int, default=2) with docstring describing valid levels (1=normal, 2=status, 4=error).
@mcp.tool() async def add_log_message(message: str, level: int = 2) -> str: - src/domoticz_mcp/server.py:1035-1035 (registration)The @mcp.tool() decorator on line 1033 registers add_log_message as an MCP tool on the FastMCP 'Domoticz' instance.
async def add_log_message(message: str, level: int = 2) -> str: - src/domoticz_mcp/server.py:1037-1038 (helper)Calls _do_request helper and urllib.parse.quote to send the message to Domoticz API endpoint with param=addlogmessage&message={encoded_message}&level={level}.
async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=addlogmessage&message={urllib.parse.quote(message)}&level={level}")