Skip to main content
Glama
Schimmilab

Withings MCP Server

by Schimmilab

get_measurements

Retrieve body measurements such as weight, fat mass, and muscle mass by specifying measurement type, date range, or last update timestamp.

Instructions

Get body measurements (weight, fat mass, muscle mass, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
meastypeNoMeasurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91
categoryNoMeasurement category: 1=real, 2=user_objective1
startdateNoStart date (YYYY-MM-DD) or Unix timestamp
enddateNoEnd date (YYYY-MM-DD) or Unix timestamp
lastupdateNoGet measurements modified since this timestamp

Implementation Reference

  • Tool registration for 'get_measurements' inside the list_tools handler, defining its name, description, and inputSchema with parameters meastype, category, startdate, enddate, lastupdate.
        Tool(
            name="get_measurements",
            description="Get body measurements (weight, fat mass, muscle mass, etc.)",
            inputSchema={
                "type": "object",
                "properties": {
                    "meastype": {
                        "type": "string",
                        "description": "Measurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91",
                        "enum": ["1", "4", "5", "6", "8", "9", "10", "11", "12", "54", "71", "76", "88", "91"],
                    },
                    "category": {
                        "type": "string",
                        "description": "Measurement category: 1=real, 2=user_objective",
                        "enum": ["1", "2"],
                        "default": "1",
                    },
                    "startdate": {
                        "type": "string",
                        "description": "Start date (YYYY-MM-DD) or Unix timestamp",
                    },
                    "enddate": {
                        "type": "string",
                        "description": "End date (YYYY-MM-DD) or Unix timestamp",
                    },
                    "lastupdate": {
                        "type": "string",
                        "description": "Get measurements modified since this timestamp",
                    },
                },
            },
        ),
        Tool(
            name="get_activity",
            description="Get daily activity data (steps, calories, distance, elevation)",
            inputSchema={
                "type": "object",
                "properties": {
                    "startdateymd": {
                        "type": "string",
                        "description": "Start date in YYYY-MM-DD format",
                    },
                    "enddateymd": {
                        "type": "string",
                        "description": "End date in YYYY-MM-DD format",
                    },
                    "lastupdate": {
                        "type": "string",
                        "description": "Get activities modified since this timestamp",
                    },
                },
            },
        ),
        Tool(
            name="get_sleep_summary",
            description="Get sleep summary data (duration, deep sleep, REM, wake up count, breathing disturbances, apnea, etc.)",
            inputSchema={
                "type": "object",
                "properties": {
                    "startdateymd": {
                        "type": "string",
                        "description": "Start date in YYYY-MM-DD format",
                    },
                    "enddateymd": {
                        "type": "string",
                        "description": "End date in YYYY-MM-DD format",
                    },
                    "lastupdate": {
                        "type": "string",
                        "description": "Get sleep data modified since this timestamp",
                    },
                    "data_fields": {
                        "type": "string",
                        "description": "Comma-separated list of data fields to include (e.g., 'breathing_disturbances_intensity,apnea_hypopnea_index,snoring,rr_average'). If not specified, returns default fields.",
                    },
                },
            },
        ),
        Tool(
            name="get_sleep_details",
            description="Get detailed sleep data with all sleep phases",
            inputSchema={
                "type": "object",
                "properties": {
                    "startdate": {
                        "type": "string",
                        "description": "Start date (YYYY-MM-DD) or Unix timestamp",
                    },
                    "enddate": {
                        "type": "string",
                        "description": "End date (YYYY-MM-DD) or Unix timestamp",
                    },
                },
            },
        ),
        Tool(
            name="get_workouts",
            description="Get workout/training sessions data",
            inputSchema={
                "type": "object",
                "properties": {
                    "startdateymd": {
                        "type": "string",
                        "description": "Start date in YYYY-MM-DD format",
                    },
                    "enddateymd": {
                        "type": "string",
                        "description": "End date in YYYY-MM-DD format",
                    },
                },
            },
        ),
        Tool(
            name="get_heart_rate",
            description="Get heart rate measurements over a time period",
            inputSchema={
                "type": "object",
                "properties": {
                    "startdate": {
                        "type": "string",
                        "description": "Start date (YYYY-MM-DD) or Unix timestamp",
                    },
                    "enddate": {
                        "type": "string",
                        "description": "End date (YYYY-MM-DD) or Unix timestamp",
                    },
                },
            },
        ),
        Tool(
            name="get_authorization_url",
            description="Get OAuth2 authorization URL to authenticate with Withings",
            inputSchema={
                "type": "object",
                "properties": {
                    "scope": {
                        "type": "string",
                        "description": "OAuth scopes (comma-separated): user.info, user.metrics, user.activity",
                        "default": "user.info,user.metrics,user.activity",
                    },
                },
            },
        ),
    ]
  • Input schema for 'get_measurements' tool defining all supported parameters and their types/enums.
        inputSchema={
            "type": "object",
            "properties": {
                "meastype": {
                    "type": "string",
                    "description": "Measurement type: weight=1, height=4, fat_free_mass=5, fat_ratio=6, fat_mass_weight=8, diastolic_bp=9, systolic_bp=10, heart_rate=11, temperature=12, spo2=54, body_temp=71, muscle_mass=76, bone_mass=88, pulse_wave_velocity=91",
                    "enum": ["1", "4", "5", "6", "8", "9", "10", "11", "12", "54", "71", "76", "88", "91"],
                },
                "category": {
                    "type": "string",
                    "description": "Measurement category: 1=real, 2=user_objective",
                    "enum": ["1", "2"],
                    "default": "1",
                },
                "startdate": {
                    "type": "string",
                    "description": "Start date (YYYY-MM-DD) or Unix timestamp",
                },
                "enddate": {
                    "type": "string",
                    "description": "End date (YYYY-MM-DD) or Unix timestamp",
                },
                "lastupdate": {
                    "type": "string",
                    "description": "Get measurements modified since this timestamp",
                },
            },
        },
    ),
  • Core handler for 'get_measurements' - builds the API request parameters with action='getmeas' and optional filters, then calls the Withings /measure endpoint.
    async def _get_measurements(self, args: dict) -> dict:
        """Get body measurements."""
        params = {"action": "getmeas"}
    
        if "meastype" in args:
            params["meastype"] = args["meastype"]
        if "category" in args:
            params["category"] = args["category"]
        if "startdate" in args:
            params["startdate"] = self._parse_date(args["startdate"])
        if "enddate" in args:
            params["enddate"] = self._parse_date(args["enddate"], end_of_day=True)
        if "lastupdate" in args:
            params["lastupdate"] = self._parse_date(args["lastupdate"])
    
        return await self._make_request("/measure", params)
  • Helper method _make_request used by get_measurements to make authenticated requests to the Withings API, with automatic token refresh on 401 errors.
    async def _make_request(self, endpoint: str, params: dict, retry_on_401: bool = True) -> dict:
        """Make authenticated request to Withings API."""
        headers = self.auth.get_headers()
        async with httpx.AsyncClient() as client:
            response = await client.get(
                f"{self.base_url}{endpoint}",
                headers=headers,
                params=params,
            )
    
            # Don't raise for status yet - check for 401 first
            data = response.json()
    
            # Handle 401 - token expired, try refresh and retry once
            if data.get("status") == 401 and retry_on_401:
                await self.auth.refresh_access_token()
                # Retry the request with new token
                return await self._make_request(endpoint, params, retry_on_401=False)
    
            # Check for other API errors
            if data.get("status") != 0:
                raise Exception(f"API error: {data}")
    
            return data.get("body", {})
  • Tool call routing: dispatches 'get_measurements' tool name to the _get_measurements handler method.
    elif name == "get_measurements":
        result = await self._get_measurements(arguments)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and description only restates basic purpose without disclosing behavioral traits like pagination, permissions, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with specific examples, efficiently front-loaded, though extreme brevity may limit completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 5 parameters and no output schema, description lacks guidance on output format, optionality, or typical usage patterns, leaving gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; description lists example types but adds little meaning beyond what is already in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'get' and resource 'body measurements' with examples, distinguishing it from siblings like get_heart_rate or get_activity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs. alternatives, no prerequisites or exclusions mentioned, leaving the agent to infer context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Schimmilab/withings-mcp-server'

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