Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

search_devices

Search for smart home devices by name or status to find matching 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
offsetNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The search_devices tool handler: an async function decorated with @mcp.tool() that searches all devices by name or data (status) using a case-insensitive substring match, with pagination support.
    @mcp.tool()
    async def search_devices(query: str, offset: int = 0, limit: int = 50) -> 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)
            paginated = _paginate(results, offset, limit)
            return json.dumps({"status": "OK", "result": paginated, "total_count": len(results), "offset": offset, "limit": limit})
  • The @mcp.tool() decorator on line 549 registers search_devices as an MCP tool with the FastMCP server instance.
    @mcp.tool()
  • The function signature defines the input schema: query (required string), offset (int, default 0), limit (int, default 50). The return type is str (JSON).
    async def search_devices(query: str, offset: int = 0, limit: int = 50) -> str:
  • The _paginate helper function used by search_devices to slice results by offset and limit.
    def _paginate(data: list, offset: int, limit: int) -> list:
        """Paginate a list of results."""
        return data[offset:offset + limit]
Behavior2/5

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

No annotations provided. Description does not mention pagination behavior despite offset and limit parameters, nor does it clarify that it is read-only. Minimal behavioral context beyond search and return.

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?

One sentence, front-loaded. It is concise but ambiguous in parts. Could be improved without losing brevity.

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?

Adequate for a simple search tool with output schema, but missing details on pagination and exact parameter usage. Not fully complete given the three parameters.

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

Parameters2/5

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

Schema coverage is 0%. Description hints that 'query' may be a name or status, but does not define offset or limit. Adds little meaning beyond the schema itself.

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?

Description clearly states it searches devices by name or status and returns a list. However, 'data (status)' is ambiguous; it could be clearer. It distinguishes from siblings like get_all_devices and get_device by focusing on search functionality.

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 siblings like get_all_devices or search_scripts. No mention of alternatives or when not to use it.

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