bulkUserProfiles
Retrieve multiple Twitter user profiles simultaneously for comparison and analysis, supporting up to 20 users per request with optional detailed metrics.
Instructions
Get multiple user profiles in a single request for comparative analysis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| usernames | No | Array of usernames to analyze (e.g., ["elonmusk", "sundarpichai"]) | |
| userIds | No | Array of user IDs to analyze | |
| includeMetrics | No | Include detailed metrics and analytics (default: true) |
Implementation Reference
- Core handler function implementing bulkUserProfiles tool: fetches and aggregates user profiles for multiple usernames or user IDs using SocialData client.export const handleBulkUserProfiles: SocialDataHandler<BulkUserProfilesArgs> = async ( _client: any, { usernames = [], userIds = [], includeMetrics = true }: BulkUserProfilesArgs ) => { try { const socialClient = getSocialDataClient(); if (!socialClient) { return createMissingApiKeyResponse('Bulk User Profiles'); } const profiles = []; // Process usernames for (const username of usernames) { try { const profile = await socialClient.getUserProfile({ username, includeMetrics }); profiles.push(profile.data); } catch (error) { console.warn(`Failed to get profile for username: ${username}`, error); } } // Process user IDs for (const userId of userIds) { try { const profile = await socialClient.getUserProfile({ userId, includeMetrics }); profiles.push(profile.data); } catch (error) { console.warn(`Failed to get profile for userId: ${userId}`, error); } } if (profiles.length === 0) { return createSocialDataResponse('No user profiles retrieved'); } return createSocialDataResponse( formatUserList(profiles, `Bulk User Profiles (${profiles.length} users)`) ); } catch (error) { throw new Error(formatSocialDataError(error as Error, 'bulk user profiles')); } };
- src/socialdata-tools.ts:102-126 (schema)JSON Schema and description for the bulkUserProfiles tool input, used for MCP tool registration.bulkUserProfiles: { description: 'Get multiple user profiles in a single request for comparative analysis', inputSchema: { type: 'object', properties: { usernames: { type: 'array', items: { type: 'string' }, description: 'Array of usernames to analyze (e.g., ["elonmusk", "sundarpichai"])', maxItems: 20 }, userIds: { type: 'array', items: { type: 'string' }, description: 'Array of user IDs to analyze', maxItems: 20 }, includeMetrics: { type: 'boolean', description: 'Include detailed metrics and analytics (default: true)' } }, required: [] } },
- src/types/socialdata.ts:40-44 (schema)TypeScript interface defining the BulkUserProfilesArgs used by the handler.export interface BulkUserProfilesArgs { usernames?: string[]; userIds?: string[]; includeMetrics?: boolean; }
- src/index.ts:441-444 (registration)Tool dispatch/registration in the main CallToolRequestSchema switch statement, calling the handler.case 'bulkUserProfiles': { const args = request.params.arguments as any; response = await handleBulkUserProfiles(client, args); break;
- src/index.ts:71-72 (registration)Import of the handleBulkUserProfiles function from socialdata handlers for use in tool dispatching.handleBulkUserProfiles, handleUserGrowthAnalytics,