slack_get_users
Retrieve basic profile information of all users in a Slack workspace, with pagination support using cursor and limit parameters.
Instructions
Retrieve basic profile information of all users in the workspace
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor for next page of results | |
| limit | No | Maximum number of users to return (default 100) |
Implementation Reference
- src/index.ts:291-305 (handler)The handler that executes the slack_get_users tool. It parses the request via GetUsersRequestSchema, calls slackClient.users.list() with pagination (limit/cursor), validates the response with GetUsersResponseSchema, and returns the user list as JSON.
case 'slack_get_users': { const args = GetUsersRequestSchema.parse(request.params.arguments); const response = await slackClient.users.list({ limit: args.limit, cursor: args.cursor, }); if (!response.ok) { throw new Error(`Failed to get users: ${response.error}`); } const parsed = GetUsersResponseSchema.parse(response); return { content: [{ type: 'text', text: JSON.stringify(parsed) }], }; } - src/schemas.ts:162-174 (schema)Input schema (GetUsersRequestSchema) for slack_get_users: accepts optional cursor (string) and limit (number, default 100).
export const GetUsersRequestSchema = z.object({ cursor: z .string() .optional() .describe('Pagination cursor for next page of results'), limit: z .number() .int() .min(1) .optional() .default(100) .describe('Maximum number of users to return (default 100)'), }); - src/schemas.ts:398-400 (schema)Output/response schema (GetUsersResponseSchema) for slack_get_users: extends BaseResponseSchema with an optional array of members (MemberSchema with id, name, real_name).
export const GetUsersResponseSchema = BaseResponseSchema.extend({ members: z.array(MemberSchema).optional(), }); - src/index.ts:147-177 (registration)Registration of slack_get_users as a tool in the ListToolsRequestSchema handler, with description and input schema reference.
{ name: 'slack_get_users', description: 'Retrieve basic profile information of all users in the workspace', inputSchema: zodToJsonSchema(GetUsersRequestSchema), }, { name: 'slack_get_user_profiles', description: 'Get multiple users profile information in bulk', inputSchema: zodToJsonSchema(GetUserProfilesRequestSchema), }, { name: 'slack_search_messages', description: 'Search for messages with specific criteria/filters. Use this when: 1) You need to find messages from a specific user, 2) You need messages from a specific date range, 3) You need to search by keywords, 4) You want to filter by channel. This tool is optimized for targeted searches. For general channel browsing without filters, use slack_get_channel_history instead.', inputSchema: zodToJsonSchema(SearchMessagesRequestSchema), }, { name: 'slack_search_channels', description: 'Search for channels by partial name match. Use this when you need to find channels containing specific keywords in their names. Returns up to the specified limit of matching channels.', inputSchema: zodToJsonSchema(SearchChannelsRequestSchema), }, { name: 'slack_search_users', description: 'Search for users by partial name match across username, display name, and real name. Use this when you need to find users containing specific keywords in their names. Returns up to the specified limit of matching users.', inputSchema: zodToJsonSchema(SearchUsersRequestSchema), }, ], }; - examples/get_users.ts:65-66 (helper)Example client code demonstrating how to call the slack_get_users tool via stdio transport.
// Call slack_get_users