Skip to main content
Glama

tiktok_get_post_details

Extract detailed TikTok video information including description, creator, hashtags, engagement metrics, creation date, duration, and available subtitles by providing a video URL or ID.

Instructions

Get the details of a TikTok post.This is used for getting the details of a TikTok post.Supports TikTok video url (or video ID) as input.Returns the details of the video like - Description - Video ID - Creator username - Hashtags - Number of likes, shares, comments, views and bookmarks - Date of creation - Duration of the video - Available subtitles with language and source information

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

Implementation Reference

  • The core handler function that fetches TikTok post details from the TikNeuron API endpoint and formats the response into a readable string.
    async function performGetPostDetails(tiktok_url: string) { const url = new URL('https://tikneuron.com/api/mcp/post-detail'); url.searchParams.set('tiktok_url', tiktok_url); 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 PostDetails; if (data.details) { const details = data.details; return `Description: ${details.description || 'N/A'} Video ID: ${details.video_id || 'N/A'} Creator: ${details.creator || 'N/A'} Hashtags: ${Array.isArray(details.hashtags) ? details.hashtags.join(', ') : 'N/A'} Likes: ${details.likes || '0'} Shares: ${details.shares || '0'} Comments: ${details.comments || '0'} Views: ${details.views || '0'} Bookmarks: ${details.bookmarks || '0'} Created at: ${details.created_at || 'N/A'} Duration: ${details.duration || 0} seconds Available subtitles: ${details.available_subtitles?.map(sub => `${sub.language || 'Unknown'} (${sub.source || 'Unknown source'})`).join(', ') || 'None'}`; } else { return 'No details available'; } }
  • The switch case in the CallToolRequestSchema handler that validates input arguments and invokes the performGetPostDetails function.
    case "tiktok_get_post_details": { if (!isGetPostDetailsArgs(args)) { throw new Error("Invalid arguments for tiktok_get_post_details"); } const { tiktok_url } = args; const results = await performGetPostDetails(tiktok_url); return { content: [{ type: "text", text: results }], isError: false, }; }
  • Tool definition including name, description, and input schema for validation.
    const GET_POST_DETAILS: Tool = { name: "tiktok_get_post_details", description: "Get the details of a TikTok post." + "This is used for getting the details of a TikTok post." + "Supports TikTok video url (or video ID) as input." + "Returns the details of the video like" + " - Description" + " - Video ID" + " - Creator username" + " - Hashtags" + " - Number of likes, shares, comments, views and bookmarks" + " - Date of creation" + " - Duration of the video" + " - Available subtitles with language and source information", 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", }, }, required: ["tiktok_url"], }, };
  • index.ts:318-320 (registration)
    Registration of the tool in the ListToolsRequestSchema handler, making it discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [GET_SUBTITLE, GET_POST_DETAILS, SEARCH], }));
  • Type guard function to validate input arguments for the tiktok_get_post_details tool.
    function isGetPostDetailsArgs(args: unknown): args is { tiktok_url: string } { return ( typeof args === "object" && args !== null && "tiktok_url" in args && typeof (args as { tiktok_url: string }).tiktok_url === "string" ); }

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