Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

create_event

Create a new event script in Domoticz by specifying name, language, trigger type, and source code to automate smart home actions based on device changes, time events, or user variables.

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 the Domoticz API to create a new event script with a given name, interpreter (e.g., Lua, Blockly, dzVents, Python), event type (e.g., All, Device, Security, Time, UserVariable), XML/source statement, and enabled/disabled status.
    @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
  • The create_event tool is registered as an MCP tool via the @mcp.tool() decorator on the FastMCP instance 'mcp'. This is the registration mechanism.
    @mcp.tool()
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 does not disclose side effects, validation, permissions, or success/failure behavior.

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

Conciseness4/5

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

The description is structured as a docstring with a clear purpose line and an Args list. It is concise with no redundant information, though the 'Args:' format adds a bit of verbosity.

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 presence of an output schema, the description need not explain return values. However, it lacks context on when to create vs update, error handling, or idempotency. It is minimally complete for a creation tool.

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?

With 0% schema description coverage, the description adds meaningful explanations for each parameter, including examples for interpreter and event_type, and clarifies eventstatus values. This compensates well for the schema gaps.

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' with a specific verb and resource. It distinguishes 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. It is implied for creating new events, but lacks explicit guidance on prerequisites or exclusions.

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