Skip to main content
Glama
yusuferenkt

MCP JSON Database Server

by yusuferenkt

get_audit_logs_by_date

Retrieve audit logs within a specified date range for administrative monitoring and security analysis in the JSON Database Server.

Instructions

Belirli tarih aralığındaki audit logları getirir (Admin/Manager)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesJWT token
startDateYesBaşlangıç tarihi (YYYY-MM-DD)
endDateYesBitiş tarihi (YYYY-MM-DD)
limitNoGösterilecek log sayısı (varsayılan: 100)

Implementation Reference

  • Handler for 'get_audit_logs_by_date' tool: validates token and permissions, checks date formats, calls getAuditLogsByDateRange helper, logs access, returns filtered logs.
    case 'get_audit_logs_by_date': {
      const { token, startDate, endDate, limit = 100 } = args;
      
      try {
        const user = checkPermissionWithToken(token, PERMISSIONS.AUDIT_READ);
        
        // Tarih format kontrolü
        const start = new Date(startDate);
        const end = new Date(endDate);
        
        if (isNaN(start.getTime()) || isNaN(end.getTime())) {
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({ 
                success: false, 
                message: 'Geçersiz tarih formatı. YYYY-MM-DD formatını kullanın' 
              })
            }]
          };
        }
        
        const logs = await getAuditLogsByDateRange(startDate, endDate, limit);
        
        // Tarih bazlı audit log erişimini logla
        await auditLogger.dataAccessed(user.userId, user.role, 'audit_logs_by_date', { startDate, endDate, limit });
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              data: logs,
              dateRange: { startDate, endDate },
              total: logs.length,
              requestedBy: { id: user.userId, role: user.role }
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({ 
              success: false, 
              message: error.message,
              requiredPermission: PERMISSIONS.AUDIT_READ
            })
          }]
        };
      }
    }
  • Input schema definition and registration for the 'get_audit_logs_by_date' tool in the tools list.
      name: 'get_audit_logs_by_date',
      description: 'Belirli tarih aralığındaki audit logları getirir (Admin/Manager)',
      inputSchema: {
        type: 'object',
        properties: {
          token: { type: 'string', description: 'JWT token' },
          startDate: { type: 'string', description: 'Başlangıç tarihi (YYYY-MM-DD)' },
          endDate: { type: 'string', description: 'Bitiş tarihi (YYYY-MM-DD)' },
          limit: { type: 'number', description: 'Gösterilecek log sayısı (varsayılan: 100)' }
        },
        required: ['token', 'startDate', 'endDate']
      }
    },
  • Helper function that filters and retrieves audit logs by date range from the audit log data file.
    export async function getAuditLogsByDateRange(startDate, endDate, limit = 100) {
      try {
        const auditData = await readAuditLogs();
        const start = new Date(startDate);
        const end = new Date(endDate);
        
        return auditData.logs
          .filter(log => {
            const logDate = new Date(log.timestamp);
            return logDate >= start && logDate <= end;
          })
          .slice(-limit)
          .reverse();
      } catch (error) {
        console.error('Tarih aralığı audit log hatası:', error);
        return [];
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions role requirements (Admin/Manager) which is useful context, but doesn't disclose other traits like whether this is read-only, pagination behavior, rate limits, error conditions, or what the return format looks like. The description doesn't contradict annotations since none exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose upfront. The parenthetical role requirement adds necessary context without verbosity. No wasted words or redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read operation with 4 parameters and no output schema, the description is minimally adequate. It covers the what (get audit logs) and who (Admin/Manager) but lacks information about return format, error handling, or behavioral constraints. With no annotations and no output schema, more completeness would be helpful for agent understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all 4 parameters. The description adds no additional parameter information beyond what's in the schema (it doesn't explain token authentication, date format details, or limit behavior). Baseline 3 is appropriate when schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'getirir' (gets/fetches) audit logs within a specific date range. It specifies the resource (audit logs) and scope (date range), but doesn't explicitly differentiate from sibling tools like 'get_all_audit_logs' or 'get_audit_logs_by_category' beyond the date focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context with '(Admin/Manager)', suggesting it's for users with those roles, but doesn't explicitly state when to use this tool versus alternatives like 'get_all_audit_logs' or 'get_audit_logs_by_category'. No clear exclusions or prerequisites are provided beyond the implied role requirement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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