Skip to main content
Glama
jakedx6
by jakedx6

get_conversations

Retrieve AI conversations for a project with optional filtering by type, related items, or message inclusion.

Instructions

Retrieve AI conversations for a project with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesThe project ID to get conversations for
limitNoMaximum number of conversations to return
conversation_typeNoFilter by conversation type
related_toNoFilter by related task or document ID
include_messagesNoWhether to include full message content

Implementation Reference

  • The main handler function for the 'get_conversations' tool. It parses input arguments using Zod schema, fetches conversations from the database via helper function, computes analytics, and returns the results.
    export const getConversations = requireAuth(async (args: any) => { const { project_id, limit, conversation_type, related_to, include_messages } = GetConversationsSchema.parse(args) logger.info('Getting conversations', { project_id, conversation_type, related_to, limit }) // Get conversations from database const conversations = await getConversationsFromDatabase({ project_id, limit, conversation_type, related_to, include_messages }) // Add analytics const analytics = { total_conversations: conversations.length, conversation_types: conversations.reduce((acc, conv) => { const type = conv.metadata?.context?.conversation_type || 'general' acc[type] = (acc[type] || 0) + 1 return acc }, {} as Record<string, number>), total_messages: conversations.reduce((sum, conv) => sum + (conv.metadata?.message_count || 0), 0), average_length: conversations.length > 0 ? conversations.reduce((sum, conv) => sum + (conv.metadata?.message_count || 0), 0) / conversations.length : 0, recent_activity: conversations.filter(conv => new Date(conv.created_at).getTime() > Date.now() - (7 * 24 * 60 * 60 * 1000) ).length } return { conversations, analytics, filters_applied: { conversation_type, related_to } } })
  • Zod schema used for input validation in the getConversations handler.
    const GetConversationsSchema = z.object({ project_id: z.string().uuid(), limit: z.number().int().positive().max(100).default(20), conversation_type: z.enum(['task_discussion', 'document_review', 'project_planning', 'troubleshooting', 'general']).optional(), related_to: z.string().uuid().optional(), // task_id or document_id include_messages: z.boolean().default(true) })
  • MCPTool definition for 'get_conversations', including name, description, and JSON input schema for the protocol.
    export const getConversationsTool: MCPTool = { name: 'get_conversations', description: 'Retrieve AI conversations for a project with optional filtering', inputSchema: { type: 'object', properties: { project_id: { type: 'string', format: 'uuid', description: 'The project ID to get conversations for' }, limit: { type: 'number', minimum: 1, maximum: 100, default: 20, description: 'Maximum number of conversations to return' }, conversation_type: { type: 'string', enum: ['task_discussion', 'document_review', 'project_planning', 'troubleshooting', 'general'], description: 'Filter by conversation type' }, related_to: { type: 'string', format: 'uuid', description: 'Filter by related task or document ID' }, include_messages: { type: 'boolean', default: true, description: 'Whether to include full message content' } }, required: ['project_id'] } }
  • Object mapping tool names to their handler functions, used for registration in the MCP system.
    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 handler to fetch conversations from the database (currently a placeholder).
    async function getConversationsFromDatabase(filters: any): Promise<any[]> { // This would be implemented in the supabase service return [] }

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