Skip to main content
Glama

add_user

Add new user records to the JSON database by providing required details like name, email, department, position, and join date. Supports optional fields for salary, skills, and contact information.

Instructions

Yeni kullanıcı ekler

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesKullanıcı adı
emailYesE-posta adresi
departmentYesDepartman
positionYesPozisyon
joinDateYesİşe giriş tarihi (YYYY-MM-DD formatında)
salaryNoMaaş (opsiyonel)
birthDateNoDoğum tarihi (YYYY-MM-DD formatında, opsiyonel)
phoneNoTelefon numarası (opsiyonel)
addressNoAdres (opsiyonel)
skillsNoYetenekler listesi (opsiyonel)

Implementation Reference

  • The core handler logic for the 'add_user' tool. It generates a new unique ID for the user using generateId, spreads the input arguments into the new user object, appends it to the database's users array, persists the database changes with writeDatabase, and returns a 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 }) }] }; }
  • The input schema definition for the 'add_user' tool, specifying properties, types, descriptions, and required fields for validation.
    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:255-274 (registration)
    The tool registration object in the ListTools response, including name, description, and inputSchema.
    { 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'] } },
  • Utility function generateId used in the add_user handler to compute the next available user ID by finding the maximum existing ID and incrementing it.
    export function generateId(items) { if (!items || items.length === 0) return 1; return Math.max(...items.map(item => item.id)) + 1; }

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/yusuferenkt/mcp-database'

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