Skip to main content
Glama

get_my_permissions

Lists user permissions from the MCP JSON Database Server to verify access rights for database operations using JWT authentication.

Instructions

Kullanıcının sahip olduğu yetkileri listeler

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesJWT token

Implementation Reference

  • Handler function that extracts user information from the provided JWT token and retrieves the user's permissions based on their role using getUserPermissions.
    case 'get_my_permissions': { const { token } = args; try { const user = extractUserFromToken(token); if (!user) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'Geçersiz token' }) }] }; } const permissions = getUserPermissions(user.role); return { content: [{ type: 'text', text: JSON.stringify({ success: true, user: { id: user.userId, email: user.email, role: user.role }, permissions: permissions, totalPermissions: permissions.length, roleDescription: { [ROLES.ADMIN]: 'Sistem yöneticisi - Tüm yetkilere sahip', [ROLES.MANAGER]: 'Yönetici - Çoğu yönetim yetkilerine sahip', [ROLES.EMPLOYEE]: 'Çalışan - Temel yetkilere sahip' }[user.role] }, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message }) }] }; } }
  • src/index.js:120-130 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    { name: 'get_my_permissions', description: 'Kullanıcının sahip olduğu yetkileri listeler', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' } }, required: ['token'] } },
  • Helper function that returns the list of permissions associated with a given user role, based on the ROLE_PERMISSIONS matrix.
    export function getUserPermissions(userRole) { if (!userRole) return []; return ROLE_PERMISSIONS[userRole] || []; }
  • Helper function that decodes the JWT token and extracts user ID, email, and role.
    export function extractUserFromToken(token) { try { const decoded = verifyToken(token); return { userId: decoded.userId, email: decoded.email, role: decoded.role }; } catch (error) { return null; } }

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