Skip to main content
Glama

tiktok_user_videos

Retrieve videos from a TikTok user's profile by specifying their username and desired video count for content analysis or data collection.

Instructions

Get videos from a specific TikTok user's profile.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesTikTok username (with or without @)
countNoNumber of videos (default 10)

Implementation Reference

  • The actual implementation of the tool handler `get_user_videos` which scrapes TikTok user videos using Playwright.
    async def get_user_videos(self, username: str, count: int = 10) -> list[dict]:
        """Get videos from a specific user's profile."""
        if not username.startswith("@"):
            username = f"@{username}"
    
        page = await self.goto_tiktok(f"/{username}")
        await asyncio.sleep(3)
    
        # Get user info
        user_info = await page.evaluate("""() => {
            const name = document.querySelector('[data-e2e="user-title"]') || document.querySelector('h1');
            const bio = document.querySelector('[data-e2e="user-bio"]');
            const following = document.querySelector('[data-e2e="following-count"]');
            const followers = document.querySelector('[data-e2e="followers-count"]');
            const likes = document.querySelector('[data-e2e="likes-count"]');
            return {
                username: name?.textContent?.trim() || '',
                bio: bio?.textContent?.trim() || '',
                following: following?.textContent?.trim() || '0',
                followers: followers?.textContent?.trim() || '0',
                total_likes: likes?.textContent?.trim() || '0',
            };
        }""")
    
        videos = []
        seen_ids = set()
        scroll_attempts = 0
    
        while len(videos) < count and scroll_attempts < count * 2:
            items = await page.evaluate("""() => {
                const videos = [];
                const cards = document.querySelectorAll('[data-e2e="user-post-item"], [class*="DivItemContainerForSearch"]');
                cards.forEach(card => {
                    try {
                        const link = card.querySelector('a[href*="/video/"]');
                        const views = card.querySelector('[class*="video-count"]') || card.querySelector('strong');
                        const desc = card.querySelector('[title]') || link;
                        
                        const href = link?.href || '';
                        const videoIdMatch = href.match(/video\\/([0-9]+)/);
                        
                        videos.push({
                            video_id: videoIdMatch ? videoIdMatch[1] : null,
                            url: href,
                            description: desc?.title || desc?.textContent?.trim() || '',
                            views: views?.textContent?.trim() || '',
                        });
                    } catch(e) {}
                });
                return videos;
            }""")
    
            for item in items:
                vid = item.get("video_id")
                if vid and vid not in seen_ids:
                    seen_ids.add(vid)
  • The tool invocation logic for `tiktok_user_videos` inside the `call_tool` function.
    elif name == "tiktok_user_videos":
        results = await browser.get_user_videos(
            arguments["username"],
            arguments.get("count", 10),
        )
        return [TextContent(type="text", text=json.dumps(results, indent=2, ensure_ascii=False))]
  • The registration of `tiktok_user_videos` tool definition.
    Tool(
        name="tiktok_user_videos",
        description="Get videos from a specific TikTok user's profile.",
        inputSchema={
            "type": "object",
            "properties": {
                "username": {"type": "string", "description": "TikTok username (with or without @)"},
                "count": {"type": "integer", "description": "Number of videos (default 10)", "default": 10},
            },
            "required": ["username"],
        },
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 states the tool 'Get[s] videos,' implying a read-only operation, but doesn't disclose any behavioral traits such as rate limits, authentication requirements, pagination, or what happens if the user doesn't exist. For a tool with no annotations, this leaves significant gaps in understanding how it behaves.

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: 'Get videos from a specific TikTok user's profile.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple tool. Every part of the sentence earns its place by specifying the action and target.

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 (a tool to retrieve user videos) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., video metadata, URLs, or full data), any limitations (e.g., max count, privacy restrictions), or error handling. For a tool with no structured output information, the description should provide more context to be fully helpful.

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?

The input schema has 100% description coverage, with clear documentation for 'username' and 'count' parameters. The description doesn't add any meaning beyond what the schema provides (e.g., it doesn't explain parameter interactions or constraints). Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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: 'Get videos from a specific TikTok user's profile.' It specifies the verb ('Get') and resource ('videos from a specific TikTok user's profile'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'tiktok_feed' or 'tiktok_search', which might also retrieve videos but from different sources.

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 'tiktok_feed' (which might get videos from a personalized feed) or 'tiktok_search' (which might search for videos), leaving the agent to infer usage based on tool names alone. There are no explicit when-to-use or when-not-to-use instructions.

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

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