Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

create_event

Create a new event script in Domoticz by specifying its name, interpreter, trigger type, source code, and enabled status.

Instructions

Create a new event script in Domoticz.

Args: 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
nameYes
interpreterYes
event_typeYes
xmlstatementYes
eventstatusNo1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The create_event MCP tool handler function. It sends a POST request to Domoticz API to create a new event script, accepting parameters: name, interpreter, event_type, xmlstatement, and optional eventstatus (default enabled).
    @mcp.tool()
    async def create_event(name: str, interpreter: str, event_type: str, xmlstatement: str, eventstatus: str = "1") -> str:
        """Create a new event script in Domoticz.
        
        Args:
            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",
                "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
Behavior3/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 explains the parameters and their meanings (e.g., interpreter languages, event_type trigger types, xmlstatement as source code, eventstatus as enable/disable). However, it does not disclose what happens on success (e.g., whether an event ID is returned) or any side effects, leaving some behavioral aspects unclear.

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: one introductory sentence followed by a clean list of parameters under 'Args:'. No redundant words, and the most important information is front-loaded.

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

Completeness4/5

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

Given the existence of an output schema and sibling tools, the description adequately covers the main parameters and their roles. It could mention the return value or behavior on duplicate names, but the current level is sufficient for a creation tool. The presence of an output schema reduces the need to describe return format.

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?

Schema coverage is 0%, so the description must add meaning. It does so by explaining each parameter: 'interpreter' gives examples ('Lua', 'Blockly'), 'event_type' gives examples, 'xmlstatement' clarifies it can be source code or XML, and 'eventstatus' specifies valid values ('1' for enabled, '0' for disabled). This goes beyond the schema's mere 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 'Create a new event script in Domoticz.' It uses a specific verb ('Create') and resource ('event script'), distinguishing it from siblings like 'update_event' and 'get_events'.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives. While the purpose is clear, there is no guidance on when not to use it or comparison to similar tools like 'update_event'. The context from sibling tools implies usage for creation only.

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