add_user
Add new users to the MCP JSON Database Server by specifying essential details like name, email, department, position, and join date. Supports optional fields such as salary, skills, and address for comprehensive user management.
Instructions
Yeni kullanıcı ekler
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | No | Adres (opsiyonel) | |
| birthDate | No | Doğum tarihi (YYYY-MM-DD formatında, opsiyonel) | |
| department | Yes | Departman | |
| Yes | E-posta adresi | ||
| joinDate | Yes | İşe giriş tarihi (YYYY-MM-DD formatında) | |
| name | Yes | Kullanıcı adı | |
| phone | No | Telefon numarası (opsiyonel) | |
| position | Yes | Pozisyon | |
| salary | No | Maaş (opsiyonel) | |
| skills | No | Yetenekler listesi (opsiyonel) |
Implementation Reference
- src/index.js:707-722 (handler)Handler function for the 'add_user' tool. Generates a unique ID using generateId, spreads input arguments into newUser object, appends to db.users array, persists to database with writeDatabase, and returns success response with the new user data.case 'add_user': { const newUser = { id: generateId(db.users), ...args }; db.users.push(newUser); await writeDatabase(db); return { content: [{ type: 'text', text: JSON.stringify({ success: true, user: newUser }) }] }; }
- src/index.js:255-274 (schema)Input schema and metadata (name, description) for the 'add_user' tool, defining properties and required fields for new user creation.{ name: 'add_user', description: 'Yeni kullanıcı ekler', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Kullanıcı adı' }, email: { type: 'string', description: 'E-posta adresi' }, department: { type: 'string', description: 'Departman' }, position: { type: 'string', description: 'Pozisyon' }, joinDate: { type: 'string', description: 'İşe giriş tarihi (YYYY-MM-DD formatında)' }, salary: { type: 'number', description: 'Maaş (opsiyonel)' }, birthDate: { type: 'string', description: 'Doğum tarihi (YYYY-MM-DD formatında, opsiyonel)' }, phone: { type: 'string', description: 'Telefon numarası (opsiyonel)' }, address: { type: 'string', description: 'Adres (opsiyonel)' }, skills: { type: 'array', items: { type: 'string' }, description: 'Yetenekler listesi (opsiyonel)' } }, required: ['name', 'email', 'department', 'position', 'joinDate'] } },
- src/index.js:60-360 (registration)The tool is registered by including it in the tools array returned by the ListToolsRequestSchema handler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ // Kimlik doğrulama araçları { name: 'register', description: 'Yeni kullanıcı kaydı oluşturur', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Kullanıcı adı' }, email: { type: 'string', description: 'E-posta adresi' }, password: { type: 'string', description: 'Şifre' }, department: { type: 'string', description: 'Departman' }, position: { type: 'string', description: 'Pozisyon' }, role: { type: 'string', enum: ['admin', 'manager', 'employee'], description: 'Kullanıcı rolü' } }, required: ['name', 'email', 'password', 'department', 'position'] } }, { name: 'login', description: 'Kullanıcı giriş yapar ve JWT token alır', inputSchema: { type: 'object', properties: { email: { type: 'string', description: 'Kullanıcı e-posta adresi' }, password: { type: 'string', description: 'Kullanıcı şifresi' } }, required: ['email', 'password'] } }, { name: 'verify_token', description: 'JWT token\'ın geçerliliğini kontrol eder', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' } }, required: ['token'] } }, { name: 'change_password', description: 'Kullanıcı şifresini değiştirir', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, oldPassword: { type: 'string', description: 'Mevcut şifre' }, newPassword: { type: 'string', description: 'Yeni şifre' } }, required: ['token', 'oldPassword', 'newPassword'] } }, { name: 'get_my_permissions', description: 'Kullanıcının sahip olduğu yetkileri listeler', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' } }, required: ['token'] } }, // Telefon Transkript Yönetimi { name: 'list_call_transcripts', description: 'Telefon görüşmeleri transkriptlerini listeler', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, limit: { type: 'number', description: 'Gösterilecek kayıt sayısı (varsayılan: 50)' }, category: { type: 'string', description: 'Kategori filtresi (destek, satış, şikayet)' }, sentiment: { type: 'string', description: 'Duygu durumu filtresi (positive, negative, neutral)' } }, required: ['token'] } }, { name: 'get_call_transcript_by_id', description: 'ID\'ye göre telefon transkripti getirir', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, id: { type: 'number', description: 'Transkript ID\'si' } }, required: ['token', 'id'] } }, { name: 'search_call_transcripts', description: 'Transkriptlerde anahtar kelime arama yapar', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, query: { type: 'string', description: 'Aranacak kelime veya cümle' }, searchIn: { type: 'string', description: 'Arama alanı (transcript, callerName, keywords)', enum: ['transcript', 'callerName', 'keywords', 'all'] } }, required: ['token', 'query'] } }, { name: 'add_call_transcript', description: 'Yeni telefon görüşmesi transkripti ekler', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, callerPhone: { type: 'string', description: 'Arayan telefon numarası' }, callerName: { type: 'string', description: 'Arayan kişi adı' }, callerCompany: { type: 'string', description: 'Arayan şirket' }, transcript: { type: 'string', description: 'Konuşma transkripti' }, duration: { type: 'number', description: 'Görüşme süresi (saniye)' }, category: { type: 'string', description: 'Kategori (destek, satış, şikayet)' }, priority: { type: 'string', description: 'Öncelik (low, normal, high, urgent)' }, keywords: { type: 'array', items: { type: 'string' }, description: 'Anahtar kelimeler' } }, required: ['token', 'callerPhone', 'callerName', 'transcript', 'duration', 'category'] } }, { name: 'update_call_transcript', description: 'Mevcut transkripti günceller', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, id: { type: 'number', description: 'Transkript ID\'si' }, resolution: { type: 'string', description: 'Çözüm durumu' }, followUpRequired: { type: 'boolean', description: 'Takip gerekli mi?' }, assignedTo: { type: 'number', description: 'Atanan kullanıcı ID\'si' } }, required: ['token', 'id'] } }, { name: 'get_call_analytics', description: 'Çağrı analitikleri ve istatistikleri getirir', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, date: { type: 'string', description: 'Analiz tarihi (YYYY-MM-DD)' }, period: { type: 'string', description: 'Analiz periyodu (daily, weekly, monthly)', enum: ['daily', 'weekly', 'monthly'] } }, required: ['token'] } }, // Kullanıcı yönetimi araçları { name: 'list_users', description: 'Tüm kullanıcıları listeler (Yetki gerekli)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token (yetki kontrolü için)' } }, required: ['token'] } }, { name: 'get_user_by_id', description: 'ID\'ye göre kullanıcı bilgilerini getirir (Yetki gerekli)', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Kullanıcı ID\'si' }, token: { type: 'string', description: 'JWT token (yetki kontrolü için)' } }, required: ['id', 'token'] } }, { name: 'search_users', description: 'Kullanıcıları ad, email, departman veya pozisyona göre arar', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Arama terimi' } }, required: ['query'] } }, { name: 'add_user', description: 'Yeni kullanıcı ekler', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Kullanıcı adı' }, email: { type: 'string', description: 'E-posta adresi' }, department: { type: 'string', description: 'Departman' }, position: { type: 'string', description: 'Pozisyon' }, joinDate: { type: 'string', description: 'İşe giriş tarihi (YYYY-MM-DD formatında)' }, salary: { type: 'number', description: 'Maaş (opsiyonel)' }, birthDate: { type: 'string', description: 'Doğum tarihi (YYYY-MM-DD formatında, opsiyonel)' }, phone: { type: 'string', description: 'Telefon numarası (opsiyonel)' }, address: { type: 'string', description: 'Adres (opsiyonel)' }, skills: { type: 'array', items: { type: 'string' }, description: 'Yetenekler listesi (opsiyonel)' } }, required: ['name', 'email', 'department', 'position', 'joinDate'] } }, { name: 'update_user', description: 'Mevcut kullanıcı bilgilerini günceller', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Güncellenecek kullanıcının ID\'si' }, name: { type: 'string', description: 'Yeni kullanıcı adı' }, email: { type: 'string', description: 'Yeni e-posta adresi' }, department: { type: 'string', description: 'Yeni departman' }, position: { type: 'string', description: 'Yeni pozisyon' } }, required: ['id'] } }, { name: 'delete_user', description: 'Kullanıcıyı siler', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Silinecek kullanıcının ID\'si' } }, required: ['id'] } }, // Audit Log yönetimi araçları { name: 'get_my_audit_logs', description: 'Kullanıcının kendi audit loglarını getirir', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 50)' } }, required: ['token'] } }, { name: 'get_all_audit_logs', description: 'Tüm audit logları getirir (Sadece admin)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 200)' } }, required: ['token'] } }, { name: 'get_audit_logs_by_category', description: 'Belirli kategorideki audit logları getirir (Admin/Manager)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, category: { type: 'string', description: 'Log kategorisi (authentication, user_management, data_access, permission, system, security)' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 100)' } }, required: ['token', 'category'] } }, { name: 'get_audit_logs_by_date', description: 'Belirli tarih aralığındaki audit logları getirir (Admin/Manager)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, startDate: { type: 'string', description: 'Başlangıç tarihi (YYYY-MM-DD)' }, endDate: { type: 'string', description: 'Bitiş tarihi (YYYY-MM-DD)' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 100)' } }, required: ['token', 'startDate', 'endDate'] } }, ] }; });