get_all_audit_logs
Retrieve all audit logs from the JSON database server for administrative review and monitoring of system activities.
Instructions
Tüm audit logları getirir (Sadece admin)
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": "get_all_audit_logs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | JWT token | |
| limit | No | Gösterilecek log sayısı (varsayılan: 200) |
Implementation Reference
- src/index.js:812-847 (handler)MCP tool handler for 'get_all_audit_logs': checks admin permissions via token, calls the getAllAuditLogs helper, audits the access, returns logs or permission error.
case 'get_all_audit_logs': { const { token, limit = 200 } = args; try { const user = checkPermissionWithToken(token, PERMISSIONS.AUDIT_READ_ALL); const logs = await getAllAuditLogs(limit); // Tüm audit log erişimini logla (kritik) await auditLogger.sensitiveDataAccessed(user.userId, user.role, 'all_audit_logs', { limit }); return { content: [{ type: 'text', text: JSON.stringify({ success: true, data: logs, total: logs.length, requestedBy: { id: user.userId, role: user.role }, warning: 'Bu tüm sistem audit loglarını içerir - Gizli bilgiler içerebilir' }, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: error.message, requiredPermission: PERMISSIONS.AUDIT_READ_ALL, note: 'Tüm audit loglar sadece admin tarafından görüntülenebilir' }) }] }; } } - src/index.js:320-327 (schema)Input schema for get_all_audit_logs tool: requires JWT token, optional limit (default 200).
inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 200)' } }, required: ['token'] } - src/index.js:318-328 (registration)Registration of get_all_audit_logs tool in the MCP ListTools response, defining name, description, and input schema.
name: 'get_all_audit_logs', description: 'Tüm audit logları getirir (Sadece admin)', inputSchema: { type: 'object', properties: { token: { type: 'string', description: 'JWT token' }, limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 200)' } }, required: ['token'] } }, - src/audit.js:175-185 (helper)Helper function that reads the audit logs JSON file and returns the most recent 'limit' number of logs in chronological order (oldest first).
export async function getAllAuditLogs(limit = 200) { try { const auditData = await readAuditLogs(); return auditData.logs .slice(-limit) .reverse(); } catch (error) { console.error('Tüm audit log hatası:', error); return []; } }