Skip to main content
Glama
ubie-oss

Slack MCP Server

by ubie-oss

slack_get_user_profiles

Retrieve profile information for multiple Slack users in bulk by providing their user IDs, enabling efficient user data management and integration.

Instructions

Get multiple users profile information in bulk

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idsYesArray of user IDs to retrieve profiles for (max 100)

Implementation Reference

  • The handler function for slack_get_user_profiles. Parses input arguments, fetches user profiles concurrently using slackClient.users.profile.get for each user ID, handles individual errors, parses response with GetUserProfilesResponseSchema, and returns JSON stringified result.
    case 'slack_get_user_profiles': { const args = GetUserProfilesRequestSchema.parse( request.params.arguments ); // Use Promise.all for concurrent API calls const profilePromises = args.user_ids.map(async (userId) => { try { const response = await slackClient.users.profile.get({ user: userId, }); if (!response.ok) { return { user_id: userId, error: response.error || 'Unknown error', }; } const parsed = UserProfileResponseSchema.parse(response); return { user_id: userId, profile: parsed.profile, }; } catch (error) { return { user_id: userId, error: error instanceof Error ? error.message : 'Unknown error', }; } }); const results = await Promise.all(profilePromises); const responseData = GetUserProfilesResponseSchema.parse({ profiles: results, }); return { content: [{ type: 'text', text: JSON.stringify(responseData) }], }; }
  • src/index.ts:153-157 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema.
    { name: 'slack_get_user_profiles', description: 'Get multiple users profile information in bulk', inputSchema: zodToJsonSchema(GetUserProfilesRequestSchema), },
  • Input schema validation using Zod for the tool, defining user_ids as array of strings (1-100).
    export const GetUserProfilesRequestSchema = z.object({ user_ids: z .array(z.string()) .min(1) .max(100) .describe('Array of user IDs to retrieve profiles for (max 100)'), });
  • Output response schema defining profiles array with user_id, optional profile and error.
    export const GetUserProfilesResponseSchema = z.object({ profiles: z.array( z.object({ user_id: z.string(), profile: ProfileSchema.optional(), error: z.string().optional(), }) ), });
  • Profile schema used in user profile responses, defining common profile fields.
    const ProfileSchema = z .object({ display_name: z.string().optional(), display_name_normalized: z.string().optional(), email: z.string().email().optional(), first_name: z.string().optional(), last_name: z.string().optional(), phone: z.string().optional(), real_name: z.string().optional(), real_name_normalized: z.string().optional(), title: z.string().optional(), }) .strip();

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/ubie-oss/slack-mcp-server'

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