get_events
Retrieve an overview of internal event system scripts and rules to understand automated behaviors in Domoticz.
Instructions
Get overview of the internal event system scripts and rules.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:815-820 (handler)The main tool implementation for get_events. Calls Domoticz API with param=events&evparam=list, caches the result using _device_cache, and returns JSON.
@mcp.tool() async def get_events() -> str: """Get overview of the internal event system scripts and rules.""" async with create_client() as client: events = await _get_cached_data(client, _device_cache, f"{DOMOTICZ_API_URL}?type=command¶m=events&evparam=list") return json.dumps({"status": "OK", "result": events}) - src/domoticz_mcp/server.py:815-815 (registration)Registered as an MCP tool via the @mcp.tool() decorator on the get_events async function.
@mcp.tool() - src/domoticz_mcp/server.py:815-817 (schema)Tool takes no parameters and returns a JSON string. The docstring describes it as returning an overview of the internal event system scripts and rules.
@mcp.tool() async def get_events() -> str: """Get overview of the internal event system scripts and rules.""" - src/domoticz_mcp/server.py:346-352 (helper)Helper function used by get_events to fetch and cache data from the Domoticz API.
async def _get_cached_data(client: "httpx.AsyncClient", cache_obj: Dict[str, Any], api_url: str, key_path: str = "result") -> List[Dict[str, Any]]: now = time.time() if cache_obj["data"] is None or (now - cache_obj["timestamp"]) > CACHE_TTL: response = await _do_request(client, "GET", api_url) cache_obj["data"] = response.json().get(key_path, []) cache_obj["timestamp"] = now return cache_obj["data"] - src/domoticz_mcp/server.py:1279-1284 (handler)A resource handler also exposing the events data at the domoticz://events URI, using the same Domoticz API endpoint.
@mcp.resource("domoticz://events") async def get_events_resource() -> str: """Read the overview of the internal event system scripts and rules.""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=events&evparam=list") return response.text