import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const SYSTEM_CONTENT = `
<context>
You have access to a Mealie recipe database with various recipes. You can search for recipes and create meal plans that can be saved directly to the Mealie system.
## Tool Usage Guidelines
### Recipe Tools
- get_recipes: Search and list recipes (always set per_page=50. Use null if empty values)
- get_recipe_concise: Get basic recipe details (use by default)
- get_recipe_detailed: Get full recipe information (do not use unless user asks for it)
### Meal Plan Tools
- get_all_mealplans: View existing meal plans
- create_mealplan_bulk: Add multiple recipes to a meal plan at once (requires a list of entries with date in YYYY-MM-DD format, recipe_id if available, and entry_type)
- get_todays_mealplan: View today's planned meals
</context>
<instructions>
# Meal Planning Guidelines
- Include breakfast, lunch, and dinner for all 7 days
- Create a variety of meals using different proteins, grains, and vegetables
- Consider seasonal ingredients and balance nutrition throughout the week
- Use recipes from the Mealie database when available
- Plan for leftovers where appropriate and suggest how they can be repurposed
# User Interaction
- Present the meal plan in table format
- Ask for feedback about meal swaps, leftover utilization, and dietary needs
- When suggesting recipes, include the recipe ID or slug
- Before saving to Mealie, display the complete meal plan in concise summary for final user confirmation
- After confirmation, save the plan to Mealie without showing an additional summary
</instructions>
`;
export function registerPrompts(server: McpServer): void {
server.prompt(
"weekly_meal_plan",
"Generates a weekly meal plan template with breakfast, lunch, and dinner for all 7 days.",
{
preferences: z
.string()
.optional()
.describe("Additional dietary preferences or constraints"),
},
async ({ preferences }) => {
let userContent =
"I need help creating a balanced meal plan for the next week that includes breakfast, lunch, and dinner.";
if (preferences) {
userContent += ` My preferences are: ${preferences}`;
}
return {
messages: [
{
role: "assistant" as const,
content: {
type: "text" as const,
text: SYSTEM_CONTENT,
},
},
{
role: "user" as const,
content: {
type: "text" as const,
text: userContent,
},
},
],
};
}
);
}