Skip to main content
Glama

get_user_by_id

Retrieve user information from the JSON database using a specific user ID. Requires JWT authentication token for authorization to access secure user data.

Instructions

ID'ye göre kullanıcı bilgilerini getirir (Yetki gerekli)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesKullanıcı ID'si
tokenYesJWT token (yetki kontrolü için)

Implementation Reference

  • Handler implementation for get_user_by_id tool. Performs permission check, retrieves user from database by ID, excludes password, handles errors.
    case 'get_user_by_id': { const { id, token } = args; try { // Yetki kontrolü const requestUser = checkPermissionWithToken(token, PERMISSIONS.USER_READ); const user = db.users.find(u => u.id === id); if (!user) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'Kullanıcı bulunamadı' }) }] }; } // Kendi bilgilerini görüntüleme veya yetki kontrolü if (requestUser.userId !== id && !hasPermission(requestUser.role, PERMISSIONS.USER_READ)) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'Bu kullanıcının bilgilerini görüntüleme yetkiniz yok' }) }] }; } const { password, ...userWithoutPassword } = user; return { content: [{ type: 'text', text: JSON.stringify({ success: true, data: userWithoutPassword, requestedBy: { id: requestUser.userId, role: requestUser.role } }, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message, requiredPermission: PERMISSIONS.USER_READ }) }] }; } }
  • src/index.js:232-243 (registration)
    Tool registration in ListTools response, including name, description, and input schema definition.
    { name: 'get_user_by_id', description: 'ID\'ye göre kullanıcı bilgilerini getirir (Yetki gerekli)', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Kullanıcı ID\'si' }, token: { type: 'string', description: 'JWT token (yetki kontrolü için)' } }, required: ['id', 'token'] } },

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