Skip to main content
Glama
jakedx6
by jakedx6

analyze_conversation

Extract insights, themes, and patterns from AI conversations to identify key information and trends.

Instructions

Analyze an AI conversation to extract insights, themes, and patterns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conversation_idYesThe conversation ID to analyze

Implementation Reference

  • Primary handler function that executes the analyze_conversation tool logic: validates input, fetches conversation data, runs multiple analysis helpers, and returns comprehensive insights.
    export const analyzeConversation = requireAuth(async (args: any) => { const { conversation_id } = AnalyzeConversationSchema.parse(args) logger.info('Analyzing conversation', { conversation_id }) const conversation = await getConversationFromDatabase(conversation_id) if (!conversation) { throw new Error('Conversation not found') } const analysis = { conversation_flow: analyzeConversationFlow(conversation.messages), content_analysis: analyzeConversationContent(conversation.messages), ai_performance: analyzeAIPerformance(conversation.messages), topic_modeling: extractTopicsAndThemes(conversation.messages), action_items: extractActionItemsFromConversation(conversation.messages, conversation.metadata?.context), decisions_made: extractDecisions(conversation.messages), questions_raised: extractQuestions(conversation.messages), knowledge_gaps: identifyKnowledgeGaps(conversation.messages), follow_up_suggestions: generateFollowUpSuggestions(conversation.messages, conversation.metadata?.context) } return { conversation_id, analysis, summary: generateAnalysisSummary(analysis), recommendations: generateRecommendations(analysis, conversation.metadata?.context) } })
  • Zod input validation schema for the analyze_conversation tool, requiring a single conversation_id parameter (UUID).
    const AnalyzeConversationSchema = z.object({ conversation_id: z.string().uuid() })
  • MCPTool object registration defining the tool's metadata, name, description, and input schema for protocol discovery.
    export const analyzeConversationTool: MCPTool = { name: 'analyze_conversation', description: 'Analyze an AI conversation to extract insights, themes, and patterns', inputSchema: { type: 'object', properties: { conversation_id: { type: 'string', format: 'uuid', description: 'The conversation ID to analyze' } }, required: ['conversation_id'] } }
  • Export of handler map including analyze_conversation, imported into main server and spread into allHandlers for dynamic tool dispatching.
    export const conversationHandlers = { save_conversation: saveConversation, get_conversations: getConversations, analyze_conversation: analyzeConversation, extract_action_items: extractActionItems, generate_conversation_summary: generateConversationSummary
  • Key helper function called by the handler to analyze conversation content statistics (messages, words, questions, code, links, balance).
    function analyzeConversationContent(messages: Message[]): any { const totalMessages = messages.length const userMessages = messages.filter(m => m.role === 'user').length const assistantMessages = messages.filter(m => m.role === 'assistant').length const totalWords = messages.reduce((sum, msg) => sum + msg.content.split(' ').length, 0) const avgWordsPerMessage = totalWords / totalMessages // Extract common patterns const questions = messages.filter(msg => msg.content.includes('?')).length const codeBlocks = messages.filter(msg => msg.content.includes('```')).length const urls = messages.filter(msg => /https?:\/\//.test(msg.content)).length return { message_count: totalMessages, user_messages: userMessages, assistant_messages: assistantMessages, total_words: totalWords, avg_words_per_message: Math.round(avgWordsPerMessage), questions_asked: questions, code_examples: codeBlocks, external_links: urls, conversation_balance: userMessages / (assistantMessages || 1) } }

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/jakedx6/helios9-MCP-Server'

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