mcp_howtocook_getAllRecipes
Retrieve all recipes from a Chinese cooking database to help users find meal ideas, plan weekly menus, and solve the "what to eat today" problem.
Instructions
获取所有菜谱
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| no_param | No | 无参数 |
Implementation Reference
- src/tools/getAllRecipes.ts:14-25 (handler)Executes the tool logic: simplifies all recipes to name and description only, stringifies to JSON, and returns in MCP content format.async () => { // 返回更简化版的菜谱数据,只包含name和description const simplifiedRecipes = recipes.map(simplifyRecipeNameOnly); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipes, null, 2), }, ], }; }
- src/tools/getAllRecipes.ts:10-13 (schema)Input schema using Zod: optional string parameter 'no_param'.{ 'no_param': z.string().optional() .describe('无参数') },
- src/tools/getAllRecipes.ts:7-26 (registration)Registers the tool on the MCP server with name, description, input schema, and handler function.server.tool( "mcp_howtocook_getAllRecipes", "获取所有菜谱", { 'no_param': z.string().optional() .describe('无参数') }, async () => { // 返回更简化版的菜谱数据,只包含name和description const simplifiedRecipes = recipes.map(simplifyRecipeNameOnly); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipes, null, 2), }, ], }; } );
- src/index.ts:56-56 (registration)Invokes the registration function during server instance creation, passing the server and loaded recipes.registerGetAllRecipesTool(server, recipes);
- src/utils/recipeUtils.ts:17-22 (helper)Utility function that simplifies a Recipe to just name and description, used in the tool handler.export function simplifyRecipeNameOnly(recipe: Recipe): NameOnlyRecipe { return { name: recipe.name, description: recipe.description }; }