Skip to main content
Glama
olamide-olaniyan

SociaVault MCP Server

get_youtube_channel

Retrieve YouTube channel data by handle or @username to access profiles, videos, and engagement metrics for analysis.

Instructions

Get YouTube channel data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesYouTube channel handle or @username

Implementation Reference

  • The core handler logic for the 'get_youtube_channel' tool. It extracts the 'handle' argument, makes an API request to the Sociavault YouTube channel endpoint, processes the response using the extractYouTubeChannel helper, and returns the structured data as JSON text.
    if (name === "get_youtube_channel") { const { handle } = args as { handle: string }; const response = await axios.get(`${BASE_URL}/youtube/channel`, { headers: { "X-API-Key": API_KEY }, params: { handle }, }); const extracted = extractYouTubeChannel(response.data); return { content: [{ type: "text", text: JSON.stringify(extracted, null, 2) }], }; }
  • Input schema definition for the 'get_youtube_channel' tool, specifying an object with a required 'handle' string parameter.
    inputSchema: { type: "object", properties: { handle: { type: "string", description: "YouTube channel handle or @username", }, }, required: ["handle"], },
  • src/index.ts:300-313 (registration)
    Registration of the 'get_youtube_channel' tool in the MCP tools array, including name, description, and input schema.
    { name: "get_youtube_channel", description: "Get YouTube channel data", inputSchema: { type: "object", properties: { handle: { type: "string", description: "YouTube channel handle or @username", }, }, required: ["handle"], }, },
  • Helper function that extracts and structures YouTube channel information from the raw API response data.
    function extractYouTubeChannel(data: any) { const channel = data?.data?.channel || data?.channel || data?.data || {}; const snippet = channel.snippet || {}; const statistics = channel.statistics || {}; return { title: snippet.title || channel.title, description: snippet.description || channel.description || "", subscribers: parseInt(statistics.subscriberCount || statistics.subscribers || "0") || 0, videos: parseInt(statistics.videoCount || "0") || 0, views: parseInt(statistics.viewCount || "0") || 0, custom_url: channel.customUrl || snippet.customUrl, thumbnail: snippet.thumbnails?.high?.url || snippet.thumbnails?.default?.url, published_at: snippet.publishedAt || channel.publishedAt, }; }

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