Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

search_devices

Search for smart home devices by name or status to find specific devices in your Domoticz system.

Instructions

Search for devices by name or data (status). Returns a list of matching devices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler/implementation of the search_devices tool. It fetches all devices from Domoticz API, then filters locally by matching the query string against device name or data (case-insensitive). The function is decorated with @mcp.tool() which registers it as an MCP tool.
    @mcp.tool()
    async def search_devices(query: str) -> str:
        """Search for devices by name or data (status). Returns a list of matching devices."""
        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")
            query_lower = query.lower()
            results = []
            for dev in devices:
                if query_lower in dev.get("Name", "").lower() or query_lower in dev.get("Data", "").lower():
                    results.append(dev)
            return json.dumps({"status": "OK", "result": results})
  • The tool is registered with the MCP server via the @mcp.tool() decorator on line 544, immediately above the search_devices function definition.
    @mcp.tool()
  • The _get_cached_data helper function is used by search_devices to fetch and cache device 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"]
  • The input schema for search_devices: it accepts a single required 'query' parameter of type str. The output schema is a JSON string with status 'OK' and a 'result' array of matching device dictionaries.
    async def search_devices(query: str) -> str:
Behavior2/5

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

With no annotations, the description must disclose behavioral traits, but it only states it returns matching devices. It does not explain search behavior (e.g., partial matching, case sensitivity), side effects, or authentication needs. The vague mention of 'data (status)' lacks clarity.

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 a single sentence, concise and front-loaded with the core action. It has no wasted words, but could benefit from being split into purpose and additional details (e.g., output).

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 one parameter and an output schema (not described), the description minimally covers the tool's purpose. It lacks details on output format, pagination, or limitations, which are needed for full understanding alongside sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning to the 'query' parameter by indicating it can be a device name or status, which the schema alone (a bare string) does not convey. However, it does not specify valid statuses or search syntax, limiting its usefulness.

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's action ('Search for devices') and criteria ('by name or data (status)'). It distinguishes from sibling tools like get_all_devices (which lists all without search) and get_device (which retrieves a specific device by ID), making its purpose unambiguous.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention scenarios, prerequisites, or explicit exclusions, leaving the agent to infer usage from context.

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