Skip to main content
Glama

get_user_by_id

Retrieve user information by ID using a JWT token for authentication on the MCP JSON Database Server. Designed for secure user data access and management.

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

  • Main execution logic for get_user_by_id tool: permission check, database lookup, user data retrieval (without password), access control for self/other users.
    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 handler, defining name, description, and input schema (id: number required, token: string required).
    { 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'] } },
  • Input schema definition for get_user_by_id tool.
    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