Skip to main content
Glama

get_top_deals

Retrieve trending deals from multiple sources like Slickdeals and RapidAPI. Filter by specific sources or set a limit to find the best offers for comparison.

Instructions

Get top/trending deals from all or specific sources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of deals to return
sourcesNoSpecific sources to get deals from

Implementation Reference

  • The primary handler function for the 'get_top_deals' MCP tool. It extracts limit and sources from arguments, fetches top deals via the aggregator, formats them into a JSON response, and returns it in the expected MCP content structure.
    private async handleGetTopDeals(args: any) {
      const { limit = 20, sources } = args;
      const deals = await this.aggregator.getTopDeals(limit, sources);
    
      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,
                popularity: deal.popularity
              }))
            }, null, 2),
          },
        ],
      };
    }
  • src/server.ts:179-197 (registration)
    Tool registration definition returned by listTools, including name, description, and input schema for the 'get_top_deals' tool.
    {
      name: 'get_top_deals',
      description: 'Get top/trending deals from all or specific sources',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of deals to return',
            default: 20,
          },
          sources: {
            type: 'array',
            items: { type: 'string' },
            description: 'Specific sources to get deals from',
          },
        },
      },
    },
  • Core helper method in the DealAggregator service that fetches top deals in parallel from selected providers, aggregates them, sorts by popularity, and limits the results.
    async getTopDeals(limit: number = 20, sources?: string[]): Promise<Deal[]> {
      const selectedProviders = sources && sources.length > 0
        ? sources.filter(source => this.providers.has(source))
        : Array.from(this.providers.keys());
    
      const dealPromises = selectedProviders.map(async (providerName) => {
        const provider = this.providers.get(providerName);
        if (!provider) return [];
    
        try {
          return await provider.getTopDeals(Math.ceil(limit / selectedProviders.length));
        } catch (error) {
          console.error(`Error getting top deals from ${providerName}:`, error);
          return [];
        }
      });
    
      const results = await Promise.all(dealPromises);
      const allDeals = results.flat();
    
      return this.sortDeals(allDeals, 'popularity', 'desc').slice(0, limit);
    }
Behavior2/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 states what the tool does but lacks details on permissions, rate limits, pagination, or return format (e.g., sorted by trending metrics). This is a significant gap for a tool that likely interacts with external data sources.

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 with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple tool, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'top/trending' means (e.g., based on views, time, or other metrics), the return structure, or error handling. For a tool with potential complexity in sourcing and ranking deals, this leaves critical 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 already documents both parameters ('limit' and 'sources') adequately. The description adds minimal value by implying parameter usage ('from all or specific sources' hints at 'sources'), but doesn't provide additional semantics beyond what the schema offers.

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 with a specific verb ('Get') and resource ('top/trending deals'), and specifies scope ('from all or specific sources'). However, it doesn't explicitly differentiate from sibling tools like 'filter_deals' or 'search_deals' that might also retrieve deals, 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 like 'filter_deals' or 'search_deals'. It mentions 'all or specific sources' but doesn't clarify if this is for trending content only or how it differs from other deal-retrieval tools, leaving usage context vague.

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