tiktok_get_post_details
Retrieve detailed information from any TikTok video using its URL or ID. Get description, creator username, hashtags, likes, shares, comments, views, bookmarks, creation date, duration, and available subtitles with language and source.
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
| Name | Required | Description | Default |
|---|---|---|---|
| tiktok_url | Yes | 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 |
Implementation Reference
- index.ts:122-141 (schema)Type definition for the PostDetails interface returned by the API, containing all TikTok post detail fields (description, video_id, creator, hashtags, engagement metrics, creation date, duration, and available subtitles).
interface PostDetails { success: boolean; details: { description: string; video_id: string; creator: string; hashtags: string[]; likes: string; shares: string; comments: string; views: string; bookmarks: string; created_at: string; duration: number; available_subtitles: Array<{ language?: string; source?: string; }>; }; } - index.ts:180-187 (schema)Type guard that validates the input arguments for tiktok_get_post_details tool - checks that args is an object containing a string 'tiktok_url'.
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" ); } - index.ts:279-314 (handler)Core handler function that calls the TikNeuron API (https://tikneuron.com/api/mcp/post-detail) with the tiktok_url, formats the response into a human-readable string with all post details.
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'; } } - index.ts:36-61 (registration)Tool registration definition for tiktok_get_post_details - declares the tool name, description, and input schema (requires tiktok_url string). Listed in the tools array at line 319.
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:344-355 (registration)Request handler case that routes 'tiktok_get_post_details' tool calls to performGetPostDetails, validating arguments with isGetPostDetailsArgs type guard.
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, }; }