Skip to main content
Glama
olamide-olaniyan

SociaVault MCP Server

get_twitter_tweets

Retrieve tweets from any Twitter/X user by providing their username. This tool accesses Twitter data through the SociaVault MCP Server for social media analysis and content extraction.

Instructions

Get tweets from a Twitter/X user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesTwitter username

Implementation Reference

  • Executes the get_twitter_tweets tool by calling the Sociavault API endpoint /twitter/user-tweets with the handle, extracts tweets using helper, and returns JSON stringified response.
    if (name === "get_twitter_tweets") { const { handle } = args as { handle: string }; const response = await axios.get(`${BASE_URL}/twitter/user-tweets`, { headers: { "X-API-Key": API_KEY }, params: { handle }, }); const extracted = extractTwitterTweets(response.data, 10); return { content: [ { type: "text", text: JSON.stringify( { handle, tweets: extracted, total_returned: extracted.length }, null, 2 ), }, ], }; }
  • src/index.ts:278-288 (registration)
    Registers the get_twitter_tweets tool in the tools list with name, description, and input schema requiring 'handle'.
    { name: "get_twitter_tweets", description: "Get tweets from a Twitter/X user", inputSchema: { type: "object", properties: { handle: { type: "string", description: "Twitter username" }, }, required: ["handle"], }, },
  • Helper function to extract and format up to 10 tweets from the API response data.
    function extractTwitterTweets(data: any, limit = 10) { const tweets = data?.data?.tweets || data?.tweets || data?.data || []; const tweetsArray = Array.isArray(tweets) ? tweets : tweets.timeline || []; return tweetsArray.slice(0, limit).map((tweet: any) => { return { id: tweet.id_str || tweet.id, text: tweet.full_text || tweet.text, created_at: tweet.created_at, retweets: tweet.retweet_count || 0, likes: tweet.favorite_count || tweet.like_count || 0, replies: tweet.reply_count || 0, is_retweet: tweet.retweeted || false, }; }); }

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