get-users
Retrieve a complete list of all users in your Zulip organization with their profile information to access the full user directory.
Instructions
š„ ALL USERS: Get complete list of all users in the organization with their profile information. Use this to see everyone at once or when you need the full user directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_gravatar | No | Include Gravatar URLs for users (default: true) | |
| include_custom_profile_fields | No | Include custom profile fields (default: false) |
Implementation Reference
- src/server.ts:463-495 (handler)Primary handler and registration for the 'get-users' tool. Registers the tool with MCP server, defines input schema reference, and implements the execution logic which calls ZulipClient.getUsers() and formats the response as JSON.server.tool( "get-users", "š„ ALL USERS: Get complete list of all users in the organization with their profile information. Use this to see everyone at once or when you need the full user directory.", ListUsersSchema.shape, async ({ client_gravatar, include_custom_profile_fields }) => { try { const result = await zulipClient.getUsers({ client_gravatar, include_custom_profile_fields }); return createSuccessResponse(JSON.stringify({ user_count: result.members.length, users: result.members.map(user => ({ id: user.user_id, email: user.email, full_name: user.full_name, is_active: user.is_active, is_bot: user.is_bot, role: user.is_owner ? 'owner' : user.is_admin ? 'admin' : user.is_moderator ? 'moderator' : user.is_guest ? 'guest' : 'member', date_joined: user.date_joined, timezone: user.timezone, avatar_url: user.avatar_url })) }, null, 2)); } catch (error) { return createErrorResponse(`Error listing users: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/types.ts:189-192 (schema)Zod input schema definition for the get-users tool, defining optional parameters for Gravatar inclusion and custom profile fields.export const ListUsersSchema = z.object({ client_gravatar: z.boolean().optional().describe("Include Gravatar URLs for users (default: true)"), include_custom_profile_fields: z.boolean().optional().describe("Include custom profile fields (default: false)") });
- src/zulip/client.ts:374-384 (helper)ZulipClient helper method getUsers() that performs the actual API request to Zulip's /users endpoint, filtering undefined params before the GET request.async getUsers(params: { client_gravatar?: boolean; include_custom_profile_fields?: boolean; } = {}): Promise<{ members: ZulipUser[] }> { // Filter out undefined values const filteredParams = Object.fromEntries( Object.entries(params).filter(([, value]) => value !== undefined) ); const response = await this.client.get('/users', { params: filteredParams }); return response.data; }