Skip to main content
Glama

get_recent_errors

Retrieve recent error entries from monitored log files for debugging and analysis, with optional file path filtering and result limit control.

Instructions

Get recent error analysis from monitored files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathNoOptional: specific file path to get errors from
limitNoMaximum number of recent errors to return

Implementation Reference

  • Tool schema definition in ListToolsRequestHandler, including name, description, and input schema for filePath (optional) and limit (default 10)
    { name: 'get_recent_errors', description: 'Get recent error analysis from monitored files', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Optional: specific file path to get errors from' }, limit: { type: 'number', default: 10, description: 'Maximum number of recent errors to return' } } } }
  • src/server.ts:192-194 (registration)
    Tool registration/dispatch in the CallToolRequestHandler switch statement
    case 'get_recent_errors': result = await this.handleGetRecentErrors(args); break;
  • MCP server handler for get_recent_errors tool that extracts parameters and delegates to FileWatcher.getRecentErrors
    private async handleGetRecentErrors(args: any): Promise<MCPToolResult> { const { filePath, limit = 10 } = args; const recentErrors = await this.fileWatcher.getRecentErrors(filePath, limit); return { success: true, data: recentErrors }; }
  • Core helper function in FileWatcher class that implements the logic to retrieve recent errors from specific or all watched log files, sorting by timestamp
    async getRecentErrors(filePath?: string, limit: number = 10): Promise<LogAnalysis[]> { if (filePath) { const watchedFile = this.watchers.get(filePath); if (!watchedFile) { throw new Error(`File ${filePath} is not being watched`); } return watchedFile.errors.slice(-limit); } // Get recent errors from all watched files const allErrors: LogAnalysis[] = []; for (const watchedFile of this.watchers.values()) { allErrors.push(...watchedFile.errors); } // Sort by timestamp and return most recent return allErrors .sort((a, b) => b.metadata.timestamp.getTime() - a.metadata.timestamp.getTime()) .slice(0, limit); }

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/ChiragPatankar/loganalyzer-mcp'

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