Skip to main content
Glama
huseyindol

User Info MCP Server

by huseyindol

search_users_by_email

Find user information by searching with an email address. This tool helps locate specific user data in the User Info MCP Server system.

Instructions

E-posta adresine göre kullanıcı ara

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesAranacak kullanıcı e-posta adresi

Implementation Reference

  • The handler function that executes the tool logic: receives email input, calls userService.searchUsersByEmail, formats result into MCP ToolResponse with JSON stringified output.
    static async handleSearchUsersByEmail({ email }: { email: string }): Promise<ToolResponse> {
      try {
        const result = await userService.searchUsersByEmail(email);
        
        return {
          content: [
            {
              type: "text",
              text: result.success && result.data
                ? JSON.stringify(result.data, null, 2)
                : result.message || result.error || "Kullanıcı bulunamadı",
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: "Kullanıcı arama işleminde hata oluştu",
            },
          ],
        };
      }
    }
  • Zod schema defining the input for the tool: requires a valid email string.
    export const SearchUsersByEmailInputSchema = {
      email: z.string().email().describe("Aranacak kullanıcı e-posta adresi")
    };
  • Registration of the MCP tool 'search_users_by_email' with title, description, input schema, and reference to the handler function.
    server.registerTool(
      "search_users_by_email",
      {
        title: "Kullanıcı Ara",
        description: "E-posta adresine göre kullanıcı ara",
        inputSchema: SearchUsersByEmailInputSchema,
      },
      UserController.handleSearchUsersByEmail
    );
  • Supporting service method implementing business logic: validates email format, queries repository by email, returns structured ServiceResult.
    async searchUsersByEmail(email: string): Promise<ServiceResult<User | null>> {
      try {
        // Business rule: Email must be a valid email address
        if (!email.includes('@')) {
          return {
            success: false,
            error: "E-posta adresi geçersiz",
            data: null
          };
        }
    
        const user = await userRepository.findByEmail(email);
        
        return {
          success: true,
          data: user,
          message: user ? `"${email}" için kullanıcı bulundu` : `"${email}" e-posta adresiyle kullanıcı bulunamadı`
        };
      } catch (error) {
        return {
          success: false,
          error: "Kullanıcı arama işleminde hata oluştu",
          data: null
        };
      }
    }

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/huseyindol/McpProjectScaffold'

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