Skip to main content
Glama
davidashman

AnyList MCP Server

by davidashman

Add Ingredient to List

add_ingredient_to_list

Add recipe ingredients to your shopping list by matching them with existing items for proper categorization in AnyList.

Instructions

Add a specific ingredient from a recipe to a shopping list. Matches existing items or recent items by name for proper AnyList categorization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipe_nameNoRecipe name (case-insensitive match)
recipe_idNoRecipe identifier
ingredient_nameYesName of the ingredient to add (matched against recipe ingredients)
list_nameNoTarget list name (defaults to "Groceries")Groceries
event_idNoMeal plan event identifier to link this ingredient to
event_dateNoMeal plan event date in YYYY-MM-DD format

Implementation Reference

  • Implementation of the 'add_ingredient_to_list' tool handler and schema.
    server.registerTool(
      'add_ingredient_to_list',
      {
        title: 'Add Ingredient to List',
        description: 'Add a specific ingredient from a recipe to a shopping list. Matches existing items or recent items by name for proper AnyList categorization.',
        inputSchema: z.object({
          recipe_name: z.string().optional().describe('Recipe name (case-insensitive match)'),
          recipe_id: z.string().optional().describe('Recipe identifier'),
          ingredient_name: z.string().describe('Name of the ingredient to add (matched against recipe ingredients)'),
          list_name: z.string().default('Groceries').describe('Target list name (defaults to "Groceries")'),
          event_id: z.string().optional().describe('Meal plan event identifier to link this ingredient to'),
          event_date: z.string().optional().describe('Meal plan event date in YYYY-MM-DD format'),
        }),
      },
      async ({ recipe_name, recipe_id, ingredient_name, list_name, event_id, event_date }) => {
        try {
          if (!recipe_name && !recipe_id) {
            return {
              content: [{ type: 'text', text: 'Error: provide either recipe_name or recipe_id' }],
              isError: true,
            };
          }
    
          const client = AnyListClient.getInstance();
          const recipes = await client.getRecipes();
    
          let recipe;
          if (recipe_id) {
            recipe = recipes.find((r) => r.identifier === recipe_id);
          } else if (recipe_name) {
            const term = recipe_name.toLowerCase();
            recipe = recipes.find((r) => r.name?.toLowerCase() === term)
              ?? recipes.find((r) => r.name?.toLowerCase().includes(term));
          }
    
          if (!recipe) {
            return {
              content: [{ type: 'text', text: `Recipe not found: ${recipe_name ?? recipe_id}` }],
              isError: true,
            };
          }
    
          const term = ingredient_name.toLowerCase();
          const ingredient = recipe.ingredients.find((i) => i.name?.toLowerCase() === term)
            ?? recipe.ingredients.find((i) => i.name?.toLowerCase().includes(term))
            ?? recipe.ingredients.find((i) => i.rawIngredient?.toLowerCase().includes(term));
    
          if (!ingredient) {
            return {
              content: [{ type: 'text', text: `Ingredient "${ingredient_name}" not found in recipe "${recipe.name}"` }],
              isError: true,
            };
          }
    
          await client.getLists();
          const list = client.getListByName(list_name);
    
          if (!list) {
            return {
              content: [{ type: 'text', text: `List not found: "${list_name}"` }],
              isError: true,
            };
          }
    
          const ingredientName = ingredient.name || ingredient.rawIngredient;
    
          await list.addIngredient(ingredient, {
            recipeId: recipe.identifier,
            recipeName: recipe.name,
            eventId: event_id,
            eventDate: event_date,
          });
    
          return {
            content: [{ type: 'text', text: `Added ingredient "${ingredientName}"${ingredient.quantity ? ` (${ingredient.quantity})` : ''} from "${recipe.name}" to "${list_name}"` }],
          };
        } catch (error) {
          return {
            content: [{ type: 'text', text: `Error adding ingredient: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      },
    );
Behavior4/5

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

With no annotations provided, the description carries full behavioral disclosure burden. It successfully explains the fuzzy matching behavior ('Matches existing items or recent items by name') and AnyList categorization system integration, adding valuable context beyond the schema. However, it omits whether the operation is idempotent, what happens if the ingredient isn't found in the recipe, or return value details.

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

Conciseness5/5

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

Two sentences with zero waste: the first front-loads the core action and scope, while the second adds essential behavioral context about the matching algorithm. Every word earns its place; no redundancy or filler present.

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

Completeness4/5

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

Given 100% schema coverage and the tool's moderate complexity (6 parameters with interrelationships), the description adequately covers the essential operational logic and matching behavior. Minor gap: no output schema exists, and the description doesn't indicate return values or success/failure signaling, though this is partially mitigated by the straightforward 'add' operation pattern.

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

Parameters4/5

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

Schema coverage is 100%, establishing a baseline of 3. The description adds semantic value by clarifying the relationship between parameters—specifically that 'ingredient_name' is matched against recipe ingredients and sourced from the recipe identified by 'recipe_name'/'recipe_id'. This contextual linkage exceeds the raw schema definitions.

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

Purpose5/5

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

The description provides a specific verb ('Add'), resource ('specific ingredient'), source ('from a recipe'), and target ('shopping list'). The use of 'specific ingredient' effectively distinguishes this singular operation from sibling tools 'add_ingredients_to_list' (plural) and 'add_recipe_ingredients_to_list' (bulk), while 'from a recipe' differentiates it from 'add_item_to_list' (generic items).

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

Usage Guidelines3/5

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

The description implies usage context through 'from a recipe,' suggesting it requires recipe context, but lacks explicit guidance on when to use this versus 'add_recipe_ingredients_to_list' (all ingredients) or 'add_item_to_list' (manual entry). No alternatives or prerequisites are explicitly stated.

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/davidashman/anylist-mcp'

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