add_user
Add new users to the system by entering their full name, email, and phone number. Ideal for managing user data efficiently on the User Info MCP Server.
Instructions
Yeni kullanıcı ekle
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | E-posta adresi | ||
| name | Yes | Kullanıcının tam adı | |
| phone | Yes | Telefon numarası |
Implementation Reference
- The main handler function that executes the add_user tool logic: destructures input params, calls userService.createUser, formats success/error into MCP ToolResponse.static async handleAddUser({ name, email, phone }: { name: string; email: string; phone: string }): Promise<ToolResponse> { try { const result = await userService.createUser({ name, email, phone }); return { content: [ { type: "text", text: result.success ? `${result.message}\n${JSON.stringify(result.data, null, 2)}` : result.error || "Kullanıcı oluşturulamadı", }, ], }; } catch (error) { return { content: [ { type: "text", text: "Kullanıcı oluşturma işleminde hata oluştu", }, ], }; } }
- src/types/user.ts:31-35 (schema)Zod input schema defining and validating the required parameters: name (string, min2 max100), email (valid email), phone (string min10 max20).export const AddUserInputSchema = { name: z.string().min(2).max(100).describe("Kullanıcının tam adı"), email: z.string().email().describe("E-posta adresi"), phone: z.string().min(10).max(20).describe("Telefon numarası") };
- src/tools/user-tools.ts:74-82 (registration)Registers the 'add_user' tool on the MCP server with name, title, description, input schema reference, and handler function reference.server.registerTool( "add_user", { title: "Kullanıcı Ekle", description: "Yeni kullanıcı ekle", inputSchema: AddUserInputSchema, }, UserController.handleAddUser );