wyze_get_scales
Retrieve all Wyze smart scales linked to your account for health tracking and device management.
Instructions
Get list of all Wyze scales associated with the account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_wyze_server/server.py:234-263 (handler)The primary handler function for the wyze_get_scales tool, decorated with @mcp.tool() for automatic registration in the FastMCP server. It fetches all Wyze scales using the SDK, extracts key information like MAC, nickname, model, online status, and firmware, then returns a formatted list with count and status.
@mcp.tool() def wyze_get_scales() -> Dict[str, Any]: """Get list of all Wyze scales associated with the account""" try: client = get_wyze_client() scales = client.scales.list() scale_list = [] for scale in scales: scale_info = { "mac": str(scale.mac) if scale.mac else "Unknown", "nickname": str(scale.nickname) if scale.nickname else "Unknown", "product_model": str(getattr(scale, 'product_model', 'Unknown')) if getattr(scale, 'product_model', 'Unknown') else "Unknown", "product_type": str(getattr(scale, 'product_type', 'Scale')) if getattr(scale, 'product_type', 'Scale') else "Scale", "is_online": bool(getattr(scale, 'is_online', True)), "firmware_ver": str(getattr(scale, 'firmware_ver', 'N/A')), } scale_list.append(scale_info) return { "status": "success", "scales": scale_list, "count": len(scale_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)Shared helper function used by wyze_get_scales (and other tools) to obtain the authenticated Wyze Client instance from environment variables.
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