Skip to main content
Glama

get_sleep_details

Retrieve detailed sleep analysis data including sleep phases from Withings Health API to monitor sleep patterns and quality over specified date ranges.

Instructions

Get detailed sleep data with all sleep phases

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startdateNoStart date (YYYY-MM-DD) or Unix timestamp
enddateNoEnd date (YYYY-MM-DD) or Unix timestamp

Implementation Reference

  • The core handler function `_get_sleep_details` that constructs the API parameters (action='get', startdate/enddate parsed to timestamps) and calls `_make_request` to the Withings `/v2/sleep` endpoint to retrieve detailed sleep data including phases.
    async def _get_sleep_details(self, args: dict) -> dict: """Get detailed sleep data.""" params = {"action": "get"} if "startdate" in args: params["startdate"] = self._parse_date(args["startdate"]) if "enddate" in args: params["enddate"] = self._parse_date(args["enddate"]) return await self._make_request("/v2/sleep", params)
  • Registration of the `get_sleep_details` tool in the `list_tools()` function, defining its name, description, and input schema for startdate and enddate parameters.
    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", }, }, }, ),
  • Input schema definition for the `get_sleep_details` tool, specifying object type with optional startdate and enddate as strings (YYYY-MM-DD or Unix timestamp).
    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", }, }, },
  • Dispatch logic in the main `call_tool` handler that routes 'get_sleep_details' calls to the `_get_sleep_details` implementation.
    elif name == "get_sleep_details": result = await self._get_sleep_details(arguments)

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

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