get_tiktok_profile
Retrieve TikTok profile information by providing a username to access user data and profile details from the platform.
Instructions
Get TikTok profile data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handle | Yes | TikTok username |
Implementation Reference
- src/index.ts:367-377 (handler)Handler implementation for the get_tiktok_profile tool. It extracts the 'handle' argument, makes an API request to the Sociavault TikTok profile endpoint, processes the response using the extractTikTokProfile helper, and returns the structured data as JSON.if (name === "get_tiktok_profile") { const { handle } = args as { handle: string }; const response = await axios.get(`${BASE_URL}/tiktok/profile`, { headers: { "X-API-Key": API_KEY }, params: { handle }, }); const extracted = extractTikTokProfile(response.data); return { content: [{ type: "text", text: JSON.stringify(extracted, null, 2) }], }; }
- src/index.ts:223-233 (registration)Tool registration entry for get_tiktok_profile, including name, description, and input schema definition.{ name: "get_tiktok_profile", description: "Get TikTok profile data", inputSchema: { type: "object", properties: { handle: { type: "string", description: "TikTok username" }, }, required: ["handle"], }, },
- src/index.ts:55-69 (helper)Helper function that extracts and structures essential TikTok profile information from the raw API response data.function extractTikTokProfile(data: any) { const user = data?.data?.userInfo?.user || data?.user || {}; const stats = data?.data?.userInfo?.stats || user.stats || {}; return { username: user.uniqueId || user.username, nickname: user.nickname, signature: user.signature, followers: stats.followerCount || 0, following: stats.followingCount || 0, likes: stats.heartCount || stats.heart || 0, videos: stats.videoCount || 0, verified: user.verified, avatar: user.avatarLarger || user.avatarMedium, }; }
- src/index.ts:226-232 (schema)Input schema definition for the get_tiktok_profile tool, specifying the required 'handle' parameter.inputSchema: { type: "object", properties: { handle: { type: "string", description: "TikTok username" }, }, required: ["handle"], },