Skip to main content
Glama
rodhayl
by rodhayl

mcp_summarize_logs

Summarize log output to identify root causes by condensing content and highlighting errors or warnings for faster troubleshooting.

Instructions

Condense logs and highlight likely root causes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
logsYesLog output to summarize
focusNoFocus area (default: all)
maxLinesNoMaximum lines to process (default: 500)

Implementation Reference

  • The implementation of the `summarizeLogs` tool, which uses an LLM to analyze and summarize log content, highlighting errors and key events.
      async summarizeLogs(
        logs: string,
        options?: {
          focusOnErrors?: boolean;
          maxEvents?: number;
        }
      ): Promise<SummarizeLogsResult> {
        const focusOnErrors = options?.focusOnErrors ?? true;
        const maxEvents = options?.maxEvents ?? 20;
    
        const prompt = `You are an expert at log analysis. Analyze these logs and provide a summary.
    
    ${focusOnErrors ? 'Focus especially on errors and warnings.' : ''}
    Limit to ${maxEvents} most important events.
    
    Provide your response as JSON:
    {
      "summary": "High-level summary of the logs",
      "keyEvents": [
        {
          "type": "error|warning|info|event",
          "message": "Event description",
          "timestamp": "if available",
          "count": 1
        }
      ],
      "issues": [
        {
          "severity": "critical|high|medium|low",
          "description": "Issue description",
          "recommendation": "How to fix"
        }
      ],
      "statistics": {
        "totalLines": 0,
        "errorCount": 0,
        "warningCount": 0,
        "timeRange": "if determinable"
      }
    }`;
    
        try {
          const responseText = await this.llmWrapper.callToolLlm(
            'mcp_summarize_logs',
            [
              { role: 'system', content: prompt },
              { role: 'user', content: logs.substring(0, 30000) }, // Limit log size
            ],
            { type: 'summarize_logs', focusOnErrors, maxEvents }
          );
    
          const parsed = this.parseJsonResponse(responseText, {
            summary: responseText,
            keyEvents: [],
            issues: [],
          });
    
          return {
            success: true,
            summary: parsed.summary || '',
            keyEvents: (parsed.keyEvents || []).slice(0, maxEvents),
            issues: parsed.issues || [],
            statistics: parsed.statistics,
          };
        } catch (error) {
          return {
            success: false,
            summary: '',
            keyEvents: [],
            issues: [],
            error: error instanceof Error ? error.message : 'Unknown error',
          };
        }
      }
  • The type definition for the results returned by the `summarizeLogs` tool.
    export interface SummarizeLogsResult {
      success: boolean;
      summary: string;
      keyEvents: Array<{
        type: 'error' | 'warning' | 'info' | 'event';
        message: string;
        timestamp?: string;
        count?: number;
      }>;
      issues: Array<{
        severity: 'critical' | 'high' | 'medium' | 'low';
        description: string;
        recommendation?: string;
      }>;
      statistics?: {
        totalLines: number;
        errorCount: number;
        warningCount: number;
  • Registration of the `mcp_summarize_logs` tool in the discovery layer.
      'mcp_translate_code',
      'mcp_summarize_logs',
    ],

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/rodhayl/mcpLocalHelper'

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