Skip to main content
Glama

tiktok_session

Manage TikTok browser sessions to check login status, refresh cookies, or export session information for automation tasks.

Instructions

Manage TikTok session: check login status, refresh cookies, export session info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesSession management action

Implementation Reference

  • The handler logic for the 'tiktok_session' tool within the server.py file.
    elif name == "tiktok_session":
        action = arguments["action"]
        if action == "check_login":
            logged_in = await browser.check_login()
            cookies_path = browser.cookies_path
            return [TextContent(type="text", text=json.dumps({
                "authenticated": logged_in,
                "cookies_path": cookies_path,
            }, indent=2))]
        elif action == "refresh_cookies":
            saved = await browser.save_cookies()
            return [TextContent(type="text", text=json.dumps({
                "cookies_refreshed": saved,
                "cookies_path": browser.cookies_path,
            }, indent=2))]
        elif action == "export_session":
            if browser._context:
                cookies = await browser._context.cookies()
                return [TextContent(type="text", text=json.dumps({
                    "cookie_count": len(cookies),
                    "domains": list(set(c.get("domain", "") for c in cookies)),
                    "session_keys": [c["name"] for c in cookies if "session" in c["name"].lower() or "sid" in c["name"].lower()],
                }, indent=2))]
            return [TextContent(type="text", text='{"error": "No active session"}')]
  • The tool registration definition for 'tiktok_session'.
    Tool(
        name="tiktok_session",
        description="Manage TikTok session: check login status, refresh cookies, export session info.",
        inputSchema={
            "type": "object",
            "properties": {
                "action": {
                    "type": "string",
                    "enum": ["check_login", "refresh_cookies", "export_session"],
                    "description": "Session management action",
                },
            },
            "required": ["action"],
        },
    ),
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 actions but doesn't disclose critical traits like authentication requirements, side effects (e.g., does 'refresh_cookies' invalidate old ones?), rate limits, or error handling. This leaves the agent guessing about operational risks.

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 extremely concise and front-loaded, packing all essential information into one efficient sentence. Every word earns its place without redundancy, making it easy for an agent 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 the tool's complexity (session management with multiple actions) and lack of both annotations and output schema, the description is insufficient. It doesn't explain what 'export_session' returns, how login status is determined, or the implications of cookie refresh. For a tool with potential authentication and state changes, more context is needed.

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?

Schema description coverage is 100%, so the schema fully documents the single 'action' parameter with its enum values. The description adds marginal value by listing the same actions in a more readable format, but doesn't provide additional semantics like when each action is appropriate or their outcomes. Baseline 3 is adjusted upward due to the single parameter's clarity.

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 specific verbs ('manage', 'check', 'refresh', 'export') and resource ('TikTok session'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'tiktok_interact' which might also involve session management, leaving room for ambiguity.

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 lists actions but doesn't explain prerequisites (e.g., when a session is needed), timing considerations, or how it relates to siblings like 'tiktok_interact' for session-based interactions.

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