Skip to main content
Glama

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
NameRequiredDescriptionDefault
user_idYesUnique user ID to retrieve information for
client_gravatarNoInclude Gravatar URL (default: true)
include_custom_profile_fieldsNoInclude 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'}`);
        }
      }
    );
  • 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)")
    });
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/avisekrath/zulip-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server