Skip to main content
Glama
Talhelf
by Talhelf

compare_platforms

Analyze Google search trends across adult platforms to compare popularity and identify market patterns over time.

Instructions

Compare Google search trends between different adult platforms.

Args:
    platform_names: List of platform names (max 5)
                   Example: ["pornhub", "onlyfans", "xvideos"]
    timeframe: Time period (default: past 12 months)
    region: Region code (default: US)

Returns:
    Comparative analysis showing platform popularity trends.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platform_namesYes
timeframeNotoday 12-m
regionNoUS

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler for compare_platforms tool. Validates input (requires 2-5 platform names), then delegates to search_trends function to fetch and format Google Trends data comparing different adult platforms.
    @mcp.tool()
    async def compare_platforms(
        platform_names: list[str],
        timeframe: str = "today 12-m",
        region: str = "US"
    ) -> str:
        """
        Compare Google search trends between different adult platforms.
        
        Args:
            platform_names: List of platform names (max 5)
                           Example: ["pornhub", "onlyfans", "xvideos"]
            timeframe: Time period (default: past 12 months)
            region: Region code (default: US)
        
        Returns:
            Comparative analysis showing platform popularity trends.
        """
        
        if len(platform_names) > 5:
            return "⚠️  Maximum 5 platforms can be compared at once."
        
        if len(platform_names) < 2:
            return "⚠️  Please provide at least 2 platforms to compare."
        
        return await search_trends(platform_names, timeframe, region)
  • search_trends function called by compare_platforms. Validates keywords (max 5), calls get_trends_data to fetch data, and formats results using format_interest_over_time, format_regional_interest, and format_related_queries helper functions.
    @mcp.tool()
    async def search_trends(
        keywords: list[str],
        timeframe: str = "today 12-m",
        region: str = "US"
    ) -> str:
        """
        Search Google Trends for any keywords (performers, platforms, categories, etc.).
        
        Args:
            keywords: List of search terms to analyze (max 5). Examples:
                      ["Lana Rhoades", "Riley Reid"]
                      ["pornhub", "onlyfans"]
                      ["milf", "teen", "amateur"]
            timeframe: Time period. Options:
                       'today 12-m' (past year, default)
                       'today 3-m' (past 3 months)
                       'today 5-y' (past 5 years)
                       '2020-01-01 2024-12-31' (custom date range)
                       Available back to 2004
            region: Geographic region code:
                    'US' (USA, default)
                    'GB' (UK)
                    '' (Worldwide)
                    Any ISO country code
        
        Returns:
            Complete Google Trends analysis with interest over time, regional data, and related queries.
        """
        
        if not pytrends:
            return "❌ Google Trends API is not available. Please check configuration."
        
        if len(keywords) > 5:
            return "⚠️  Maximum 5 keywords allowed per query. Please reduce your list."
        
        if len(keywords) == 0:
            return "⚠️  Please provide at least one keyword to search."
        
        # Fetch data
        data = get_trends_data(keywords, timeframe, region)
        
        # Format and return results
        result = [
            format_interest_over_time(data),
            "",
            format_regional_interest(data, top_n=10),
            format_related_queries(data),
            "",
            "📝 Notes:",
            "- Values are on a 0-100 scale where 100 = peak popularity for the time period",
            "- Data represents search interest, not absolute search volumes",
            f"- Data fetched: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"
        ]
        
        return "\n".join(result)
  • get_trends_data function that performs the core data fetching using Google Trends API (pytrends). Includes caching (1 hour), rate limiting, and retrieves interest over time, regional data, and related queries. Returns structured dictionary with all trend data.
    def get_trends_data(keywords: list[str], timeframe: str = 'today 12-m', geo: str = 'US') -> dict:
        """
        Fetch Google Trends data for given keywords.
        
        Args:
            keywords: List of search terms to compare (max 5)
            timeframe: Time period (e.g., 'today 12-m', 'today 5-y', '2020-01-01 2024-12-31')
            geo: Geographic region (e.g., 'US', 'GB', '' for worldwide)
        
        Returns:
            Dictionary with trends data
        """
        if not pytrends:
            return {"error": "Google Trends API not available"}
        
        # Check cache
        cache_key = f"{','.join(keywords)}_{timeframe}_{geo}"
        if cache_key in TRENDS_CACHE:
            cached = TRENDS_CACHE[cache_key]
            age = (datetime.now() - datetime.fromisoformat(cached['fetched_at'])).seconds
            if age < 3600:  # Cache for 1 hour
                print(f"Using cached data (age: {age}s)", file=sys.stderr)
                return cached
        
        try:
            print(f"Fetching Google Trends: {keywords}, {timeframe}, {geo}", file=sys.stderr)
            
            # Build payload
            pytrends.build_payload(keywords, cat=0, timeframe=timeframe, geo=geo, gprop='')
            
            # Get interest over time
            interest_over_time_df = pytrends.interest_over_time()
            
            # Get interest by region
            try:
                interest_by_region_df = pytrends.interest_by_region(resolution='REGION', inc_low_vol=True, inc_geo_code=False)
            except Exception as e:
                print(f"Could not fetch regional data: {e}", file=sys.stderr)
                interest_by_region_df = pd.DataFrame()
            
            # Get related queries
            try:
                related_queries = pytrends.related_queries()
            except Exception as e:
                print(f"Could not fetch related queries: {e}", file=sys.stderr)
                related_queries = {}
            
            result = {
                "keywords": keywords,
                "timeframe": timeframe,
                "geo": geo,
                "interest_over_time": interest_over_time_df.to_dict() if not interest_over_time_df.empty else {},
                "interest_by_region": interest_by_region_df.to_dict() if not interest_by_region_df.empty else {},
                "related_queries": related_queries,
                "fetched_at": datetime.now().isoformat()
            }
            
            # Cache the result
            TRENDS_CACHE[cache_key] = result
            
            # Rate limiting
            time.sleep(1)
            
            return result
            
        except Exception as e:
            print(f"Error fetching Google Trends data: {e}", file=sys.stderr)
            return {"error": str(e)}
  • format_interest_over_time helper function that formats Google Trends interest data into readable text. Calculates statistics (average, peak, low values) for each keyword and determines trend direction (growing, declining, or stable).
    def format_interest_over_time(data: dict) -> str:
        """Format interest over time data into readable text."""
        if "error" in data:
            return f"❌ Error: {data['error']}"
        
        if not data.get("interest_over_time"):
            return "No data available for the specified time period and keywords."
        
        lines = [
            f"📊 Google Trends Analysis",
            f"Keywords: {', '.join(data['keywords'])}",
            f"Region: {data['geo'] if data['geo'] else 'Worldwide'}",
            f"Period: {data['timeframe']}",
            "=" * 60,
            ""
        ]
        
        # Calculate statistics for each keyword
        interest_data = data['interest_over_time']
        if interest_data:
            lines.append("📈 Search Interest Statistics (0-100 scale):")
            lines.append("")
            
            for keyword in data['keywords']:
                if keyword in interest_data:
                    values = [v for v in interest_data[keyword].values() if isinstance(v, (int, float))]
                    if values:
                        avg = sum(values) / len(values)
                        max_val = max(values)
                        min_val = min(values)
                        
                        lines.append(f"'{keyword}':")
                        lines.append(f"   Average: {avg:.1f}")
                        lines.append(f"   Peak: {max_val}")
                        lines.append(f"   Low: {min_val}")
                        
                        # Trend direction
                        if len(values) >= 2:
                            recent_avg = sum(values[-4:]) / min(4, len(values[-4:]))
                            older_avg = sum(values[:4]) / min(4, len(values[:4]))
                            if recent_avg > older_avg * 1.1:
                                lines.append(f"   Trend: 📈 Growing ({((recent_avg/older_avg - 1) * 100):.0f}%)")
                            elif recent_avg < older_avg * 0.9:
                                lines.append(f"   Trend: 📉 Declining ({((1 - recent_avg/older_avg) * 100):.0f}%)")
                            else:
                                lines.append(f"   Trend: ➡️  Stable")
                        
                        lines.append("")
        
        return "\n".join(lines)
  • format_regional_interest helper function that formats regional interest data from Google Trends. Shows top regions for each keyword, sorted by interest value, with configurable top_n parameter (default 10).
    def format_regional_interest(data: dict, top_n: int = 10) -> str:
        """Format regional interest data into readable text."""
        if "error" in data:
            return f"❌ Error: {data['error']}"
        
        if not data.get("interest_by_region"):
            return "No regional data available."
        
        lines = [
            f"🌎 Regional Interest",
            "=" * 60,
            ""
        ]
        
        region_data = data['interest_by_region']
        for keyword in data['keywords']:
            if keyword in region_data:
                lines.append(f"Top regions for '{keyword}':")
                
                # Sort regions by interest
                regions = {region: value for region, value in region_data[keyword].items() 
                          if isinstance(value, (int, float)) and value > 0}
                sorted_regions = sorted(regions.items(), key=lambda x: x[1], reverse=True)[:top_n]
                
                if sorted_regions:
                    for i, (region, value) in enumerate(sorted_regions, 1):
                        lines.append(f"   {i}. {region}: {value}/100")
                else:
                    lines.append("   No regional data available")
                lines.append("")
        
        return "\n".join(lines)
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 the tool 'compares' trends and returns a 'comparative analysis,' but doesn't disclose critical traits such as data source limitations, rate limits, authentication needs, or whether it's a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior and constraints.

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 appropriately sized and front-loaded, starting with the core purpose followed by parameter details and return information. Each sentence adds value without redundancy. However, the parameter explanations could be slightly more concise, and the structure includes a separate 'Args' and 'Returns' section, which is clear but not maximally efficient.

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 tool's complexity (3 parameters, no annotations, but has an output schema), the description is moderately complete. It covers the purpose and parameters well, and the output schema handles return values, so the description doesn't need to explain those. However, it lacks behavioral context and usage guidelines, making it incomplete for optimal agent understanding without additional structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains each parameter: 'platform_names' as a list of names with a max of 5 and an example, 'timeframe' as a time period with a default, and 'region' as a region code with a default. This compensates well for the low schema coverage, though it doesn't detail format specifics like valid region codes or timeframe syntax.

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: 'Compare Google search trends between different adult platforms.' It specifies the verb ('compare'), resource ('Google search trends'), and domain ('adult platforms'). However, it doesn't explicitly differentiate from sibling tools like 'analyze_category_trends' or 'compare_performers,' which might also involve comparisons in similar domains.

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 doesn't mention sibling tools like 'compare_performers' or 'search_trends,' nor does it specify scenarios where this tool is preferred or excluded. Usage is implied by the purpose but lacks explicit context or exclusions.

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/Talhelf/ph-mcp'

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