Skip to main content
Glama

change_password

Update user password securely in the MCP JSON Database Server. Requires JWT token, old password, and new password for authentication and verification.

Instructions

Kullanıcı şifresini değiştirir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
newPasswordYesYeni şifre
oldPasswordYesMevcut şifre
tokenYesJWT token

Implementation Reference

  • Handler for change_password tool: verifies JWT token, finds user, validates old password using comparePassword, hashes new password with hashPassword, updates user in database, logs the change implicitly via database write.
    case 'change_password': { const { token, oldPassword, newPassword } = args; try { const decoded = verifyToken(token); const user = db.users.find(u => u.id === decoded.userId); if (!user) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'Kullanıcı bulunamadı' }) }] }; } // Eski şifreyi kontrol et const isOldPasswordValid = await comparePassword(oldPassword, user.password); if (!isOldPasswordValid) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'Mevcut şifre yanlış' }) }] }; } // Yeni şifreyi hash'le ve güncelle user.password = await hashPassword(newPassword); await writeDatabase(db); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Şifre başarıyla değiştirildi' }) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message }) }] }; } }
  • src/index.js:107-119 (registration)
    Tool registration in ListToolsRequestSchema handler, defining the name, description, and input schema for change_password tool.
    { 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'] } },
  • Input schema definition for the change_password tool, specifying parameters: token, oldPassword, newPassword.
    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'] }

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