Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

update_event

Update an existing Domoticz event script by specifying its ID, name, language, trigger type, source code, and enabled state.

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 main handler function for the 'update_event' tool. It is an async function decorated with @mcp.tool(), which takes event_id, name, interpreter, event_type, xmlstatement, and eventstatus parameters. It sends a POST request to the Domoticz API 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 @mcp.tool() decorator on line 853 registers 'update_event' as a tool with the FastMCP server, making it available for use via the MCP protocol.
    @mcp.tool()
    async def update_event(event_id: int, name: str, interpreter: str, event_type: str, xmlstatement: str, eventstatus: str = "1") -> str:
  • The docstring serves as the schema/input specification for the update_event tool, defining parameters: event_id (int), name (str), interpreter (str), event_type (str), xmlstatement (str), and eventstatus (str with default '1').
    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.
        """
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It only lists parameters and their roles, but does not disclose behavioral traits such as side effects, authentication requirements, or whether the update is incremental or full. The agent cannot infer if all fields must be provided or if partial updates are supported.

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 concise and well-structured: a single purpose sentence followed by a bulleted list of parameters. Every sentence provides necessary information without redundancy. It is front-loaded with the core action, making it easy for an agent to parse quickly.

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?

Given the complexity of 6 parameters (5 required) and no other contextual fields, the description adequately covers parameter semantics but lacks higher-level context such as error handling, prerequisites (e.g., event must exist), or return value behavior despite having an output schema. The agent may need additional information to use the tool safely.

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?

The input schema has 0% description coverage, so the description must compensate. It provides clear explanations for all 6 parameters, including examples for interpreter (e.g., 'Lua', 'Blockly', 'dzVents', 'Python') and explicit meaning for eventstatus ('1' for enabled, '0' for disabled). This adds significant value beyond the basic schema titles.

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

Purpose5/5

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

The description clearly states 'Update an existing event script in Domoticz.' It uses a specific verb 'update' and resource 'event script', with 'existing' implying modification, not creation. This distinguishes it from the sibling tool 'create_event' without needing explicit mention.

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 does not provide any guidance on when to use this tool versus alternatives like 'create_event' or 'delete_device' (if applicable). There is no explicit when-to-use or when-not-to-use advice, leaving the agent to infer usage from the name alone.

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