get-users
Retrieve a complete list of all users in your Zulip organization, including profile details, Gravatar URLs, and custom profile fields, for comprehensive user directory access.
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)Registration and inline handler for the 'get-users' MCP tool. Handles input parameters, calls ZulipClient.getUsers, formats user data with roles, and returns JSON response or error in MCP format.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 schema defining optional input parameters for the 'get-users' tool: client_gravatar and include_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 that makes authenticated GET request to Zulip /users API endpoint, filters params, and returns raw user data used by the tool handler.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; }