Skip to main content
Glama

get-user-by-email

Find Zulip users by their exact email address to retrieve detailed profile information including custom fields and Gravatar images.

Instructions

📧 EXACT LOOKUP: Find a user when you have their exact email address. Use this when you know the specific email and need detailed profile information. Returns single user with complete details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesEmail address of the user to look up
client_gravatarNoInclude Gravatar profile image URL
include_custom_profile_fieldsNoInclude organization-specific custom profile fields

Implementation Reference

  • Main execution logic for the 'get-user-by-email' tool. Fetches user data via Zulip client and returns formatted JSON response.
    async ({ email, client_gravatar, include_custom_profile_fields }) => {
      try {
        const result = await zulipClient.getUserByEmail(email, {
          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 by email: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Zod input schema defining parameters for the get-user-by-email tool: email (required), optional client_gravatar and include_custom_profile_fields.
    export const GetUserByEmailSchema = z.object({
      email: z.string().email().describe("Email address of the user to look up"),
      client_gravatar: z.boolean().optional().describe("Include Gravatar profile image URL"),
      include_custom_profile_fields: z.boolean().optional().describe("Include organization-specific custom profile fields")
    });
  • src/server.ts:547-580 (registration)
    MCP server.tool registration call that defines the tool name, description, schema, and handler function.
    server.tool(
      "get-user-by-email",
      "📧 EXACT LOOKUP: Find a user when you have their exact email address. Use this when you know the specific email and need detailed profile information. Returns single user with complete details.",
      GetUserByEmailSchema.shape,
      async ({ email, client_gravatar, include_custom_profile_fields }) => {
        try {
          const result = await zulipClient.getUserByEmail(email, {
            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 by email: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • ZulipClient helper method that performs the actual API call to retrieve user by email via GET /users/{email}.
    async getUserByEmail(email: string, params: {
      client_gravatar?: boolean;
      include_custom_profile_fields?: boolean;
    } = {}): Promise<{ user: ZulipUser }> {
      // Filter out undefined values
      const filteredParams = Object.fromEntries(
        Object.entries(params).filter(([, value]) => value !== undefined)
      );
      const response = await this.client.get(`/users/${encodeURIComponent(email)}`, { params: filteredParams });
      return response.data;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses key behavioral traits: it's a lookup/read operation (implied by 'Find'), returns a single user with complete details, and requires exact email matching. However, it doesn't mention error handling (e.g., if user not found) or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences with zero waste: first states purpose, second gives usage context, third describes output. It's front-loaded with the core action ('EXACT LOOKUP') and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only lookup tool with 3 parameters (1 required) and no output schema, the description is mostly complete. It covers purpose, usage, and output type, but lacks details on error cases or response format. Given the simplicity, it's adequate but could mention what 'complete details' includes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description doesn't add meaning beyond the schema (e.g., it doesn't explain 'client_gravatar' or 'include_custom_profile_fields'). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('EXACT LOOKUP: Find a user') with the resource ('user') and key constraint ('when you have their exact email address'). It distinguishes from sibling tools like 'get-user' (generic) and 'search-users' (fuzzy search) by emphasizing exact email matching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use ('when you know the specific email and need detailed profile information'). It implies when not to use (e.g., for fuzzy search or multiple users) by contrasting with sibling tools like 'search-users' and 'get-users', though alternatives aren't named directly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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