get_log_files
Retrieve available local application log files with metadata to monitor, analyze, and debug system or application issues.
Instructions
Get list of available log files with metadata
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- local-logs-mcp-server.js:252-285 (handler)The main handler function that implements the 'get_log_files' tool logic. It lists log files in the configured directory, filters by extensions, adds metadata like size and modification time, sorts by recency, and returns a structured response.
getLogFiles() { try { if (!fs.existsSync(this.logsDir)) { return { files: [], message: 'Logs directory not found. Server might be in development mode (console only).', logsDir: this.logsDir }; } const files = fs.readdirSync(this.logsDir) .filter(file => this.logExtensions.some(ext => file.endsWith(ext))) .map(file => { const filePath = path.join(this.logsDir, file); const stats = fs.statSync(filePath); return { name: file, size: stats.size, sizeHuman: this.formatBytes(stats.size), modified: stats.mtime.toISOString(), path: filePath }; }) .sort((a, b) => new Date(b.modified) - new Date(a.modified)); return { files, message: `Found ${files.length} log files`, logsDir: this.logsDir }; } catch (error) { return { files: [], error: error.message }; } } - local-logs-mcp-server.js:99-103 (schema)The input schema for the 'get_log_files' tool, which requires no parameters (empty object).
inputSchema: { type: 'object', properties: {}, required: [] } - local-logs-mcp-server.js:96-104 (registration)Registration of the 'get_log_files' tool in the tools/list response, including name, description, and schema.
{ name: 'get_log_files', description: 'Get list of available log files with metadata', inputSchema: { type: 'object', properties: {}, required: [] } }, - local-logs-mcp-server.js:211-213 (registration)Tool dispatch in handleToolCall switch statement that maps 'get_log_files' calls to the handler.
case 'get_log_files': result = this.getLogFiles(); break;