Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

add_items_to_list

Add products to an existing shopping list with optional details like barcode, quantity, and notes. Enables building comprehensive lists for price comparison across Argentine supermarkets.

Instructions

Add products to an existing shopping list.

You can add multiple items at once, each with:

  • Product name (required)

  • Barcode for exact matching (optional)

  • Quantity (default: 1)

  • Notes for specifications (optional)

Perfect for building up your shopping list before optimizing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesID of the shopping list to add items to
itemsYesItems to add to the list

Implementation Reference

  • The handler function that executes the tool logic: calls the API client's addItemsToList method, handles errors, and formats a success response with summary and full data.
    export async function executeAddItemsToList(
      client: SuperPrecioApiClient,
      args: {
        listId: number;
        items: Array<{
          productName: string;
          barcode?: string;
          quantity?: number;
          notes?: string;
        }>;
      }
    ) {
      const response = await client.addItemsToList(args.listId, args.items);
    
      if (!response.success) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to add items: ${response.message || 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    
      const list = response.data;
      const addedCount = response.addedItems || args.items.length;
    
      const summary = `
    ✅ Items Added Successfully!
    
    📝 List: ${list.name}
    ➕ Added: ${addedCount} ${addedCount === 1 ? 'item' : 'items'}
    🛒 Total items in list: ${list.items?.length || 0}
    
    Newly added:
    ${args.items.map((item, i) => `${i + 1}. ${item.productName} (x${item.quantity || 1})${item.notes ? ` - ${item.notes}` : ''}`).join('\n')}
    
    Your list is ready! Next steps:
    - Add more items with add_items_to_list
    - Find the best supermarket with optimize_shopping_list
    `;
    
      return {
        content: [
          {
            type: 'text',
            text: summary,
          },
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • The tool specification defining name, description, and detailed inputSchema for listId (number) and items (array of products with productName required, optional barcode/quantity/notes).
    export const addItemsToListTool = {
      name: 'add_items_to_list',
      description: `Add products to an existing shopping list.
    
    You can add multiple items at once, each with:
    - Product name (required)
    - Barcode for exact matching (optional)
    - Quantity (default: 1)
    - Notes for specifications (optional)
    
    Perfect for building up your shopping list before optimizing.`,
      inputSchema: {
        type: 'object',
        properties: {
          listId: {
            type: 'number',
            description: 'ID of the shopping list to add items to',
          },
          items: {
            type: 'array',
            description: 'Items to add to the list',
            items: {
              type: 'object',
              properties: {
                productName: {
                  type: 'string',
                  description: 'Product name (e.g., "Coca Cola 2.25L", "Pan lactal")',
                },
                barcode: {
                  type: 'string',
                  description: 'Optional barcode/EAN for exact product matching',
                },
                quantity: {
                  type: 'number',
                  description: 'Quantity needed (default: 1)',
                  minimum: 1,
                  default: 1,
                },
                notes: {
                  type: 'string',
                  description: 'Optional notes (e.g., "sin sal", "integral")',
                },
              },
              required: ['productName'],
            },
            minItems: 1,
          },
        },
        required: ['listId', 'items'],
      },
    };
  • Registration of the tool in the ListToolsRequestHandler: addItemsToListTool is included in the array of available tools.
    ✅ Items Added Successfully!
    
    📝 List: ${list.name}
    ➕ Added: ${addedCount} ${addedCount === 1 ? 'item' : 'items'}
    🛒 Total items in list: ${list.items?.length || 0}
    
    Newly added:
    ${args.items.map((item, i) => `${i + 1}. ${item.productName} (x${item.quantity || 1})${item.notes ? ` - ${item.notes}` : ''}`).join('\n')}
    
    Your list is ready! Next steps:
    - Add more items with add_items_to_list
    - Find the best supermarket with optimize_shopping_list
    `;
    
      return {
        content: [
          {
            type: 'text',
            text: summary,
          },
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • src/index.ts:147-148 (registration)
    Dispatch/execution registration in the CallToolRequestHandler switch statement.
    case 'add_items_to_list':
      return await executeAddItemsToList(apiClient, args as any);
  • Supporting API client method that performs the actual HTTP POST to /api/lists/{id}/items to add items to the list.
    async addItemsToList(
      id: number,
      items: Array<{
        productName: string;
        barcode?: string;
        quantity?: number;
        notes?: string;
      }>
    ): Promise<any> {
      try {
        const response = await this.client.post(`/api/lists/${id}/items`, { items });
        return response.data;
      } catch (error) {
        throw this.handleError(error);
      }
    }
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 indicates this is a mutation operation ('Add products') and mentions batch capability ('multiple items at once'), but doesn't address important behavioral aspects like error handling, idempotency, permissions needed, or what happens when adding duplicate items. The description adds some value but leaves significant gaps.

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 is efficiently structured with a clear purpose statement followed by bullet points for item details and a final sentence providing usage context. Every sentence earns its place, with no redundant information or unnecessary elaboration. The bullet format enhances readability without sacrificing conciseness.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the description provides adequate basic information about what the tool does but lacks important contextual details. It doesn't describe the return value format, error conditions, or system behavior when items are added. The description is complete enough for basic understanding but insufficient for robust agent operation without additional trial-and-error learning.

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?

With 100% schema description coverage, the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by listing the same four item fields with slightly different wording, but doesn't provide additional semantic context like examples of valid product names beyond what's in the schema or clarification about barcode format requirements.

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 products') and target resource ('to an existing shopping list'), distinguishing it from sibling tools like 'create_shopping_list' (creates new lists) and 'optimize_shopping_list' (modifies existing lists differently). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Perfect for building up your shopping list before optimizing'), which implicitly suggests it should be used before the 'optimize_shopping_list' sibling tool. However, it doesn't explicitly state when NOT to use it or name specific alternatives for similar operations.

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/bunkerapps/superprecio_mcp'

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