Skip to main content
Glama

whoop-get-sleep-by-id

Retrieve detailed sleep analysis data from WHOOP using a specific sleep record ID to access sleep metrics, stages, and recovery insights.

Instructions

Get the sleep record for the specified ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sleepIdYesID of the sleep record to retrieve

Implementation Reference

  • Core handler function that executes the API call to retrieve sleep data by ID from the Whoop API endpoint.
    async getSleepById(sleepId: string): Promise<WhoopSleep> { const response = await this.client.get(`/activity/sleep/${sleepId}`); return response.data; }
  • MCP server dispatch handler that validates input arguments and delegates to the WhoopApiClient.
    case 'whoop-get-sleep-by-id': { if (!args || typeof args.sleepId !== 'string') { throw new Error('sleepId is required and must be a string'); } const result = await this.whoopClient.getSleepById(args.sleepId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
  • Tool registration in the MCP server, defining name, description, and input schema.
    name: 'whoop-get-sleep-by-id', description: 'Get the sleep record for the specified ID', inputSchema: { type: 'object', properties: { sleepId: { type: 'string', description: 'ID of the sleep record to retrieve', }, }, required: ['sleepId'], }, },
  • TypeScript interface for the output type WhoopSleep, defining the structure of the sleep record data.
    export interface WhoopSleep { id: string; v1_id: number; user_id: number; created_at: string; updated_at: string; start: string; end: string; timezone_offset: string; nap: boolean; score_state: string; score?: WhoopSleepScore; }

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/nissand/whoop-mcp-server-claude'

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