Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

get_system_health

Check Domoticz system and hardware gateway health to monitor stability and identify issues.

Instructions

Check the health of the Domoticz system and hardware gateways.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler/implementation of the `get_system_health` tool. It queries Domoticz hardware gateways for health status, checks for unresponsive devices (no update in >24h), and returns a JSON response with hardware_health and unresponsive_devices_count.
    @mcp.tool()
    async def get_system_health() -> str:
        """Check the health of the Domoticz system and hardware gateways."""
        async with create_client() as client:
            hw_resp = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=gethardware")
            hardware = hw_resp.json().get("result", [])
            
            health_report = []
            for hw in hardware:
                status = "Online" if hw.get("Enabled") == "true" else "Disabled"
                health_report.append({
                    "Name": hw.get("Name"),
                    "Type": hw.get("Type"),
                    "Status": status,
                    "Address": hw.get("Address"),
                    "Port": hw.get("Port")
                })
                
            # Check for unresponsive devices (last update > 24h)
            devices = await _get_cached_data(client, _device_cache, f"{DOMOTICZ_API_URL}?type=command¶m=getdevices&filter=all&used=true")
            now = datetime.now()
            unresponsive_count = 0
            for dev in devices:
                last_update_str = dev.get("LastUpdate")
                if last_update_str:
                    try:
                        last_update = datetime.strptime(last_update_str, "%Y-%m-%d %H:%M:%S")
                        if now - last_update > timedelta(hours=24):
                            unresponsive_count += 1
                    except ValueError:
                        continue
                        
            return json.dumps({
                "status": "OK", 
                "result": {
                    "hardware_health": health_report,
                    "unresponsive_devices_count": unresponsive_count,
                    "recommendation": "Use `get_connectivity_report` for a detailed list of unresponsive devices." if unresponsive_count > 0 else "System looks healthy."
                }
            })
  • The tool is registered via the `@mcp.tool()` decorator on line 440, which is the standard MCP registration mechanism using the FastMCP server instance.
    @mcp.tool()
  • The function signature `async def get_system_health() -> str` defines the schema: no input parameters, returns a JSON string.
    async def get_system_health() -> str:
  • The `create_client` helper (which returns a `DomoticzClient`) is used by `get_system_health` to obtain an authenticated HTTP client for API calls.
    # Custom AsyncClient wrapper that ensures the token is added
  • The `_get_cached_data` helper is used by `get_system_health` to fetch device data with caching support.
    async def _get_cached_data(client: "httpx.AsyncClient", cache_obj: Dict[str, Any], api_url: str, key_path: str = "result") -> List[Dict[str, Any]]:
Behavior1/5

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

No annotations exist, and the description does not disclose any behavioral traits (e.g., read-only, internal checks) beyond the bare purpose.

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

Conciseness3/5

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

Single sentence is concise but omits useful details; it is front-loaded but too minimal.

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

Completeness2/5

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

Given no parameters and an output schema (not described), the description fails to explain what 'health' entails or what the output contains, leaving gaps.

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?

No parameters exist, so baseline is 4. The description adds no further meaning, but schema coverage is 100%.

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 the tool checks the health of the Domoticz system and hardware gateways, using a specific verb and resource, distinguishing it from siblings like get_system_status.

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?

No guidance on when to use this tool versus alternatives (e.g., get_system_status), nor any exclusions or prerequisites.

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