Skip to main content
Glama

search_products

Find beer, wine, spirits, and other alcoholic beverages on Drizly by searching product names, brands, or types, with filters for price, ABV, and delivery availability.

Instructions

Search for beer, wine, spirits, and other alcoholic beverages on Drizly by name, type, or brand

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (product name, brand, or type)
categoryNoFilter by category
minPriceNoMinimum price filter
maxPriceNoMaximum price filter
minAbvNoMinimum ABV percentage
maxAbvNoMaximum ABV percentage
addressNoDelivery address to filter by availability

Implementation Reference

  • The core implementation of searchProducts method in DrizlyBrowser class. This async method uses Playwright to navigate to Drizly's search page, scrape product cards from the DOM, extract product details (name, price, brand, image, rating), and apply optional filters for price, category, and ABV. Returns an array of DrizlyProduct objects.
    async searchProducts(
      query: string,
      filters?: {
        category?: string;
        minPrice?: number;
        maxPrice?: number;
        minAbv?: number;
        maxAbv?: number;
        address?: string;
      }
    ): Promise<DrizlyProduct[]> {
      const params = new URLSearchParams({ q: query });
      if (filters?.category) params.append("category", filters.category);
    
      const searchUrl = `${this.baseUrl}/search?${params.toString()}`;
      await this.navigateTo(searchUrl);
    
      const page = await this.ensurePage();
    
      // Wait for search results
      try {
        await page.waitForSelector('[data-testid="product-card"], .product-card, [class*="ProductCard"]', {
          timeout: 10000,
        });
      } catch {
        return [];
      }
    
      const products = await page.evaluate(() => {
        const results: DrizlyProduct[] = [];
        const cards = document.querySelectorAll(
          '[data-testid="product-card"], .product-card, [class*="ProductCard"]'
        );
    
        cards.forEach((card) => {
          const nameEl = card.querySelector('[class*="name"], [class*="title"], h3, h4');
          const priceEl = card.querySelector('[class*="price"], [data-testid="price"]');
          const imgEl = card.querySelector("img");
          const linkEl = card.querySelector("a");
          const brandEl = card.querySelector('[class*="brand"]');
          const ratingEl = card.querySelector('[class*="rating"], [aria-label*="stars"]');
    
          if (nameEl && priceEl) {
            const priceText = priceEl.textContent?.replace(/[^0-9.]/g, "") || "0";
            results.push({
              id: linkEl?.href?.split("/").pop() || Math.random().toString(36).substr(2, 9),
              name: nameEl.textContent?.trim() || "",
              brand: brandEl?.textContent?.trim() || "",
              category: "",
              price: parseFloat(priceText) || 0,
              imageUrl: imgEl?.src || undefined,
              url: linkEl?.href || "",
              rating: ratingEl ? parseFloat(ratingEl.textContent?.match(/[\d.]+/)?.[0] || "0") : undefined,
              inStock: true,
            });
          }
        });
    
        return results;
      });
    
      // Apply price filters if provided
      return products.filter((p) => {
        if (filters?.minPrice && p.price < filters.minPrice) return false;
        if (filters?.maxPrice && p.price > filters.maxPrice) return false;
        return true;
      });
    }
  • The MCP tool handler for 'search_products'. This case block validates incoming arguments using SearchProductsSchema, calls drizly.searchProducts() with the parsed parameters and filters, and returns the results as formatted JSON content with query info, result count, and up to 20 products.
    case "search_products": {
      const params = SearchProductsSchema.parse(args);
      const products = await drizly.searchProducts(params.query, {
        category: params.category,
        minPrice: params.minPrice,
        maxPrice: params.maxPrice,
        minAbv: params.minAbv,
        maxAbv: params.maxAbv,
        address: params.address,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                query: params.query,
                resultCount: products.length,
                products: products.slice(0, 20),
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Zod schema definition for search_products tool inputs. Defines validation for query string (required) and optional filters including category, minPrice, maxPrice, minAbv, maxAbv, and address. Each field includes descriptive metadata for the tool.
    const SearchProductsSchema = z.object({
      query: z.string().describe("Search query (product name, brand, or type)"),
      category: z.string().optional().describe("Filter by category (beer, wine, spirits, cider)"),
      minPrice: z.number().optional().describe("Minimum price filter"),
      maxPrice: z.number().optional().describe("Maximum price filter"),
      minAbv: z.number().optional().describe("Minimum ABV percentage"),
      maxAbv: z.number().optional().describe("Maximum ABV percentage"),
      address: z.string().optional().describe("Delivery address to filter by availability"),
    });
  • src/index.ts:97-121 (registration)
    Tool registration for 'search_products' in the ListToolsRequestSchema handler. Defines the tool name, description, and JSON Schema inputSchema with all parameters (query, category, price filters, ABV filters, address) mapped to JSON Schema types for MCP protocol compatibility.
    {
      name: "search_products",
      description:
        "Search for beer, wine, spirits, and other alcoholic beverages on Drizly by name, type, or brand",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query (product name, brand, or type)",
          },
          category: {
            type: "string",
            enum: ["beer", "wine", "spirits", "cider", "hard-seltzer"],
            description: "Filter by category",
          },
          minPrice: { type: "number", description: "Minimum price filter" },
          maxPrice: { type: "number", description: "Maximum price filter" },
          minAbv: { type: "number", description: "Minimum ABV percentage" },
          maxAbv: { type: "number", description: "Maximum ABV percentage" },
          address: { type: "string", description: "Delivery address to filter by availability" },
        },
        required: ["query"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions searching on Drizly but does not cover key traits like whether this is a read-only operation, potential rate limits, authentication needs, or what the search results include (e.g., format, pagination). This is a significant gap for a search tool with no annotation coverage.

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 a single, efficient sentence that front-loads the core purpose without unnecessary details. Every word earns its place, making it highly concise and well-structured for quick understanding.

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?

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It adequately states the purpose but lacks behavioral context, usage guidelines, and details on output format. However, the high schema coverage partially compensates, making it minimally viable but with clear gaps.

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 fully documents all 7 parameters. The description adds minimal value by mentioning 'by name, type, or brand,' which loosely relates to the 'query' parameter but does not provide additional syntax or meaning beyond what the schema already specifies. This meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Search for beer, wine, spirits, and other alcoholic beverages on Drizly by name, type, or brand.' It specifies the verb ('search'), resource ('alcoholic beverages'), and platform ('Drizly'), but does not explicitly differentiate it from sibling tools like 'browse_categories' or 'get_product_details', which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions searching 'by name, type, or brand,' but does not compare it to siblings like 'browse_categories' (for browsing without a query) or 'get_product_details' (for specific product info), leaving the agent without explicit usage context.

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/markswendsen-code/mcp-drizly'

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