wyze_get_devices
Retrieve a comprehensive list of all Wyze smart home devices linked to your account for monitoring and management.
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-89 (handler)The handler function decorated with @mcp.tool() that implements the wyze_get_devices tool logic. It retrieves the list of Wyze devices using the SDK, extracts relevant info, and returns formatted data or error messages.@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 global Wyze SDK client instance using environment variables for authentication. Called by 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.@mcp.tool()