get_twitter_profile
Retrieve Twitter/X profile information by username to access user data and engagement metrics through SociaVault MCP Server.
Instructions
Get Twitter/X profile data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handle | Yes | Twitter username |
Implementation Reference
- src/index.ts:379-389 (handler)Executes the get_twitter_profile tool: calls Sociavault API /twitter/profile endpoint with the handle, extracts profile using helper, and returns JSON stringified content.if (name === "get_twitter_profile") { const { handle } = args as { handle: string }; const response = await axios.get(`${BASE_URL}/twitter/profile`, { headers: { "X-API-Key": API_KEY }, params: { handle }, }); const extracted = extractTwitterProfile(response.data); return { content: [{ type: "text", text: JSON.stringify(extracted, null, 2) }], }; }
- src/index.ts:234-244 (registration)Registers the get_twitter_profile tool in the tools list with name, description, and input schema.{ name: "get_twitter_profile", description: "Get Twitter/X profile data", inputSchema: { type: "object", properties: { handle: { type: "string", description: "Twitter username" }, }, required: ["handle"], }, },
- src/index.ts:71-83 (helper)Helper function extracts and formats essential Twitter profile fields from the API response data.function extractTwitterProfile(data: any) { const user = data?.data?.user || data?.user || {}; return { username: user.screen_name || user.username, name: user.name, description: user.description, followers: user.followers_count || 0, following: user.friends_count || 0, tweets: user.statuses_count || 0, verified: user.verified, profile_image: user.profile_image_url_https, }; }