Skip to main content
Glama

whoop-get-sleep-collection

Retrieve paginated sleep records from WHOOP with date filtering options to analyze sleep patterns and duration data.

Instructions

Get all sleep records for a user, paginated

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoLimit on the number of sleep records returned (max 25)
startNoReturn sleep records that occurred after or during this time (ISO 8601)
endNoReturn sleep records that intersect this time or ended before this time (ISO 8601)
nextTokenNoNext token from the previous response to get the next page

Implementation Reference

  • Core handler function in WhoopApiClient that fetches the paginated sleep collection from the Whoop API endpoint '/activity/sleep' using axios with query parameters.
    async getSleepCollection(params?: PaginationParams): Promise<WhoopSleepCollection> { const queryParams = new URLSearchParams(); if (params?.limit) queryParams.append('limit', params.limit.toString()); if (params?.start) queryParams.append('start', params.start); if (params?.end) queryParams.append('end', params.end); if (params?.nextToken) queryParams.append('nextToken', params.nextToken); const url = `/activity/sleep${queryParams.toString() ? `?${queryParams.toString()}` : ''}`; const response = await this.client.get(url); return response.data; }
  • Tool registration in the ListTools handler, defining name, description, and input schema for 'whoop-get-sleep-collection'.
    { name: 'whoop-get-sleep-collection', description: 'Get all sleep records for a user, paginated', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Limit on the number of sleep records returned (max 25)', }, start: { type: 'string', description: 'Return sleep records that occurred after or during this time (ISO 8601)', }, end: { type: 'string', description: 'Return sleep records that intersect this time or ended before this time (ISO 8601)', }, nextToken: { type: 'string', description: 'Next token from the previous response to get the next page', }, }, required: [], },
  • MCP server CallToolRequest handler case that validates arguments and delegates to WhoopApiClient.getSleepCollection, returning JSON stringified result.
    case 'whoop-get-sleep-collection': { const result = await this.whoopClient.getSleepCollection({ limit: args?.limit as number | undefined, start: args?.start as string | undefined, end: args?.end as string | undefined, nextToken: args?.nextToken as string | undefined, }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };

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