Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

update_event

Modify an existing Domoticz event script. Specify event ID, name, interpreter language, trigger type, source code, and enable/disable status.

Instructions

Update an existing event script in Domoticz.

Args: event_id: The ID of the event to update. name: Name of the event script. interpreter: The language (e.g., 'Lua', 'Blockly', 'dzVents', 'Python'). event_type: Trigger type (e.g., 'All', 'Device', 'Security', 'Time', 'UserVariable'). xmlstatement: The source code (or XML for Blockly) of the script. eventstatus: '1' for enabled, '0' for disabled.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_idYes
nameYes
interpreterYes
event_typeYes
xmlstatementYes
eventstatusNo1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The update_event tool handler: an async function decorated with @mcp.tool() that sends a POST request to the Domoticz API with evparam='create', eventid, name, interpreter, xmlstatement, eventtype and logicarray to update an existing event script.
    @mcp.tool()
    async def update_event(event_id: int, name: str, interpreter: str, event_type: str, xmlstatement: str, eventstatus: str = "1") -> str:
        """Update an existing event script in Domoticz.
        
        Args:
            event_id: The ID of the event to update.
            name: Name of the event script.
            interpreter: The language (e.g., 'Lua', 'Blockly', 'dzVents', 'Python').
            event_type: Trigger type (e.g., 'All', 'Device', 'Security', 'Time', 'UserVariable').
            xmlstatement: The source code (or XML for Blockly) of the script.
            eventstatus: '1' for enabled, '0' for disabled.
        """
        async with create_client() as client:
            data = {
                "evparam": "create",
                "eventid": str(event_id),
                "name": name,
                "eventstatus": eventstatus,
                "interpreter": interpreter,
                "xml": xmlstatement,
                "eventtype": event_type,
                "logicarray": ""
            }
            response = await _do_request(client, "POST", f"{DOMOTICZ_API_URL}?type=command¶m=events", data=data)
            return response.text
  • The update_event tool is registered with MCP via the @mcp.tool() decorator on line 861, using the FastMCP instance created on line 70.
    @mcp.tool()
    async def update_event(event_id: int, name: str, interpreter: str, event_type: str, xmlstatement: str, eventstatus: str = "1") -> str:
  • Input schema defined in the docstring/type hints: event_id (int), name (str), interpreter (str), event_type (str), xmlstatement (str), eventstatus (str, default '1'). The function returns a JSON string response.
    async def update_event(event_id: int, name: str, interpreter: str, event_type: str, xmlstatement: str, eventstatus: str = "1") -> str:
        """Update an existing event script in Domoticz.
        
        Args:
            event_id: The ID of the event to update.
            name: Name of the event script.
            interpreter: The language (e.g., 'Lua', 'Blockly', 'dzVents', 'Python').
            event_type: Trigger type (e.g., 'All', 'Device', 'Security', 'Time', 'UserVariable').
            xmlstatement: The source code (or XML for Blockly) of the script.
            eventstatus: '1' for enabled, '0' for disabled.
        """
  • Uses the helper DomoticzClient (create_client) and _do_request to make the HTTP POST request to the Domoticz JSON API endpoint for updating events.
    async with create_client() as client:
        data = {
            "evparam": "create",
            "eventid": str(event_id),
            "name": name,
            "eventstatus": eventstatus,
            "interpreter": interpreter,
            "xml": xmlstatement,
            "eventtype": event_type,
            "logicarray": ""
        }
        response = await _do_request(client, "POST", f"{DOMOTICZ_API_URL}?type=command¶m=events", data=data)
        return response.text
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully disclose behavioral traits. It only says 'Update an existing event script' and lists parameters. It does not mention idempotency, side effects, error handling, or requirements like event existence. This is minimal disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single summary line followed by a bullet-style argument list in a standard format. Every sentence adds information without redundancy. It is efficient and well-organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately explains all parameters but lacks usage context, behavioral details, and return value information (though output schema exists). Given the tool's complexity (6 params, no annotations), it is minimally sufficient but leaves gaps for an agent to operate reliably.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, the description adds meaning for all 6 parameters. For example, interpreter lists example languages, event_type provides trigger types, xmlstatement explains source code vs XML, and eventstatus decodes '1'/'0'. This compensates well for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Update an existing event script in Domoticz', clearly specifying the verb (update) and resource (event script). This distinguishes it from sibling tools like create_event (create). However, it does not explicitly differentiate from other update tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives (e.g., create_event or get_event). It lacks any context about prerequisites or preferred scenarios, leaving the agent to infer usage solely from the tool name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adrighem/domoticz-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server