Skip to main content
Glama
adrighem

Domoticz MCP Server

by adrighem

get_all_devices

Retrieve all devices and their current states from Domoticz. Use optional offset and limit to paginate results.

Instructions

Get all devices and their current states from Domoticz.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_all_devices' tool. It is decorated with @mcp.tool(), fetches all devices from the Domoticz API with caching, supports pagination via offset/limit, and returns a JSON response with status, result, total_count, offset, and limit.
    @mcp.tool()
    async def get_all_devices(offset: int = 0, limit: int = 50) -> str:
        """Get all devices and their current states from Domoticz."""
        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&order=Name")
            paginated = _paginate(devices, offset, limit)
            return json.dumps({"status": "OK", "result": paginated, "total_count": len(devices), "offset": offset, "limit": limit})
  • The @mcp.tool() decorator on line 541 registers get_all_devices as an MCP tool with the FastMCP server instance 'mcp'.
    @mcp.tool()
  • The _get_cached_data helper function is used by get_all_devices to fetch and cache device data from the Domoticz JSON 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 _paginate helper function is used by get_all_devices to slice the results list based on offset and limit parameters.
    def _paginate(data: list, offset: int, limit: int) -> list:
        """Paginate a list of results."""
        return data[offset:offset + limit]
  • The function signature defines the input schema: offset (int, default 0) and limit (int, default 50). The output schema is implicitly JSON with fields: status, result, total_count, offset, limit.
    async def get_all_devices(offset: int = 0, limit: int = 50) -> str:
Behavior2/5

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

No annotations provided. Description implies read-only but doesn't explicitly state safety, data volume, or any side effects. Minimal behavioral disclosure for a list-all operation.

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

Conciseness2/5

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

Single sentence is too under-specified for a tool with two parameters. Conciseness should not sacrifice essential information about pagination and result set.

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?

With 2 parameters and a sibling list of ~50 tools, the description lacks details on output format, pagination behavior, and use cases. Bare minimum for operation but not for accurate invocation.

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

Parameters1/5

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

Schema parameters (offset, limit) have 0% description coverage. The description does not mention these parameters at all, failing to explain pagination or how to control results.

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 verb 'Get', resource 'all devices', and scope 'current states' from Domoticz. It distinguishes from siblings like 'get_device' (single device) and 'search_devices' (search).

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 vs alternatives. Doesn't mention pagination, filtering, or prerequisites. Leaves agent to infer context from name alone.

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