Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

get_connectivity_report

Identifies smart home devices that haven't reported in within a specified number of hours, helping you detect connectivity issues.

Instructions

Get a list of devices that haven't checked in/updated within the specified timeframe.

Args: hours: Number of hours threshold for considering a device 'unresponsive' (default: 24).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hoursNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for get_connectivity_report tool. Fetches all devices, filters those whose LastUpdate is older than the specified hours threshold, and returns a sorted list of unresponsive devices.
    @mcp.tool()
    async def get_connectivity_report(hours: int = 24) -> str:
        """Get a list of devices that haven't checked in/updated within the specified timeframe.
        
        Args:
            hours: Number of hours threshold for considering a device 'unresponsive' (default: 24).
        """
        async with create_client() as client:
            devices = await _get_cached_data(client, _device_cache, f"{DOMOTICZ_API_URL}?type=command¶m=getdevices&filter=all&used=true")
            now = datetime.now()
            threshold_time = now - timedelta(hours=hours)
            results = []
            
            for dev in devices:
                last_update_str = dev.get("LastUpdate")
                if not last_update_str:
                    continue
                    
                try:
                    # Domoticz format: YYYY-MM-DD HH:MM:SS
                    last_update = datetime.strptime(last_update_str, "%Y-%m-%d %H:%M:%S")
                    if last_update < threshold_time:
                        results.append({
                            "idx": dev.get("idx"),
                            "Name": dev.get("Name"),
                            "LastUpdate": last_update_str,
                            "HardwareName": dev.get("HardwareName"),
                            "Type": dev.get("Type"),
                            "Data": dev.get("Data")
                        })
                except ValueError:
                    continue
                    
            # Sort by oldest update first
            results.sort(key=lambda x: x["LastUpdate"])
            return json.dumps({"status": "OK", "result": results})
  • Registration of get_connectivity_report as an MCP tool via the @mcp.tool() decorator on line 1074.
    @mcp.tool()
  • Input schema for get_connectivity_report: accepts a single integer parameter 'hours' (default 24) representing the threshold for considering a device unresponsive.
    async def get_connectivity_report(hours: int = 24) -> str:
        """Get a list of devices that haven't checked in/updated within the specified timeframe.
        
        Args:
            hours: Number of hours threshold for considering a device 'unresponsive' (default: 24).
        """
  • Helper function _get_cached_data used by get_connectivity_report to fetch and cache the device list from 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"]
Behavior2/5

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

No annotations are provided, so the description must disclose behavior. It mentions returning a list of devices but does not detail what information the list contains (e.g., device IDs, last check-in time), whether it is paginated, or if there are permission requirements. The description also fails to define 'checked in/updated' clearly.

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 brief with two sentences, clearly stating the purpose and the parameter. It is front-loaded with the main action. However, it could be slightly more structured by separating the summary from parameter details explicitly.

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 tool has an output schema (not shown), the description does not need to detail return values. However, it fails to specify what fields the returned devices include (e.g., names, last check-in time). The parameter explanation is good, but more context about the output would improve completeness.

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 only provides the type and default for 'hours' with no description. The description adds crucial meaning by explaining that the parameter is the number of hours threshold for unresponsiveness. This compensates for the 0% schema description coverage.

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

Purpose4/5

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

The description clearly states the tool returns a list of devices based on a time threshold. It specifies the verb 'get' and the resource 'devices that haven't checked in/updated'. However, it does not explicitly distinguish from siblings like get_all_devices or get_device_history, which also retrieve device information.

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 implies the tool is for finding unresponsive devices by specifying a timeframe threshold. However, it lacks explicit guidance on when not to use it (e.g., for real-time status) or alternatives (e.g., get_device for a single device).

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