Skip to main content
Glama
aldilaff
by aldilaff

wyze_get_scale_records

Retrieve weight measurement records from Wyze smart scales to track health metrics over time.

Instructions

Get weight measurement records from a Wyze scale

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_macNo
user_idNo
days_backNo

Implementation Reference

  • The handler function for 'wyze_get_scale_records' tool. It fetches scale records using wyze-sdk's client.scales.get_records(), processes them into a list with weight, BMI, body fat, etc., and returns a structured response. Registered with the MCP server via the @mcp.tool() decorator. Input schema defined by function parameters: device_mac (optional str), user_id (optional str), days_back (int default 30).
    @mcp.tool()
    def wyze_get_scale_records(
        device_mac: str = None,
        user_id: str = None,
        days_back: int = 30
    ) -> Dict[str, Any]:
        """Get weight measurement records from a Wyze scale"""
        try:
            from datetime import datetime, timedelta
            
            client = get_wyze_client()
            
            # Calculate time range
            end_time = datetime.now()
            start_time = end_time - timedelta(days=days_back)
            
            records = client.scales.get_records(
                user_id=user_id,
                start_time=start_time,
                end_time=end_time
            )
            
            record_list = []
            for record in records:
                record_info = {
                    "measure_time": int(record.measure_ts) if hasattr(record, 'measure_ts') and record.measure_ts else None,
                    "weight": float(record.weight) if hasattr(record, 'weight') and record.weight is not None else None,
                    "bmi": float(record.bmi) if hasattr(record, 'bmi') and record.bmi is not None else None,
                    "body_fat": float(record.body_fat) if hasattr(record, 'body_fat') and record.body_fat is not None else None,
                    "muscle_mass": float(record.muscle) if hasattr(record, 'muscle') and record.muscle is not None else None,
                    "heart_rate": int(record.heart_rate) if hasattr(record, 'heart_rate') and record.heart_rate is not None else None,
                }
                record_list.append(record_info)
            
            return {
                "status": "success",
                "records": record_list,
                "count": len(record_list),
                "days_back": days_back
            }
        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)}"}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aldilaff/mcp-wyze-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server