Skip to main content
Glama
worryzyy

HowToCook-MCP Server

by worryzyy

mcp_howtocook_getRecipesByCategory

Retrieve recipes by category such as seafood, breakfast, desserts, or soups to simplify meal planning using the HowToCook repository.

Instructions

根据分类查询菜谱,可选分类有: 水产, 早餐, 调料, 甜品, 饮品, 荤菜, 半成品加工, 汤, 主食, 素菜

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes菜谱分类名称,如水产、早餐、荤菜、主食等

Implementation Reference

  • Registers the 'mcp_howtocook_getRecipesByCategory' tool with MCP server, defining schema and handler inline.
    export function registerGetRecipesByCategoryTool(server: McpServer, recipes: Recipe[], categories: string[]) { server.tool( "mcp_howtocook_getRecipesByCategory", `根据分类查询菜谱,可选分类有: ${categories.join(', ')}`, { category: z.enum(categories as [string, ...string[]]) .describe('菜谱分类名称,如水产、早餐、荤菜、主食等') }, async ({ category }: { category: string }) => { const filteredRecipes = recipes.filter((recipe) => recipe.category === category); // 返回简化版的菜谱数据 const simplifiedRecipes = filteredRecipes.map(simplifyRecipe); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipes, null, 2), }, ], }; } ); }
  • Handler function that filters recipes by given category, simplifies them using simplifyRecipe, and returns JSON-formatted list in MCP text content format.
    async ({ category }: { category: string }) => { const filteredRecipes = recipes.filter((recipe) => recipe.category === category); // 返回简化版的菜谱数据 const simplifiedRecipes = filteredRecipes.map(simplifyRecipe); return { content: [ { type: "text", text: JSON.stringify(simplifiedRecipes, null, 2), }, ], }; }
  • Input schema using Zod: 'category' parameter as enum of provided categories with description.
    { category: z.enum(categories as [string, ...string[]]) .describe('菜谱分类名称,如水产、早餐、荤菜、主食等') },

Other Tools

Related Tools

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/worryzyy/HowToCook-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server