Skip to main content
Glama

whoop-get-sleep-by-id

Retrieve detailed sleep analysis data from WHOOP by specifying a sleep record ID to access metrics and 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 tool logic by fetching sleep record by ID from the Whoop API.
    async getSleepById(sleepId: string): Promise<WhoopSleep> { const response = await this.client.get(`/activity/sleep/${sleepId}`); return response.data; }
  • MCP server tool call handler that validates input arguments and delegates to WhoopApiClient.getSleepById, formats response.
    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 ListToolsRequest handler, including 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 defining the structure of sleep data returned by the tool.
    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