list_memories
Retrieve and display saved memories from the Hi-AI assistant, with options to filter by category or limit results.
Instructions
list|saved items|show saved|what memories - List saved memories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter by category | |
| limit | No | Maximum number of results |
Implementation Reference
- src/tools/memory/listMemories.ts:23-46 (handler)The handler function listMemories that retrieves memories from MemoryManager, applies filters for category and limit, formats a list, and returns a formatted ToolResult or error.export async function listMemories(args: { category?: string; limit?: number }): Promise<ToolResult> { const { category: listCategory, limit = 10 } = args; try { const mm = MemoryManager.getInstance(); const allMemories = mm.list(listCategory); const limitedMemories = allMemories.slice(0, limit); const memoryList = limitedMemories.map(m => `• ${m.key} (${m.category}): ${m.value.substring(0, 50)}${m.value.length > 50 ? '...' : ''}` ).join('\n'); return { content: [{ type: 'text', text: `✓ Found ${allMemories.length} memories${listCategory ? ` in '${listCategory}'` : ''}:\n${memoryList || 'None'}` }] }; } catch (error) { return { content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } }
- The ToolDefinition schema defining the list_memories tool, including name, description, inputSchema for optional category and limit parameters, and annotations.export const listMemoriesDefinition: ToolDefinition = { name: 'list_memories', description: 'list|saved items|show saved|what memories - List saved memories', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Filter by category' }, limit: { type: 'number', description: 'Maximum number of results' } }, required: [] }, annotations: { title: 'List Memories', audience: ['user', 'assistant'] } };
- src/index.ts:640-641 (registration)Registration in the tool dispatcher switch statement within executeToolCall function, mapping 'list_memories' calls to the listMemories handler.case 'list_memories': return await listMemories(args as any) as CallToolResult;
- src/index.ts:127-127 (registration)Inclusion of listMemoriesDefinition in the central tools array used for ListTools requests.listMemoriesDefinition,