get_system_status
Retrieve the current version, build time, and status of your Domoticz home automation instance to ensure proper operation.
Instructions
Get the status of the Domoticz instance (version, build time, etc).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/domoticz_mcp/server.py:814-819 (handler)The actual implementation of the 'get_system_status' MCP tool. It queries the Domoticz JSON API with 'getversion' to retrieve system version/build info and returns the raw response.
@mcp.tool() async def get_system_status() -> str: """Get the status of the Domoticz instance (version, build time, etc).""" async with create_client() as client: response = await _do_request(client, "GET", f"{DOMOTICZ_API_URL}?type=command¶m=getversion") return response.text - src/domoticz_mcp/server.py:814-815 (registration)The tool is registered via the @mcp.tool() decorator on line 814, which registers it with the FastMCP instance ('mcp') created on line 70.
@mcp.tool() async def get_system_status() -> str: - src/domoticz_mcp/server.py:269-296 (helper)The _do_request helper handles HTTP requests with automatic OAuth token refresh on 401 responses. It's used by get_system_status to make the API call.
async def _do_request(client: httpx.AsyncClient, method: str, url: str, **kwargs) -> httpx.Response: """Perform a request with a single retry on 401 Unauthorized to handle expired tokens.""" global _oauth_token_cache try: resp = await client.request(method, url, **kwargs) if resp.status_code == 401: # Token might be expired. Clear cache and retry once. _oauth_token_cache = None # Re-fetch token (this will trigger OAuth flow if needed) new_token = await _fetch_oauth_token(force_refresh=True) if new_token: # Update headers for the retry if "headers" not in kwargs: kwargs["headers"] = {} kwargs["headers"]["Authorization"] = f"Bearer {new_token}" # Retry the request resp = await client.request(method, url, **kwargs) resp.raise_for_status() return resp except httpx.HTTPStatusError as e: if e.response.status_code == 401: raise Exception("Authentication failed. Please check your credentials or re-authenticate.") raise e