Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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 }; } }
  • The input schema for the 'get_log_files' tool, which requires no parameters (empty object).
    inputSchema: { type: 'object', properties: {}, required: [] }
  • 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: [] } },
  • Tool dispatch in handleToolCall switch statement that maps 'get_log_files' calls to the handler.
    case 'get_log_files': result = this.getLogFiles(); break;

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/mariosss/local-logs-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server