Skip to main content
Glama
Dinesh-Satram

Health & Fitness Coach MCP

workout-logger.ts1.82 kB
import { z } from "zod"; import { memoryStore } from "../utils/memoryStore"; import { WorkoutEntry } from "../types/entries"; export const workoutLoggerTool = { name: "log-workout", description: "Log a workout entry including type, duration, and optional distance", schema: { userId: z.string().describe("Unique user identifier"), date: z.string().describe("Date of the workout (YYYY-MM-DD format)"), type: z.string().describe("Type of workout (e.g., 'running', 'cycling', 'strength training', 'yoga')"), duration: z.number().describe("Duration of the workout in minutes"), distance: z.number().optional().describe("Distance covered in kilometers (optional, for cardio workouts)"), }, handler: async ({ userId, date, type, duration, distance }: { userId: string; date: string; type: string; duration: number; distance?: number; }) => { try { const workoutEntry: WorkoutEntry = { date, type, duration, ...(distance && { distance }), }; memoryStore.addEntry(userId, workoutEntry); return { content: [ { type: "text" as const, text: `✅ Workout logged successfully! **Workout Details:** - Date: ${date} - Type: ${type} - Duration: ${duration} minutes${distance ? `\n- Distance: ${distance} km` : ''} Great job staying active! Your workout has been recorded and will be included in your next personalized plan.`, }, ], }; } catch (error) { console.error('Error logging workout:', error); return { content: [ { type: "text" as const, text: `❌ Error logging workout: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }, };

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/Dinesh-Satram/fitness_coach_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server