Skip to main content
Glama

extract_compact_summary

Generate a concise summary of a conversation session by specifying the session ID and optionally limiting the number of messages included.

Instructions

Get a compact summary of a conversation session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_messagesNoMaximum messages to include in summary (default: 10)
session_idYesSession ID to summarize

Implementation Reference

  • Input schema and description for the 'extract_compact_summary' tool, registered in the ListTools response.
    name: 'extract_compact_summary', description: 'Get intelligent summary of a conversation session with key insights', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'Session ID to summarize', }, max_messages: { type: 'number', description: 'Maximum messages to analyze (default: 10)', default: 10, }, focus: { type: 'string', description: 'Focus area: solutions, tools, files, or all', enum: ['solutions', 'tools', 'files', 'all'], default: 'all', }, }, required: ['session_id'], }, },
  • MCP CallTool handler case for 'extract_compact_summary' that delegates to UniversalHistorySearchEngine and formats the response.
    case 'extract_compact_summary': { const sessionId = args?.session_id as string; const maxMessages = (args?.max_messages as number) || 10; const focus = (args?.focus as string) || 'all'; const universalResult = await this.universalEngine.generateCompactSummary(sessionId, maxMessages, focus); // Create enhanced 3-line header with summary context const sourceInfo = universalResult.enhanced ? '[⌐◉_◉] Searching: Claude Code + Desktop' : '[⌐◉_◉] Searching: Claude Code'; const actionInfo = `Session: "${sessionId}" | Action: Compact summary | Focus: ${focus}`; const summaryContent = (universalResult.results as any).summary; const formattedResult = `${sourceInfo}\n${actionInfo}\n\n${summaryContent}`; return { content: [ { type: 'text', text: formattedResult, }, ], }; }
  • Core implementation of generateCompactSummary in UniversalHistorySearchEngine: fetches session messages via HistorySearchEngine and generates summary.
    async generateCompactSummary(sessionId: string, maxMessages?: number, focus?: string): Promise<UniversalSearchResult> { await this.initialize(); // Get session data from Claude Code const allSessions = await this.claudeCodeEngine.getRecentSessions(20); const sessionData = allSessions.find(s => s.session_id === sessionId || s.session_id.startsWith(sessionId) || sessionId.includes(s.session_id) || s.session_id.includes(sessionId.replace(/^.*\//, '')) ); if (!sessionData) { return { source: 'claude-code', results: { sessionId, summary: `No session found for ID: ${sessionId}`, messageCount: 0, focus: focus || 'all' } as any, enhanced: false }; } const messages = await this.claudeCodeEngine.getSessionMessages(sessionData.project_dir, sessionData.session_id); const sessionMessages = messages.slice(0, maxMessages || 10); const summary = { sessionId, summary: this.generateSessionSummary(sessionMessages, focus || 'all'), messageCount: sessionMessages.length, focus: focus || 'all' }; if (!this.claudeDesktopAvailable) { return { source: 'claude-code', results: summary as any, enhanced: false }; } // For summaries, Desktop could provide additional context in the future return { source: 'claude-code', results: summary as any, enhanced: this.claudeDesktopAvailable }; }
  • Private helper generateSessionSummary that extracts insights from messages (tools, files, errors, solutions) and formats compact summary based on focus parameter.
    private generateSessionSummary(messages: any[], focus: string): string { const insights = { messageCount: messages.length, toolsUsed: new Set<string>(), filesReferenced: new Set<string>(), outcomes: new Set<string>(), errors: new Set<string>(), solutions: new Set<string>() }; messages.forEach((msg) => { msg.context?.toolsUsed?.forEach((tool: string) => { if (tool && tool.length > 1) insights.toolsUsed.add(tool); }); msg.context?.filesReferenced?.forEach((file: string) => { if (file && file.length > 3) insights.filesReferenced.add(file); }); const content = msg.content.toLowerCase(); if (content.includes('error') || content.includes('failed')) { insights.errors.add(msg.content.substring(0, 100)); } if (content.includes('solution') || content.includes('fixed')) { insights.solutions.add(msg.content.substring(0, 100)); } }); let summary = `Smart Summary (${insights.messageCount} msgs)\n\n`; switch (focus) { case 'solutions': if (insights.solutions.size > 0) { summary += `**Solutions:** ${Array.from(insights.solutions).slice(0, 2).join(', ')}\n`; } break; case 'tools': if (insights.toolsUsed.size > 0) { summary += `**Tools:** ${Array.from(insights.toolsUsed).slice(0, 4).join(', ')}\n`; } break; case 'files': if (insights.filesReferenced.size > 0) { summary += `**Files:** ${Array.from(insights.filesReferenced).slice(0, 3).join(', ')}\n`; } break; default: if (insights.toolsUsed.size > 0) { summary += `**Tools:** ${Array.from(insights.toolsUsed).slice(0, 3).join(', ')}\n`; } if (insights.filesReferenced.size > 0) { summary += `**Files:** ${Array.from(insights.filesReferenced).slice(0, 2).join(', ')}\n`; } } return summary; }
  • Robot icon/emoji associated with 'extract_compact_summary' tool used in response formatting.
    summary: '[⌐◉_◉]', // extract_compact_summary };

Other Tools

Related 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/Vvkmnn/claude-historian'

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