Skip to main content
Glama
Dinesh-Satram

Health & Fitness Coach MCP

nutrition-logger.ts1.73 kB
import { z } from "zod"; import { memoryStore } from "../utils/memoryStore"; import { NutritionEntry } from "../types/entries"; export const nutritionLoggerTool = { name: "log-nutrition", description: "Log a nutrition entry including meal type, food items, and calories", schema: { userId: z.string().describe("Unique user identifier"), date: z.string().describe("Date of the meal (YYYY-MM-DD format)"), meal: z.string().describe("Type of meal (e.g., 'breakfast', 'lunch', 'dinner', 'snack')"), items: z.array(z.string()).describe("List of food items consumed"), calories: z.number().describe("Total calories for this meal"), }, handler: async ({ userId, date, meal, items, calories }: { userId: string; date: string; meal: string; items: string[]; calories: number; }) => { try { const nutritionEntry: NutritionEntry = { date, meal, items, calories, }; memoryStore.addEntry(userId, nutritionEntry); return { content: [ { type: "text" as const, text: `🍽️ Nutrition logged successfully! **Meal Details:** - Date: ${date} - Meal: ${meal} - Items: ${items.join(', ')} - Calories: ${calories} Your nutrition data has been recorded and will help generate better meal recommendations in your personalized plan.`, }, ], }; } catch (error) { console.error('Error logging nutrition:', error); return { content: [ { type: "text" as const, text: `❌ Error logging nutrition: ${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