From df77b6ecae9117cb34f9ff35e002ebbe0ec27c5f Mon Sep 17 00:00:00 2001 From: triepod-ai <199543909+triepod-ai@users.noreply.github.com> Date: Sun, 4 Jan 2026 08:16:48 -0600 Subject: [PATCH] feat: Add tool annotations for improved LLM tool understanding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add readOnlyHint annotations to all 5 recipe query tools to help LLMs understand that these are safe, read-only operations. Changes: - mcp_howtocook_getAllRecipes: title="Get All Recipes", readOnlyHint=true - mcp_howtocook_getRecipesByCategory: title="Get Recipes by Category", readOnlyHint=true - mcp_howtocook_getRecipeById: title="Get Recipe by ID", readOnlyHint=true - mcp_howtocook_recommendMeals: title="Recommend Weekly Meals", readOnlyHint=true - mcp_howtocook_whatToEat: title="What to Eat", readOnlyHint=true This enables MCP clients to auto-approve these safe operations and improves tool selection accuracy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- src/tools/getAllRecipes.ts | 4 ++++ src/tools/getRecipeById.ts | 4 ++++ src/tools/getRecipesByCategory.ts | 4 ++++ src/tools/recommendMeals.ts | 4 ++++ src/tools/whatToEat.ts | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/src/tools/getAllRecipes.ts b/src/tools/getAllRecipes.ts index 3842ed3..688fd6e 100644 --- a/src/tools/getAllRecipes.ts +++ b/src/tools/getAllRecipes.ts @@ -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); diff --git a/src/tools/getRecipeById.ts b/src/tools/getRecipeById.ts index ee106c1..7db9d88 100644 --- a/src/tools/getRecipeById.ts +++ b/src/tools/getRecipeById.ts @@ -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); diff --git a/src/tools/getRecipesByCategory.ts b/src/tools/getRecipesByCategory.ts index 88ac8c8..e6f6763 100644 --- a/src/tools/getRecipesByCategory.ts +++ b/src/tools/getRecipesByCategory.ts @@ -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); // 返回简化版的菜谱数据 diff --git a/src/tools/recommendMeals.ts b/src/tools/recommendMeals.ts index c65a4a6..f986c80 100644 --- a/src/tools/recommendMeals.ts +++ b/src/tools/recommendMeals.ts @@ -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[], diff --git a/src/tools/whatToEat.ts b/src/tools/whatToEat.ts index 0ff8f38..ad63ab6 100644 --- a/src/tools/whatToEat.ts +++ b/src/tools/whatToEat.ts @@ -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);