Skip to main content
Glama

tiktok_analyze_trend

Analyze TikTok trends by searching keywords to identify popular sounds, hashtags, and posting patterns for content strategy.

Instructions

Analyze trends for a niche: search multiple keywords, aggregate stats on popular sounds, hashtags, posting patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYesKeywords to research
count_per_keywordNoVideos to analyze per keyword (default 10)

Implementation Reference

  • The handler implementation for 'tiktok_analyze_trend', which orchestrates video searches and aggregates hashtag/author statistics.
    elif name == "tiktok_analyze_trend":
        keywords = arguments["keywords"]
        count_per = arguments.get("count_per_keyword", 10)
    
        all_videos = []
        hashtag_counts = {}
        author_counts = {}
        total_engagement = {"likes": 0, "comments": 0, "shares": 0}
    
        for kw in keywords:
            videos = await browser.search_videos(kw, count_per)
            for v in videos:
                all_videos.append(v)
                author = v.get("author", "")
                if author:
                    author_counts[author] = author_counts.get(author, 0) + 1
                desc = v.get("description", "")
                for word in desc.split():
                    if word.startswith("#"):
                        tag = word.lower()
                        hashtag_counts[tag] = hashtag_counts.get(tag, 0) + 1
    
            # Respect rate limit between keywords
            await asyncio.sleep(2)
    
        # Sort hashtags and authors by frequency
        top_hashtags = sorted(hashtag_counts.items(), key=lambda x: -x[1])[:20]
        top_authors = sorted(author_counts.items(), key=lambda x: -x[1])[:10]
    
        analysis = {
            "keywords_analyzed": keywords,
            "total_videos_found": len(all_videos),
            "top_hashtags": [{"hashtag": h, "count": c} for h, c in top_hashtags],
            "top_creators": [{"author": a, "appearances": c} for a, c in top_authors],
            "sample_videos": all_videos[:5],
            "analysis_date": datetime.now().isoformat(),
        }
    
        return [TextContent(type="text", text=json.dumps(analysis, indent=2, ensure_ascii=False))]
  • Tool registration and input schema definition for 'tiktok_analyze_trend'.
    Tool(
        name="tiktok_analyze_trend",
        description="Analyze trends for a niche: search multiple keywords, aggregate stats on popular sounds, hashtags, posting patterns.",
        inputSchema={
            "type": "object",
            "properties": {
                "keywords": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Keywords to research",
                },
                "count_per_keyword": {
                    "type": "integer",
                    "description": "Videos to analyze per keyword (default 10)",
                    "default": 10,
                },
            },
            "required": ["keywords"],
        },
    ),

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/follox42/tiktok-mcp'

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