Skip to main content
Glama
olamide-olaniyan

SociaVault MCP Server

get_tiktok_videos

Retrieve TikTok videos from a specific user by providing their username. This tool accesses video content through the SociaVault MCP Server for social media data queries.

Instructions

Get TikTok videos from a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesTikTok username

Implementation Reference

  • Handler for the get_tiktok_videos tool: fetches videos from Sociavault API endpoint `/tiktok/videos` using the provided handle, extracts data with `extractTikTokVideos`, and returns JSON-formatted response.
    if (name === "get_tiktok_videos") {
      const { handle } = args as { handle: string };
      const response = await axios.get(`${BASE_URL}/tiktok/videos`, {
        headers: { "X-API-Key": API_KEY },
        params: { handle },
      });
      const extracted = extractTikTokVideos(response.data, 10);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              { handle, videos: extracted, total_returned: extracted.length },
              null,
              2
            ),
          },
        ],
      };
    }
  • src/index.ts:267-277 (registration)
    Tool registration entry for get_tiktok_videos, including name, description, and input schema requiring a 'handle' parameter.
    {
      name: "get_tiktok_videos",
      description: "Get TikTok videos from a user",
      inputSchema: {
        type: "object",
        properties: {
          handle: { type: "string", description: "TikTok username" },
        },
        required: ["handle"],
      },
    },
  • Helper function that parses TikTok API response data to extract up to 10 videos, normalizing fields like id, description, stats, and cover image.
    function extractTikTokVideos(data: any, limit = 10) {
      const videos =
        data?.data?.itemList ||
        data?.itemList ||
        data?.data?.videos ||
        data?.videos ||
        [];
      return videos.slice(0, limit).map((video: any) => {
        const stats = video.statistics || video.stats || {};
        return {
          id: video.id || video.aweme_id,
          description: video.desc || video.description || "",
          likes: stats.like_count || stats.digg_count || 0,
          comments: stats.comment_count || 0,
          shares: stats.share_count || 0,
          views: stats.play_count || stats.view_count || 0,
          timestamp: video.create_time || video.timestamp,
          duration: video.duration,
          cover: video.cover || video.video?.cover || video.cover_url,
        };
      });
    }

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/olamide-olaniyan/sociavault-mcp'

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