Skip to main content
Glama

compare_deals

Analyze and compare multiple deals to identify optimal choices based on your criteria.

Instructions

Compare similar deals and find the best options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dealsYesArray of deals to compare

Implementation Reference

  • src/server.ts:261-274 (registration)
    Registration of the 'compare_deals' tool in the MCP server's list of available tools, including its input schema definition.
    {
      name: 'compare_deals',
      description: 'Compare similar deals and find the best options',
      inputSchema: {
        type: 'object',
        properties: {
          deals: {
            type: 'array',
            description: 'Array of deals to compare',
          },
        },
        required: ['deals'],
      },
    },
  • The specific handler function for the 'compare_deals' tool that extracts deals from args, calls the aggregator's compareDeals method, and returns a formatted MCP response.
    private async handleCompareDeals(args: any) {
      const { deals } = args;
      const bestDeals = this.aggregator.compareDeals(deals);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              original_count: deals.length,
              best_deals_count: bestDeals.length,
              best_deals: bestDeals
            }, null, 2),
          },
        ],
      };
    }
  • Core helper function in DealAggregator that implements the comparison logic: groups deals by normalized titles, sorts groups by price/rating, and selects the best deal from each group.
    compareDeals(deals: Deal[]): Deal[] {
      // Group deals by similar titles and find best deals
      const groupedDeals = new Map<string, Deal[]>();
      
      deals.forEach(deal => {
        const normalizedTitle = this.normalizeTitle(deal.title);
        if (!groupedDeals.has(normalizedTitle)) {
          groupedDeals.set(normalizedTitle, []);
        }
        groupedDeals.get(normalizedTitle)!.push(deal);
      });
    
      const bestDeals: Deal[] = [];
      
      groupedDeals.forEach(similarDeals => {
        if (similarDeals.length > 1) {
          // Sort by price (lowest first) or by rating if prices are similar
          similarDeals.sort((a, b) => {
            if (a.price && b.price) {
              const priceDiff = a.price - b.price;
              if (Math.abs(priceDiff) < 5) {
                // If prices are within $5, prefer higher rating
                return (b.rating || 0) - (a.rating || 0);
              }
              return priceDiff;
            }
            return (b.rating || 0) - (a.rating || 0);
          });
        }
        bestDeals.push(similarDeals[0]);
      });
    
      return bestDeals;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions comparing and finding best options but doesn't disclose behavioral traits such as how comparison is performed (e.g., criteria, algorithms), output format, error handling, or performance considerations. This leaves significant gaps in understanding the tool's operation.

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

Conciseness4/5

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

The description is concise with a single sentence that directly states the tool's function. It's front-loaded and avoids unnecessary words, making it efficient. However, it could be more structured by including key details like comparison criteria, but it earns points for brevity.

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?

Given the complexity of a comparison tool with no annotations and no output schema, the description is incomplete. It lacks details on how the comparison works, what 'best' means, and the expected return values. For a tool that likely involves ranking or analysis, this leaves too much ambiguity for effective agent use.

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%, with the schema documenting that 'deals' is a required array. The description adds minimal value beyond this, as it doesn't elaborate on what constitutes a valid deal object in the array or provide examples. Since schema coverage is high, the baseline score of 3 is appropriate, but no additional insights are offered.

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

Purpose3/5

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

The description states the tool's purpose as comparing deals to find best options, which is clear but vague. It specifies 'compare similar deals' but doesn't define what constitutes 'similar' or what 'best options' means. It distinguishes from siblings like 'filter_deals' or 'get_deal_details' by focusing on comparison rather than filtering or retrieval, but the distinction isn't explicit.

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 explicit guidance on when to use this tool versus alternatives like 'filter_deals' or 'get_top_deals'. The description implies usage for comparison scenarios, but it doesn't specify prerequisites, context, or exclusions. For example, it doesn't indicate if this is for pre-selected deals or if it integrates with search results.

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