list_users
Retrieve a list of users from your Slack workspace to manage team members and access contact information.
Instructions
List users in the Slack workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of users to return |
Implementation Reference
- src/tools/users.ts:8-22 (handler)The handler function for the 'list_users' tool. It validates input args using listUsersSchema, calls the Slack users.list API with limit and cursor parameters, and returns members list and next_cursor.export async function listUsers(client: SlackClientWrapper, args: unknown) { const params = listUsersSchema.parse(args); return await client.safeCall(async () => { const result = await client.getClient().users.list({ limit: params.limit, cursor: params.cursor, }); return { members: result.members || [], next_cursor: result.response_metadata?.next_cursor, }; }); }
- src/utils/validators.ts:32-35 (schema)Zod schema used for input validation in the listUsers handler, defining optional limit and cursor parameters.export const listUsersSchema = z.object({ limit: z.number().min(1).max(1000).optional().default(100), cursor: z.string().optional(), });
- src/index.ts:122-136 (registration)Tool registration in the list_tools response: defines name 'list_users', description, and JSON inputSchema matching the Zod schema.name: 'list_users', description: 'List users in the Slack workspace', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of users to return', default: 100, minimum: 1, maximum: 1000, }, }, }, },
- src/index.ts:421-421 (registration)Handler binding in the toolHandlers map: maps 'list_users' calls to userTools.listUsers function with slackClient.list_users: (args) => userTools.listUsers(slackClient, args),