Skip to main content
Glama

change_password

Update user password securely in the MCP JSON Database Server by providing current and new credentials with JWT authentication.

Instructions

Kullanıcı şifresini değiştirir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesJWT token
oldPasswordYesMevcut şifre
newPasswordYesYeni şifre

Implementation Reference

  • The handler function for the 'change_password' tool. Verifies the user's token, checks the old password, hashes the new password using hashPassword, updates the user record in the database, and returns a JSON response indicating success or failure.
    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:108-119 (registration)
    Registration of the 'change_password' tool in the MCP tools array, including name, description, and input schema definition.
    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 required fields: 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