wyze_get_scale_info
Retrieve detailed information about a specific Wyze smart scale by providing its MAC address to access device data and health metrics.
Instructions
Get detailed information about a specific Wyze scale
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_mac | Yes |
Implementation Reference
- src/mcp_wyze_server/server.py:266-304 (handler)The handler function for the 'wyze_get_scale_info' tool. It uses the Wyze SDK to fetch detailed scale information including family members by device MAC address. The @mcp.tool() decorator automatically registers it with the MCP server.@mcp.tool() def wyze_get_scale_info(device_mac: str) -> Dict[str, Any]: """Get detailed information about a specific Wyze scale""" try: client = get_wyze_client() scale = client.scales.info(device_mac=device_mac) if scale is None: return {"status": "error", "message": f"Scale with MAC {device_mac} not found"} 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')), } # Add family members if available if hasattr(scale, 'family_members') and scale.family_members: family_members = [] for member in scale.family_members: member_info = { "id": str(member.get("id", "Unknown")), "nickname": str(member.get("nickname", "Unknown")), "height": float(member.get("height")) if member.get("height") is not None else None, "goal_weight": float(member.get("goal_weight")) if member.get("goal_weight") is not None else None, } family_members.append(member_info) scale_info["family_members"] = family_members return {"status": "success", "scale": scale_info} 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-45 (helper)Helper function to get or initialize the global Wyze client instance, used by wyze_get_scale_info and other tools.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