update_user
Modify user details in the MCP JSON Database Server by updating fields like name, email, department, and position using the user's unique ID.
Instructions
Mevcut kullanıcı bilgilerini günceller
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| department | No | Yeni departman | |
| No | Yeni e-posta adresi | ||
| id | Yes | Güncellenecek kullanıcının ID'si | |
| name | No | Yeni kullanıcı adı | |
| position | No | Yeni pozisyon |
Implementation Reference
- src/index.js:724-747 (handler)Handler function for 'update_user' tool. Finds the user by ID in the database, applies the provided updates, persists changes to the database, and returns the updated user information (excluding password).case 'update_user': { const { id, ...updates } = args; const userIndex = db.users.findIndex(u => u.id === id); if (userIndex === -1) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Kullanıcı bulunamadı' }) }] }; } db.users[userIndex] = { ...db.users[userIndex], ...updates }; await writeDatabase(db); const { password, ...userWithoutPassword } = db.users[userIndex]; return { content: [{ type: 'text', text: JSON.stringify({ success: true, user: userWithoutPassword }) }] }; }
- src/index.js:275-289 (registration)Registration of the 'update_user' tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ 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'] } },
- src/index.js:278-288 (schema)Input schema definition for the 'update_user' tool, specifying parameters like id (required), name, email, department, position.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'] }