Skip to main content
Glama
davidashman

AnyList MCP Server

by davidashman

Add Item to List

add_item_to_list

Add items to shopping lists while checking for duplicates to maintain organized and efficient list management.

Instructions

Add a freeform item to a shopping list. Checks for duplicates before adding.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_nameYesName of the item to add
list_nameYesName of the list to add to
quantityNoQuantity string, e.g. "2 lbs" or "3"

Implementation Reference

  • The 'add_item_to_list' tool is registered and implemented within 'src/tools/lists.ts'. The handler takes 'item_name', 'list_name', and optional 'quantity', validates the list, checks for existing items, and adds a new item if not found.
    server.registerTool(
      'add_item_to_list',
      {
        title: 'Add Item to List',
        description: 'Add a freeform item to a shopping list. Checks for duplicates before adding.',
        inputSchema: z.object({
          item_name: z.string().describe('Name of the item to add'),
          list_name: z.string().describe('Name of the list to add to'),
          quantity: z.string().optional().describe('Quantity string, e.g. "2 lbs" or "3"'),
        }),
      },
      async ({ item_name, list_name, quantity }) => {
        try {
          const client = AnyListClient.getInstance();
          await client.getLists();
          const list = client.getListByName(list_name);
    
          if (!list) {
            return {
              content: [{ type: 'text', text: `List not found: "${list_name}"` }],
              isError: true,
            };
          }
    
          // Check for existing item
          const existing = list.getItemByName(item_name);
          if (existing) {
            if (existing.checked) {
              existing.checked = false;
              await existing.save();
              return {
                content: [{ type: 'text', text: `"${item_name}" was already on "${list_name}" (checked off) — unchecked it` }],
              };
            }
            return {
              content: [{ type: 'text', text: `"${item_name}" is already on "${list_name}"` }],
            };
          }
    
          const item = client.createItem({ name: item_name, quantity });
          await list.addItem(item);
    
          return {
            content: [{ type: 'text', text: `Added "${item_name}"${quantity ? ` (${quantity})` : ''} to "${list_name}"` }],
          };
        } catch (error) {
          return {
            content: [{ type: 'text', text: `Error adding item: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      },
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It successfully documents the duplicate-checking behavior, but omits other critical mutation details such as error handling when lists don't exist, authentication requirements, or what constitutes a duplicate match.

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?

The description consists of two highly efficient sentences with zero waste. The first sentence establishes purpose immediately, while the second adds behavioral context. Every word earns its place.

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 the tool's simplicity (3 flat parameters, 100% schema coverage, no output schema), the description is adequately complete. It covers core functionality and key behavior (duplicate checking). Minor gaps remain regarding error conditions and return values, but these are less critical for a straightforward mutation operation.

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%, so the schema already comprehensively documents all parameters including quantity examples. The description adds minimal semantic value beyond the schema, though 'freeform' slightly clarifies the item_name parameter's nature. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the specific action ('Add'), resource type ('freeform item'), and target ('shopping list'). The term 'freeform' effectively distinguishes this tool from sibling tools like 'add_ingredients_to_list' and 'add_recipe_ingredients_to_list' which imply structured data.

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 provides implied usage guidance through the 'freeform' designation, suggesting use for arbitrary text items rather than structured ingredients. However, it lacks explicit when-to-use guidance or named alternatives (e.g., 'use this instead of add_ingredients_to_list when items are not from a recipe').

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