@vreippainen/hevy-mcp-server
Version:
A MCP server for Hevy
102 lines (101 loc) • 3.73 kB
TypeScript
/**
* Hevy Service - Contains functions for processing and analyzing workout data
*/
import { Workout, ExerciseTemplate, Routine, ExerciseProgressData, WorkoutStats } from '../types/index.js';
/**
* Calculate statistics for a workout
*/
declare function calculateWorkoutStats(workout: Workout): WorkoutStats;
/**
* Analyze progress for a specific exercise across multiple workouts
*/
declare function analyzeProgressForExercise(exerciseId: string, workouts: Workout[]): ExerciseProgressData[];
/**
* Fetch all workouts by handling pagination
* @returns Promise with array of all workouts
*/
declare function fetchAllWorkouts(): Promise<Workout[]>;
/**
* Fetch all exercise templates by handling pagination
* @returns Promise with array of all exercise templates
*/
declare function fetchAllExerciseTemplates(): Promise<ExerciseTemplate[]>;
/**
* Fetch all routines by handling pagination
* @returns Promise with array of all routines
*/
declare function fetchAllRoutines(): Promise<Routine[]>;
/**
* Get workouts within a specific timeframe
*/
declare function getWorkouts(startDate?: Date, endDate?: Date): Promise<Workout[]>;
/**
* Get comprehensive exercise data sorted by frequency of use
* @param {string} [searchTerm] - Optional search term to filter exercises by name
* @param {boolean} [excludeUnused=false] - If true, exclude exercises with 0 frequency (never used)
* @param {string} [startDate] - Optional ISO date string to filter workouts after this date
* @param {string} [endDate] - Optional ISO date string to filter workouts before this date
* @returns Array of objects containing exercise data, sorted by frequency
*/
declare function getExercises(searchTerm?: string, excludeUnused?: boolean, startDate?: string, endDate?: string): Promise<{
id: string;
name: string;
frequency: number;
estimated1RM: {
weightKg: number;
date: string;
} | null;
actual1RM: {
weightKg: number;
date: string;
} | null;
type: string;
primary_muscle_group: string;
secondary_muscle_groups: string[];
equipment: string;
}[]>;
/**
* Populate the cache with initial data
* Pre-fetches all exercise templates, routines, and workouts
*/
declare function populateCache(): Promise<void>;
/**
* Calculate records by reps from progress data
* @param progressData Array of exercise progress data
* @returns Records for each rep count
*/
declare function calculateRecordsByReps(progressData: ExerciseProgressData[]): {
reps: number;
weight_kg: number;
date: string;
}[];
/**
* Process progress data for a single exercise
* @param exerciseId Exercise ID to analyze
* @param allExercises List of all exercise templates
* @param workouts List of all workouts
* @param limit Number of latest sessions to return
* @returns Progress data and records for the exercise
*/
declare function processExerciseProgress(exercise: ExerciseTemplate, workouts: Workout[], limit: number): {
exercise: ExerciseTemplate;
personalRecords: {
reps: number;
weight_kg: number;
date: string;
}[];
sessions: ExerciseProgressData[];
};
declare const _default: {
calculateWorkoutStats: typeof calculateWorkoutStats;
analyzeProgressForExercise: typeof analyzeProgressForExercise;
fetchAllExerciseTemplates: typeof fetchAllExerciseTemplates;
fetchAllRoutines: typeof fetchAllRoutines;
getWorkouts: typeof getWorkouts;
fetchAllWorkouts: typeof fetchAllWorkouts;
populateCache: typeof populateCache;
calculateRecordsByReps: typeof calculateRecordsByReps;
getExercises: typeof getExercises;
processExerciseProgress: typeof processExerciseProgress;
};
export default _default;