list_users
Retrieve a list of all users with proper JWT authentication in the MCP JSON Database Server to streamline user management and access control.
Instructions
Tüm kullanıcıları listeler (Yetki gerekli)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | JWT token (yetki kontrolü için) |
Implementation Reference
- src/index.js:590-630 (handler)The handler case for 'list_users' tool execution. Performs permission check, filters out passwords from user data, returns formatted JSON response, and logs permission denials.case 'list_users': { const { token } = args; try { // Yetki kontrolü const user = checkPermissionWithToken(token, PERMISSIONS.USER_LIST); const usersWithoutPasswords = db.users.map(user => { const { password, ...userWithoutPassword } = user; return userWithoutPassword; }); return { content: [{ type: 'text', text: JSON.stringify({ success: true, data: usersWithoutPasswords, requestedBy: { id: user.userId, role: user.role } }, null, 2) }] }; } catch (error) { // Yetki reddedilmesini audit log'a kaydet const failedUser = extractUserFromToken(args.token); if (failedUser) { await auditLogger.permissionDenied(failedUser.userId, failedUser.role, 'list_users', PERMISSIONS.USER_LIST); } return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message, requiredPermission: PERMISSIONS.USER_LIST }) }] }; } }
- src/index.js:222-231 (registration)Tool registration in ListTools handler, defining name, description, and input schema for 'list_users'.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'] } },
- src/index.js:224-230 (schema)Input schema definition for the 'list_users' tool, requiring a JWT token for authorization.inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token (yetki kontrolü için)' } }, required: ['token'] }