whoop-refresh-token
Refresh WHOOP API access tokens to maintain continuous data access for fitness tracking and health monitoring applications.
Instructions
Refresh access token using refresh token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| refreshToken | Yes | Refresh token to use for getting new access token |
Implementation Reference
- src/mcp-server.ts:512-525 (handler)MCP server tool handler for 'whoop-refresh-token': validates input arguments and delegates to WhoopApiClient.refreshToken method.case 'whoop-refresh-token': { if (!args || typeof args.refreshToken !== 'string') { throw new Error('refreshToken is required and must be a string'); } const result = await this.whoopClient.refreshToken(args.refreshToken); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/mcp-server.ts:263-276 (registration)Registration of the 'whoop-refresh-token' tool in the ListTools response, including description and input schema.{ name: 'whoop-refresh-token', description: 'Refresh access token using refresh token', inputSchema: { type: 'object', properties: { refreshToken: { type: 'string', description: 'Refresh token to use for getting new access token', }, }, required: ['refreshToken'], }, },
- src/whoop-api.ts:172-186 (helper)Implementation of refreshToken method in WhoopApiClient: performs OAuth refresh token request to Whoop API endpoint.async refreshToken(refreshToken: string): Promise<{ access_token: string; refresh_token: string; expires_in: number }> { const formData = new URLSearchParams(); formData.append('client_id', this.config.clientId); formData.append('client_secret', this.config.clientSecret); formData.append('refresh_token', refreshToken); formData.append('grant_type', 'refresh_token'); const response = await axios.post('https://api.prod.whoop.com/oauth/oauth2/token', formData, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); return response.data; }