Skip to main content
Glama

tiktok_get_subtitle

Retrieve the subtitle (content) from a TikTok video URL. Supports video URL or ID, and optional language code to get subtitles in a specific language; defaults to automatic speech recognition.

Instructions

Get the subtitle (content) for a TikTok video url.This is used for getting the subtitle, content or context for a TikTok video.Supports TikTok video url (or video ID) as input and optionally language code from the tool post detailsReturns the subtitle for the video in the requested language and format.If no language code is provided, the tool will return the subtitle of automatic speech recognition.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tiktok_urlYesTikTok video URL, e.g., https://www.tiktok.com/@username/video/1234567890 or https://vm.tiktok.com/1234567890, or just the video ID like 7409731702890827041
language_codeNoLanguage code for the subtitle, e.g., en for English, es for Spanish, fr for French, etc.

Implementation Reference

  • Tool definition and input schema for tiktok_get_subtitle, specifying name, description, and input validation schema requiring tiktok_url and optionally language_code.
    const GET_SUBTITLE: Tool = {
        name: "tiktok_get_subtitle",
        description:
            "Get the subtitle (content) for a TikTok video url." +
            "This is used for getting the subtitle, content or context for a TikTok video." +
            "Supports TikTok video url (or video ID) as input and optionally language code from the tool post details" +
            "Returns the subtitle for the video in the requested language and format." +
            "If no language code is provided, the tool will return the subtitle of automatic speech recognition.",
        inputSchema: {
            type: "object",
            properties: {
                tiktok_url: {
                    type: "string",
                    description: "TikTok video URL, e.g., https://www.tiktok.com/@username/video/1234567890 or https://vm.tiktok.com/1234567890, or just the video ID like 7409731702890827041",
                },
                language_code: {
                    type: "string",
                    description: "Language code for the subtitle, e.g., en for English, es for Spanish, fr for French, etc.",
                },
            },
            required: ["tiktok_url"]
        }
    };
  • Core handler function that calls the TikNeuron API (https://tikneuron.com/api/mcp/get-subtitles) with tiktok_url and optional language_code, returning subtitle_content.
    async function performGetSubtitle(tiktok_url: string, language_code: string) {
        const url = new URL('https://tikneuron.com/api/mcp/get-subtitles');
        url.searchParams.set('tiktok_url', tiktok_url);
    
        if (language_code){
            url.searchParams.set('language_code', language_code);
        }
    
        const response = await fetch(url, {
            headers: {
                'Accept': 'application/json',
                'Accept-Encoding': 'gzip',
                'MCP-API-KEY': TIKNEURON_MCP_API_KEY,
            }
        });
    
        if (!response.ok) {
            throw new Error(`TikNeuron API error: ${response.status} ${response.statusText}\n${await response.text()}`);
        }
    
        const data = await response.json() as Subtitle;
    
        return data.subtitle_content || 'No subtitle available';
    }
  • Request handler switch case that validates args and delegates to performGetSubtitle for the tiktok_get_subtitle tool.
    case "tiktok_get_subtitle": {
        if (!isGetSubtitleArgs(args)) {
            throw new Error("Invalid arguments for tiktok_get_subtitle");
        }
        const { tiktok_url, language_code } = args;
    
        const results = await performGetSubtitle(tiktok_url, language_code);
        return {
            content: [{ type: "text", text: results }],
            isError: false,
        };
    }
  • Type guard that validates the arguments for tiktok_get_subtitle, checking that tiktok_url is present and is a string.
    function isGetSubtitleArgs(args: unknown): args is { tiktok_url: string, language_code: string } {
        return (
            typeof args === "object" &&
            args !== null &&
            "tiktok_url" in args &&
            typeof (args as { tiktok_url: string }).tiktok_url === "string"
        );
    }
  • index.ts:318-319 (registration)
    Registration of tiktok_get_subtitle (via GET_SUBTITLE constant) in the list of tools exposed by the MCP server.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [GET_SUBTITLE, GET_POST_DETAILS, SEARCH],
Behavior3/5

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

With no annotations, the description carries the burden; it mentions automatic speech recognition fallback but omits other behaviors like rate limits, authorization, or error handling for missing subtitles.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description has some redundancy (e.g., 'Get the subtitle...' and 'This is used for getting...'). Could be more concise without losing clarity.

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?

Adequate for a simple tool with two parameters, but lacks details on return format, error handling, and authentication requirements. Not thoroughly complete.

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 coverage is 100%, so parameters are already described. The description adds little beyond the schema, only mentioning the automatic speech recognition fallback for missing language code.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool gets subtitles for TikTok videos using a URL or ID. This distinguishes it from siblings like tiktok_get_post_details and tiktok_search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains the tool is for getting subtitles and mentions optional language code. However, it does not explicitly state when not to use it or compare with alternatives.

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

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