Skip to main content
Glama
jakedx6

Helios-9 MCP Server

by jakedx6

save_conversation

Archive AI conversations with project context, including tasks, documents, and metadata, for future reference and analysis.

Instructions

Save an AI conversation with project context for future reference and analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project ID this conversation relates to
titleNoOptional title for the conversation (auto-generated if not provided)
messagesYesArray of conversation messages
contextNoContext information about the conversation
metadataNoAdditional metadata for the conversation

Implementation Reference

  • Main handler function for save_conversation tool. Parses args via SaveConversationSchema, processes messages, generates title, analyzes content, saves to database, extracts action items, and returns the saved conversation with analysis and insights.
    export const saveConversation = requireAuth(async (args: any) => {
      const { project_id, title, messages, context, metadata } = SaveConversationSchema.parse(args)
      
      logger.info('Saving AI conversation', { 
        project_id, 
        message_count: messages.length,
        conversation_type: context?.conversation_type 
      })
    
      // Process messages and add timestamps if missing
      const processedMessages = messages.map(msg => ({
        ...msg,
        timestamp: msg.timestamp || new Date().toISOString(),
        metadata: msg.metadata || {}
      }))
    
      // Generate title if not provided
      const conversationTitle = title || generateConversationTitle(processedMessages, context?.conversation_type)
    
      // Analyze conversation for insights
      const analysis = analyzeConversationContent(processedMessages)
    
      // Create conversation record
      const conversationData = {
        project_id,
        title: conversationTitle,
        messages: processedMessages,
        metadata: {
          ...metadata,
          context: context || {},
          analysis,
          created_via: 'mcp',
          message_count: processedMessages.length,
          total_tokens: context?.tokens_used || estimateTokenCount(processedMessages)
        }
      }
    
      // Save to database (extend the supabase service to handle conversations)
      const conversation = await saveConversationToDatabase(conversationData)
    
      // Extract and optionally create action items
      const actionItems = extractActionItemsFromConversation(processedMessages, context)
    
      logger.info('Conversation saved successfully', { 
        conversation_id: conversation.id,
        action_items_found: actionItems.length 
      })
    
      return {
        conversation,
        analysis,
        action_items: actionItems,
        insights: generateConversationInsights(analysis, context),
        message: `Conversation "${conversationTitle}" saved successfully`
      }
    })
  • Zod validation schema for save_conversation. Defines required project_id (UUID), optional title, required messages array (role, content), optional context (task_id, document_id, conversation_type, ai_model, temperature, tokens_used), and optional metadata.
    const SaveConversationSchema = z.object({
      project_id: z.string().uuid(),
      title: z.string().min(1).max(500).optional(),
      messages: z.array(z.object({
        role: z.enum(['user', 'assistant', 'system']),
        content: z.string(),
        timestamp: z.string().datetime().optional(),
        metadata: z.record(z.any()).optional()
      })),
      context: z.object({
        task_id: z.string().uuid().optional(),
        document_id: z.string().uuid().optional(),
        conversation_type: z.enum(['task_discussion', 'document_review', 'project_planning', 'troubleshooting', 'general']).default('general'),
        ai_model: z.string().optional(),
        temperature: z.number().min(0).max(2).optional(),
        tokens_used: z.number().positive().optional()
      }).optional(),
      metadata: z.record(z.any()).optional()
    })
  • Tool registration object for save_conversation. Defines the tool name, description, and JSON Schema input schema. Exported and later combined into conversationTools and registered in src/index.ts.
    export const saveConversationTool: MCPTool = {
      name: 'save_conversation',
      description: 'Save an AI conversation with project context for future reference and analysis',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            format: 'uuid',
            description: 'The project ID this conversation relates to'
          },
          title: {
            type: 'string',
            maxLength: 500,
            description: 'Optional title for the conversation (auto-generated if not provided)'
          },
          messages: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                role: {
                  type: 'string',
                  enum: ['user', 'assistant', 'system'],
                  description: 'The role of the message sender'
                },
                content: {
                  type: 'string',
                  description: 'The message content'
                },
                timestamp: {
                  type: 'string',
                  format: 'date-time',
                  description: 'When the message was sent (auto-generated if not provided)'
                },
                metadata: {
                  type: 'object',
                  description: 'Additional metadata for the message'
                }
              },
              required: ['role', 'content']
            },
            description: 'Array of conversation messages'
          },
          context: {
            type: 'object',
            properties: {
              task_id: {
                type: 'string',
                format: 'uuid',
                description: 'Related task ID if conversation is about a specific task'
              },
              document_id: {
                type: 'string',
                format: 'uuid',
                description: 'Related document ID if conversation is about a specific document'
              },
              conversation_type: {
                type: 'string',
                enum: ['task_discussion', 'document_review', 'project_planning', 'troubleshooting', 'general'],
                description: 'Type of conversation for better categorization'
              },
              ai_model: {
                type: 'string',
                description: 'AI model used in the conversation'
              },
              temperature: {
                type: 'number',
                minimum: 0,
                maximum: 2,
                description: 'AI temperature setting used'
              },
              tokens_used: {
                type: 'number',
                description: 'Total tokens consumed in the conversation'
              }
            },
            description: 'Context information about the conversation'
          },
          metadata: {
            type: 'object',
            description: 'Additional metadata for the conversation'
          }
        },
        required: ['project_id', 'messages']
      }
    }
  • Exports mapping of the handler function to the tool name 'save_conversation', which is imported and spread into allHandlers in src/index.ts for dispatching tool calls.
    export const conversationHandlers = {
      save_conversation: saveConversation,
      get_conversations: getConversations,
      analyze_conversation: analyzeConversation,
      extract_action_items: extractActionItems,
      generate_conversation_summary: generateConversationSummary
    }
  • Helper function called by the saveConversation handler to persist conversation data. Currently a placeholder that returns mock data with generated UUID and timestamps, intended to be replaced with actual Supabase database logic.
    async function saveConversationToDatabase(conversationData: any): Promise<any> {
      // This would be implemented in the supabase service
      return {
        id: 'generated-uuid',
        ...conversationData,
        created_at: new Date().toISOString(),
        updated_at: new Date().toISOString()
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It does not mention side effects (e.g., creates a new record), idempotency, permissions, or any constraints beyond saving. Minimal behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no wasted words. Efficiently conveys the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a moderately complex nested schema with 5 parameters and no output schema. The description does not mention what is returned (e.g., saved conversation ID) or any behavioral details, leaving gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with all parameters described. The description adds no additional meaning beyond what the schema already provides, so it meets the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool saves an AI conversation with project context, specific verb and resource. It distinguishes from siblings like analyze_conversation and get_conversations, which handle analysis and retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for future reference and analysis but provides no explicit guidance on when to use this tool versus alternatives like analyze_conversation or extract_action_items. No when-not or exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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