Skip to main content
Glama

search_deals

Search for deals across multiple sources using text queries and filters like price, category, rating, and store to find specific products or offers.

Instructions

Search for deals across multiple sources based on text query and filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for deals (e.g., "gaming laptop", "iPhone", "kitchen appliances")
categoryNoCategory filter (e.g., "electronics", "clothing", "home")
minPriceNoMinimum price filter
maxPriceNoMaximum price filter
minRatingNoMinimum rating filter (0-5)
storeNoStore/retailer filter (e.g., "amazon", "best buy")
sortByNoSort criteria
sortOrderNoSort order
limitNoMaximum number of results (1-100)
sourcesNoSpecific sources to search (e.g., ["slickdeals", "rapidapi"])

Implementation Reference

  • Main handler function for the 'search_deals' tool. Parses input arguments using SearchParamsSchema, calls aggregator.searchDeals, and returns a formatted JSON response with deal results.
    private async handleSearchDeals(args: any) {
      const params = SearchParamsSchema.parse(args);
      const deals = await this.aggregator.searchDeals(params);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              results: deals.length,
              deals: deals.map(deal => ({
                id: deal.id,
                title: deal.title,
                price: deal.price,
                originalPrice: deal.originalPrice,
                discountPercentage: deal.discountPercentage,
                rating: deal.rating,
                store: deal.store,
                url: deal.url,
                source: deal.source,
                verified: deal.verified
              }))
            }, null, 2),
          },
        ],
      };
    }
  • src/server.ts:124-178 (registration)
    Tool registration in getAvailableTools(), including name, description, and detailed inputSchema for MCP tool listing.
    {
      name: 'search_deals',
      description: 'Search for deals across multiple sources based on text query and filters',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query for deals (e.g., "gaming laptop", "iPhone", "kitchen appliances")',
          },
          category: {
            type: 'string',
            description: 'Category filter (e.g., "electronics", "clothing", "home")',
          },
          minPrice: {
            type: 'number',
            description: 'Minimum price filter',
          },
          maxPrice: {
            type: 'number',
            description: 'Maximum price filter',
          },
          minRating: {
            type: 'number',
            description: 'Minimum rating filter (0-5)',
          },
          store: {
            type: 'string',
            description: 'Store/retailer filter (e.g., "amazon", "best buy")',
          },
          sortBy: {
            type: 'string',
            enum: ['price', 'rating', 'popularity', 'date'],
            description: 'Sort criteria',
          },
          sortOrder: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Sort order',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results (1-100)',
            minimum: 1,
            maximum: 100,
          },
          sources: {
            type: 'array',
            items: { type: 'string' },
            description: 'Specific sources to search (e.g., ["slickdeals", "rapidapi"])',
          },
        },
        required: ['query'],
      },
    },
  • Zod schema definition for SearchParams used to validate and parse tool arguments in the handler.
    export const SearchParamsSchema = z.object({
      query: z.string(),
      category: z.string().optional(),
      minPrice: z.number().optional(),
      maxPrice: z.number().optional(),
      minRating: z.number().optional(),
      store: z.string().optional(),
      sortBy: z.enum(['price', 'rating', 'popularity', 'date']).optional(),
      sortOrder: z.enum(['asc', 'desc']).optional(),
      limit: z.number().min(1).max(100).default(20),
      sources: z.array(z.string()).optional()
    });
    
    export type SearchParams = z.infer<typeof SearchParamsSchema>;
  • Core aggregator logic that parallelizes searches across selected providers, collects results, and applies sorting/filtering.
    async searchDeals(params: SearchParams): Promise<Deal[]> {
      const selectedProviders = params.sources && params.sources.length > 0
        ? params.sources.filter((source: string) => this.providers.has(source))
        : Array.from(this.providers.keys());
    
      const searchPromises = selectedProviders.map(async (providerName: string) => {
        const provider = this.providers.get(providerName);
        if (!provider) return [];
    
        try {
          return await provider.searchDeals(params);
        } catch (error) {
          console.error(`Error searching deals from ${providerName}:`, error);
          return [];
        }
      });
    
      const results = await Promise.all(searchPromises);
      const allDeals = results.flat();
    
      return this.sortAndFilterDeals(allDeals, params);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions searching 'across multiple sources' which adds some context about scope, but doesn't cover important aspects like rate limits, authentication requirements, pagination behavior, or what happens when no results are found. For a search tool with 10 parameters, this is insufficient.

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 functionality. Every word earns its place, with no wasted verbiage or redundancy.

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?

For a search tool with 10 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the search returns (e.g., deal objects with what fields), how results are structured, or any limitations beyond what's implied by the parameters. The lack of behavioral context is particularly problematic given the tool's complexity.

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 documents all 10 parameters thoroughly with descriptions, enums, and constraints. The description adds no additional parameter information beyond what's in the schema, meeting 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 verb ('search') and resource ('deals'), and specifies the scope ('across multiple sources'). It distinguishes the tool from siblings like 'compare_deals' or 'get_top_deals' by emphasizing search functionality, though it doesn't explicitly contrast them.

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 is provided on when to use this tool versus alternatives like 'filter_deals' or 'get_top_deals'. The description mentions searching 'across multiple sources', but doesn't clarify if this is the primary search tool or when other tools might be more appropriate.

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/karthiksivaramms/bargainer-mcp-client'

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