Skip to main content
Glama

get_frequent_conversation

Retrieve the conversation ID that appears most often in stored memories to identify frequently referenced discussions.

Instructions

Get the most frequently mentioned conversation ID in memories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool definition including name, description, empty input schema, and handler function that retrieves the most frequent conversation ID from the memory manager and returns formatted result.
    { name: 'get_frequent_conversation', description: 'Get the most frequently mentioned conversation ID in memories.', inputSchema: z.object({}), handler: async (args) => { try { const mostFrequent = memoryManager.getMostFrequentConversation(); return { conversation_id: mostFrequent, message: mostFrequent ? `Most frequent conversation: ${mostFrequent}` : 'No memories found' }; } catch (error) { return { error: error.message }; } } }
  • Core logic function in ShortTermMemoryManager that computes the most frequent conversation_id by counting occurrences in all memories.
    getMostFrequentConversation() { if (this.memories.length === 0) return null; const counts = {}; for (const mem of this.memories) { counts[mem.conversation_id] = (counts[mem.conversation_id] || 0) + 1; } let maxCount = 0; let mostFrequent = null; for (const [id, count] of Object.entries(counts)) { if (count > maxCount) { maxCount = count; mostFrequent = id; } } return mostFrequent; }
  • src/index.js:152-154 (registration)
    Initial registration of short-term tools (including get_frequent_conversation) to the tool registry for default conversation.
    // 注册所有短期记忆工具 const shortTermTools = createShortTermTools(defaultShortTermManager, defaultStorageManager); shortTermTools.forEach(tool => registerTool(tool, 'short-term'));
  • src/index.js:285-289 (registration)
    Dynamic recreation and invocation of short-term tools during tool call handling, finding and executing the specific tool handler.
    manager = await getShortTermManager(conversationId); storage = getStorageManager(conversationId); const tools = createShortTermTools(manager, storage, queryCache); const tool = tools.find(t => t.name === toolName); result = await withTimeout(tool.handler(validatedArgs), timeout, `Tool ${toolName} timeout`);

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/win10ogod/memory-mcp-server'

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