Skip to main content
Glama

tiktok_interact

Perform interactions on TikTok videos: like posts, add comments, or follow creators through automated browser sessions.

Instructions

Interact with a TikTok video: like, comment, or follow the creator.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesInteraction type
video_urlYesTarget video URL
textNoComment text (required for comment action)

Implementation Reference

  • The interact method in TikTokBrowser handles the logic for liking, commenting, or following a video.
    async def interact(self, video_url: str, action: str, text: str = "") -> dict:
        """Interact with a video: like, comment, follow."""
        page = await self.launch()
        await page.goto(video_url, wait_until="domcontentloaded", timeout=30000)
        await asyncio.sleep(3)
    
        result = {"action": action, "url": video_url, "success": False}
    
        try:
            if action == "like":
                btn = await page.query_selector('[data-e2e="like-icon"], [data-e2e="browse-like-icon"]')
                if btn:
                    await btn.click()
                    await asyncio.sleep(1)
                    result["success"] = True
    
            elif action == "comment":
                if not text:
                    result["error"] = "Comment text required"
                    return result
                # Click comment input
                comment_input = await page.query_selector(
                    '[data-e2e="comment-input"] div[contenteditable], '
                    '[class*="DivInputEditorContainer"] div[contenteditable]'
                )
                if comment_input:
                    await comment_input.click()
                    await asyncio.sleep(0.5)
                    await comment_input.type(text, delay=random.randint(30, 80))
                    await asyncio.sleep(0.5)
                    # Click post button
                    post_btn = await page.query_selector(
                        '[data-e2e="comment-post"], [class*="DivPostButton"]'
                    )
                    if post_btn:
                        await post_btn.click()
                        await asyncio.sleep(2)
                        result["success"] = True
                    else:
                        await page.keyboard.press("Enter")
                        await asyncio.sleep(2)
                        result["success"] = True
    
            elif action == "follow":
                btn = await page.query_selector(
                    '[data-e2e="browse-follow"], button:has-text("Follow")'
                )
                if btn:
                    await btn.click()
                    await asyncio.sleep(1)
                    result["success"] = True
    
            else:
                result["error"] = f"Unknown action: {action}"
    
        except Exception as e:
            result["error"] = str(e)
    
        return result
  • The tiktok_interact tool is defined and registered in the TOOLS list.
    Tool(
        name="tiktok_interact",
        description="Interact with a TikTok video: like, comment, or follow the creator.",
        inputSchema={
            "type": "object",
            "properties": {
                "action": {
                    "type": "string",
                    "enum": ["like", "comment", "follow"],
                    "description": "Interaction type",
                },
                "video_url": {"type": "string", "description": "Target video URL"},
                "text": {"type": "string", "description": "Comment text (required for comment action)"},
            },
            "required": ["action", "video_url"],
        },
    ),
  • The call_tool handler in server.py dispatches the tiktok_interact request to the browser instance.
    elif name == "tiktok_interact":
        result = await browser.interact(
            arguments["video_url"],
            arguments["action"],
            arguments.get("text", ""),
        )
        return [TextContent(type="text", text=json.dumps(result, indent=2, ensure_ascii=False))]
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions three actions but doesn't disclose whether these require user authentication, have rate limits, affect account status, or return confirmation data. For a tool that performs social media interactions (potentially with platform restrictions), this lack of transparency is a significant gap.

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 that front-loads the core purpose ('Interact with a TikTok video') and immediately enumerates the three actions. There is zero wasted verbiage or redundancy, making it highly scannable and actionable.

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 social media interaction tools (which often require authentication, have usage limits, and return varied outcomes), the description is incomplete. With no annotations, no output schema, and minimal behavioral context, an AI agent lacks critical information about prerequisites, side effects, and response formats. The description does not compensate for these 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 all parameters (action, video_url, text) with descriptions and constraints. The description adds no additional parameter semantics beyond implying that 'text' is comment-specific. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 verb 'interact' and resource 'TikTok video', specifying three concrete actions (like, comment, follow). It distinguishes from siblings like tiktok_download or tiktok_search by focusing on user engagement rather than content retrieval or analysis. However, it doesn't explicitly contrast with tiktok_publish (which creates content) or tiktok_session (which might manage authentication).

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. For example, it doesn't clarify if tiktok_interact should be used for engagement metrics vs. tiktok_analyze_trend for trend analysis, or if authentication via tiktok_session is required first. There's no mention of prerequisites, rate limits, or use-case scenarios.

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