Skip to main content
Glama
huseyindol

User Info MCP Server

by huseyindol

search_users_by_name

Find users by name in the User Info MCP Server to retrieve and manage user data stored in JSON files.

Instructions

İsme göre kullanıcı ara

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAranacak kullanıcı ismi

Implementation Reference

  • The main handler function for the 'search_users_by_name' tool. It receives the input, calls the user service to perform the search, handles errors, and returns a formatted MCP ToolResponse.
    static async handleSearchUsersByName({ name }: { name: string }): Promise<ToolResponse> { try { const result = await userService.searchUsersByName(name); return { content: [ { type: "text", text: result.success && result.data && result.data.length > 0 ? 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-based input schema defining the expected 'name' parameter for the tool.
    export const SearchUsersByNameInputSchema = { name: z.string().min(1).describe("Aranacak kullanıcı ismi") };
  • Tool registration using server.registerTool, specifying name, metadata, input schema, and handler reference.
    server.registerTool( "search_users_by_name", { title: "Kullanıcı Ara", description: "İsme göre kullanıcı ara", inputSchema: SearchUsersByNameInputSchema, }, UserController.handleSearchUsersByName );
  • Business logic helper in the service layer that validates input, queries the repository, and returns structured results used by the handler.
    async searchUsersByName(name: string): Promise<ServiceResult<User[]>> { try { // Business rule: Name must be at least 2 characters if (name.trim().length < 2) { return { success: false, error: "Arama terimi en az 2 karakter olmalıdır", data: [] }; } const users = await userRepository.findByName(name); return { success: true, data: users, message: users.length > 0 ? `"${name}" için ${users.length} kullanıcı bulundu` : `"${name}" ismiyle kullanıcı bulunamadı` }; } catch (error) { return { success: false, error: "Kullanıcı arama işleminde hata oluştu", 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/huseyindol/McpProjectScaffold'

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