get-user
Retrieve detailed user profile information from Zulip by providing a user ID. Returns role, timezone, avatar, and custom profile fields for comprehensive user lookup.
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 |
|---|---|---|---|
| user_id | Yes | Unique user ID to retrieve information for | |
| client_gravatar | No | Include Gravatar URL (default: true) | |
| include_custom_profile_fields | No | Include custom profile fields (default: false) |
Implementation Reference
- src/server.ts:852-885 (registration)Registration of the 'get-user' MCP tool, including name, description, schema reference, and the complete handler function that executes the tool logic.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 input schema for the 'get-user' tool defining parameters: user_id (number, required), client_gravatar (boolean, optional), include_custom_profile_fields (boolean, optional).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 method: supporting utility that makes the actual Zulip API GET request to /users/{userId} to fetch user profile data, called by the MCP tool handler.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; }