wyze_get_devices
Retrieve a comprehensive list of all Wyze devices linked to your account for streamlined management and monitoring. Part of the MCP Wyze Server for smart home control.
Instructions
Get list of all Wyze devices associated with the account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_wyze_server/server.py:59-88 (handler)The core handler function for the 'wyze_get_devices' tool. It retrieves the Wyze client, lists all devices using client.devices_list(), processes device information (mac, nickname, product_model, product_type, is_online, firmware_ver), and returns a structured list with status and count. Handles various exceptions.@mcp.tool() def wyze_get_devices() -> Dict[str, Any]: """Get list of all Wyze devices associated with the account""" try: client = get_wyze_client() devices = client.devices_list() device_list = [] for device in devices: device_info = { "mac": str(device.mac) if device.mac else "Unknown", "nickname": str(device.nickname) if device.nickname else "Unknown", "product_model": str(getattr(device, 'product_model', 'Unknown')) if getattr(device, 'product_model', 'Unknown') else "Unknown", "product_type": str(getattr(device, 'product_type', 'Unknown')) if getattr(device, 'product_type', 'Unknown') else "Unknown", "is_online": bool(getattr(device, 'is_online', True)), "firmware_ver": str(getattr(device, 'firmware_ver', 'N/A')), } device_list.append(device_info) return { "status": "success", "devices": device_list, "count": len(device_list) } except WyzeClientConfigurationError as e: return {"status": "error", "message": f"Configuration error: {str(e)}"} except WyzeRequestError as e: return {"status": "error", "message": f"API error: {str(e)}"} except Exception as e: return {"status": "error", "message": f"Unexpected error: {str(e)}"}
- src/mcp_wyze_server/server.py:21-44 (helper)Helper function that initializes and returns the singleton Wyze Client instance using credentials from environment variables (WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY). Used by all Wyze tools including wyze_get_devices.def get_wyze_client() -> Client: """Get or create Wyze client instance with auto-login if credentials available""" global _wyze_client if _wyze_client is None: # Get credentials from environment email = os.getenv("WYZE_EMAIL") password = os.getenv("WYZE_PASSWORD") key_id = os.getenv("WYZE_KEY_ID") api_key = os.getenv("WYZE_API_KEY") if not all([email, password, key_id, api_key]): raise WyzeClientConfigurationError( "Missing required environment variables: WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY" ) _wyze_client = Client( email=email, password=password, key_id=key_id, api_key=api_key ) return _wyze_client
- src/mcp_wyze_server/server.py:59-59 (registration)The @mcp.tool() decorator registers the wyze_get_devices function as an MCP tool in the FastMCP server instance.@mcp.tool()