Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/tools/getAllRecipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export function registerGetAllRecipesTool(server: McpServer, recipes: Recipe[])
'no_param': z.string().optional()
.describe('无参数')
},
{
title: "Get All Recipes",
readOnlyHint: true,
},
async () => {
// 返回更简化版的菜谱数据,只包含name和description
const simplifiedRecipes = recipes.map(simplifyRecipeNameOnly);
Expand Down
4 changes: 4 additions & 0 deletions src/tools/getRecipeById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export function registerGetRecipeByIdTool(server: McpServer, recipes: Recipe[])
{
query: z.string().describe('菜谱名称或ID,支持模糊匹配菜谱名称')
},
{
title: "Get Recipe by ID",
readOnlyHint: true,
},
async ({ query }: { query: string }) => {
// 首先尝试精确匹配ID
let foundRecipe = recipes.find(recipe => recipe.id === query);
Expand Down
4 changes: 4 additions & 0 deletions src/tools/getRecipesByCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export function registerGetRecipesByCategoryTool(server: McpServer, recipes: Rec
category: z.enum(categories as [string, ...string[]])
.describe('菜谱分类名称,如水产、早餐、荤菜、主食等')
},
{
title: "Get Recipes by Category",
readOnlyHint: true,
},
async ({ category }: { category: string }) => {
const filteredRecipes = recipes.filter((recipe) => recipe.category === category);
// 返回简化版的菜谱数据
Expand Down
4 changes: 4 additions & 0 deletions src/tools/recommendMeals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export function registerRecommendMealsTool(server: McpServer, recipes: Recipe[])
peopleCount: z.number().int().min(1).max(10)
.describe('用餐人数,1-10之间的整数')
},
{
title: "Recommend Weekly Meals",
readOnlyHint: true,
},
async ({ allergies = [], avoidItems = [], peopleCount }: {
allergies?: string[],
avoidItems?: string[],
Expand Down
4 changes: 4 additions & 0 deletions src/tools/whatToEat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export function registerWhatToEatTool(server: McpServer, recipes: Recipe[]) {
peopleCount: z.number().int().min(1).max(10)
.describe('用餐人数,1-10之间的整数,会根据人数推荐合适数量的菜品')
},
{
title: "What to Eat",
readOnlyHint: true,
},
async ({ peopleCount }: { peopleCount: number }) => {
// 根据人数计算荤素菜数量
const vegetableCount = Math.floor((peopleCount + 1) / 2);
Expand Down