list_users
Retrieve all user records from the JSON database. Requires JWT authentication for authorization to access user management data.
Instructions
Tüm kullanıcıları listeler (Yetki gerekli)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"token": "<token>"
},
"name": "list_users"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | JWT token (yetki kontrolü için) |
Implementation Reference
- src/index.js:590-630 (handler)The main handler for the 'list_users' tool. Verifies permissions with checkPermissionWithToken, retrieves all users from the database excluding passwords, returns JSON response. Logs denied permissions via auditLogger.
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)Registration of the 'list_users' tool in the ListToolsRequestHandler, including name, description, and input schema requiring a JWT token.
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'] } },