Skip to main content
Glama
nissand

WHOOP MCP Server

by nissand

whoop-get-sleep-for-cycle

Retrieve detailed sleep analysis data for a specific WHOOP cycle to monitor sleep patterns and quality.

Instructions

Get sleep data for a specific cycle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cycleIdYesID of the cycle to get sleep data for

Implementation Reference

  • Registration of the 'whoop-get-sleep-for-cycle' tool in the MCP server's listTools handler, including name, description, and input schema.
    {
      name: 'whoop-get-sleep-for-cycle',
      description: 'Get sleep data for a specific cycle',
      inputSchema: {
        type: 'object',
        properties: {
          cycleId: {
            type: 'number',
            description: 'ID of the cycle to get sleep data for',
          },
        },
        required: ['cycleId'],
      },
    },
  • MCP server request handler for callToolRequestSchema that handles the 'whoop-get-sleep-for-cycle' case, validates input, calls WhoopApiClient, and returns JSON response.
    case 'whoop-get-sleep-for-cycle': {
      if (!args || typeof args.cycleId !== 'number') {
        throw new Error('cycleId is required and must be a number');
      }
      const result = await this.whoopClient.getSleepForCycle(args.cycleId);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of getSleepForCycle in WhoopApiClient that performs the HTTP GET request to the Whoop API endpoint `/cycle/{cycleId}/sleep` and returns the sleep data.
    async getSleepForCycle(cycleId: number): Promise<WhoopSleep[]> {
      const response = await this.client.get(`/cycle/${cycleId}/sleep`);
      return response.data;
    }

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