Skip to main content
Glama

get_conversation_snapshot

Capture current conversation context for resuming discussions or analyzing architectural decisions. Specify recent turn count to control snapshot scope.

Instructions

Phase 3: Get current conversation context snapshot for resumption or analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recentTurnCountNoNumber of recent turns to include

Implementation Reference

  • The primary handler implementation for the 'get_conversation_snapshot' tool. This async function receives arguments (recentTurnCount optional), retrieves a context snapshot from the ConversationMemoryManager, and formats a comprehensive markdown report including session ID, recent turns, active intents, recorded decisions, and conversation focus.
    export async function getConversationSnapshot(
      args: {
        recentTurnCount?: number;
      },
      memoryManager: ConversationMemoryManager
    ): Promise<CallToolResult> {
      try {
        const snapshot = await memoryManager.getContextSnapshot(args.recentTurnCount ?? 5);
    
        if (!snapshot) {
          return {
            content: [
              {
                type: 'text',
                text: 'No active conversation session found.',
              },
            ],
          };
        }
    
        let output = `# Conversation Context Snapshot\n\n`;
        output += `**Session ID**: ${snapshot.sessionId}\n\n`;
    
        // Recent turns
        output += `## Recent Turns (${snapshot.recentTurns.length})\n\n`;
        snapshot.recentTurns.forEach(turn => {
          output += `### Turn ${turn.turnNumber} - ${turn.timestamp}\n`;
          output += `- **Request**: ${turn.request.toolName || 'message'}\n`;
          output += `- **Tokens**: ${turn.response.tokenCount}\n`;
          if (turn.response.expandableId) {
            output += `- **Expandable ID**: ${turn.response.expandableId}\n`;
          }
          output += `\n`;
        });
    
        // Active intents
        if (snapshot.activeIntents.length > 0) {
          output += `## Active Knowledge Graph Intents\n\n`;
          snapshot.activeIntents.forEach(intent => {
            output += `- **${intent.intent}**: ${intent.status}\n`;
          });
          output += `\n`;
        }
    
        // Decisions recorded
        if (snapshot.decisionsRecorded.length > 0) {
          output += `## Decisions Recorded\n\n`;
          snapshot.decisionsRecorded.forEach(decision => {
            output += `- **${decision.title}** (${decision.adrId}) - ${decision.timestamp}\n`;
          });
          output += `\n`;
        }
    
        // Conversation focus
        if (snapshot.conversationFocus) {
          output += `## Conversation Focus\n\n`;
          output += `- **Topic**: ${snapshot.conversationFocus.topic}\n`;
          output += `- **Phase**: ${snapshot.conversationFocus.phase}\n`;
          output += `- **Next Steps**:\n`;
          snapshot.conversationFocus.nextSteps.forEach(step => {
            output += `  - ${step}\n`;
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: output,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Failed to get conversation snapshot: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Central tool catalog metadata and input schema definition for 'get_conversation_snapshot'. Defines description, category ('memory'), complexity ('simple'), estimated token costs, related tools, and a basic input schema (note: catalog schema uses 'includeMetadata' while handler uses 'recentTurnCount'). Used for dynamic tool discovery and MCP ListTools responses.
    TOOL_CATALOG.set('get_conversation_snapshot', {
      name: 'get_conversation_snapshot',
      shortDescription: 'Get conversation snapshot',
      fullDescription: 'Gets a snapshot of the current conversation state.',
      category: 'memory',
      complexity: 'simple',
      tokenCost: { min: 300, max: 800 },
      hasCEMCPDirective: true, // Phase 4.3: Simple tool - state snapshot
      relatedTools: ['query_conversation_history', 'get_memory_stats'],
      keywords: ['conversation', 'snapshot', 'state'],
      requiresAI: false,
      inputSchema: {
        type: 'object',
        properties: {
          includeMetadata: { type: 'boolean', default: false },
        },
      },
    });
  • Tool listing entry in server context generator's hardcoded tool list under 'Memory & Context' category, used to generate human-readable documentation of available tools.
      name: 'get_conversation_snapshot',
      description: 'Get current conversation context snapshot',
    },

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/tosin2013/mcp-adr-analysis-server'

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