get-user
Retrieve detailed user profiles by providing a user ID. Access comprehensive information including role, timezone, avatar, and custom profile fields for efficient user management in Zulip workspaces.
Instructions
🆔 DETAILED LOOKUP: Get comprehensive user profile when you have their user ID (from search-users results). Returns complete user information including role, timezone, avatar, and custom profile fields.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_gravatar | No | Include Gravatar URL (default: true) | |
| include_custom_profile_fields | No | Include custom profile fields (default: false) | |
| user_id | Yes | Unique user ID to retrieve information for |
Implementation Reference
- src/server.ts:852-884 (handler)Handler function for the 'get-user' tool. Takes user_id and optional flags, calls zulipClient.getUser, maps role, formats JSON response with success/error handling.server.tool( "get-user", "🆔 DETAILED LOOKUP: Get comprehensive user profile when you have their user ID (from search-users results). Returns complete user information including role, timezone, avatar, and custom profile fields.", GetUserSchema.shape, async ({ user_id, client_gravatar, include_custom_profile_fields }) => { try { const result = await zulipClient.getUser(user_id, { client_gravatar, include_custom_profile_fields }); return createSuccessResponse(JSON.stringify({ user: { id: result.user.user_id, email: result.user.email, full_name: result.user.full_name, is_active: result.user.is_active, is_bot: result.user.is_bot, role: result.user.is_owner ? 'owner' : result.user.is_admin ? 'admin' : result.user.is_moderator ? 'moderator' : result.user.is_guest ? 'guest' : 'member', date_joined: result.user.date_joined, timezone: result.user.timezone, avatar_url: result.user.avatar_url, profile_data: result.user.profile_data } }, null, 2)); } catch (error) { return createErrorResponse(`Error getting user: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/types.ts:177-181 (schema)Zod schema defining input parameters for get-user tool: user_id (required), client_gravatar and include_custom_profile_fields (optional booleans).export const GetUserSchema = z.object({ user_id: z.number().describe("Unique user ID to retrieve information for"), client_gravatar: z.boolean().optional().describe("Include Gravatar URL (default: true)"), include_custom_profile_fields: z.boolean().optional().describe("Include custom profile fields (default: false)") });
- src/zulip/client.ts:499-508 (helper)ZulipClient.getUser helper method: makes authenticated GET request to Zulip API /users/{userId} endpoint with optional params, returns raw API response typed as { user: ZulipUser }.async getUser(userId: number, params: { client_gravatar?: boolean; include_custom_profile_fields?: boolean; } = {}): Promise<{ user: ZulipUser }> { debugLog('🔍 Debug - getUser called with:', { userId, ...params }); const response = await this.client.get(`/users/${userId}`, { params }); debugLog('✅ Debug - User retrieved successfully:', response.data); return response.data; }
- src/types.ts:59-75 (schema)TypeScript interface ZulipUser defining the structure of user data returned from Zulip API, used in handler response mapping.export interface ZulipUser { user_id: number; email: string; full_name: string; date_joined: string; is_active: boolean; is_owner: boolean; is_admin: boolean; is_moderator: boolean; is_guest: boolean; is_bot: boolean; bot_type: number | null; timezone: string; avatar_url: string; delivery_email: string; profile_data: Record<string, any>; }