Skip to main content
Glama
kureha4

HowToCook-MCP Server

by kureha4

mcp_howtocook_getRecipesByCategory

Find recipes by category to solve meal planning challenges. Filter Chinese recipes by food type like seafood, breakfast, meat dishes, or staples to get cooking inspiration.

Instructions

根据分类查询菜谱,可选分类有:

Input Schema

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

Implementation Reference

  • Handler function that filters the recipes list by the input category, maps each to a simplified version using simplifyRecipe helper, and returns the JSON stringified list in the 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),
          },
        ],
      };
    }
  • Zod schema defining the single input parameter 'category' as an enum of available categories.
    {
      category: z.enum(categories as [string, ...string[]])
                .describe('菜谱分类名称,如水产、早餐、荤菜、主食等')
    },
  • The server.tool() call within registerGetRecipesByCategoryTool that registers the tool name, dynamic description with categories, input schema, and inline handler on the MCP server.
    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),
            },
          ],
        };
      }
    );
  • src/index.ts:57-57 (registration)
    Invocation of the registration function during server instance creation, passing the MCP server, loaded recipes data, and derived categories list.
    registerGetRecipesByCategoryTool(server, recipes, categories);
  • Helper function simplifyRecipe transforms a full Recipe into SimpleRecipe, selecting id, name, description, and ingredients (name, text_quantity only). Used in the tool handler.
    export function simplifyRecipe(recipe: Recipe): SimpleRecipe {
      return {
        id: recipe.id,
        name: recipe.name,
        description: recipe.description,
        ingredients: recipe.ingredients.map((ingredient: Ingredient) => ({
          name: ingredient.name,
          text_quantity: ingredient.text_quantity
        }))
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions '可选分类有: ' (optional categories are: ) but trails off incomplete, failing to disclose behavioral traits like whether this returns a list, supports pagination, requires authentication, has rate limits, or what happens with invalid categories. The partial category listing creates uncertainty rather than transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single incomplete sentence: '根据分类查询菜谱,可选分类有: ' (Query recipes by category, optional categories are: ). It's under-specified, not concise—the trailing colon suggests missing content, making it feel truncated rather than efficiently structured. It fails to front-load key information effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple parameter (1 required), the description is incomplete. It doesn't explain what the tool returns (e.g., list of recipes, details), how to handle errors, or usage context. The partial category listing exacerbates gaps, leaving the agent unsure about valid inputs and expected behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'category' fully documented in the schema (type, enum, description). The description adds no meaningful semantics beyond the schema—it starts listing examples but cuts off, providing less information than the schema's '如水产、早餐、荤菜、主食等' (e.g., seafood, breakfast, meat dishes, staple foods). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states '根据分类查询菜谱' (query recipes by category), which provides a basic verb+resource combination. However, it's vague about what 'query' means (list, search, filter?) and doesn't distinguish from sibling tools like mcp_howtocook_getAllRecipes or mcp_howtocook_getRecipeById. The description starts listing categories but is incomplete, which adds confusion rather than clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. The description doesn't mention sibling tools like mcp_howtocook_getAllRecipes (which might list all recipes without filtering) or mcp_howtocook_getRecipeById (which retrieves a specific recipe). There's no context about prerequisites, limitations, or typical use cases for category-based queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/kureha4/mcptest1'

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