Skip to main content
Glama

list_memory_libraries

Retrieve and display all available memory libraries with metadata including library names, node counts, and modification dates for organized information access.

Instructions

List all available memory libraries with metadata.

Shows all existing memory libraries with information about:

  • Library name

  • Number of memory nodes

  • Last modified date

Returns organized, searchable library information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function in CognitiveMemory class that scans the memory_data directory, reads each .json library file to count nodes, gets file stats, and returns sorted list of libraries with name, size (node count), and lastModified date.
    async listLibraries(): Promise<{ libraries: Array<{ name: string; size: number; lastModified: Date }> }> { try { const files = await fs.readdir(this.memoryDataPath); const libraries = []; for (const file of files) { if (file.endsWith('.json') && !file.endsWith('.tmp')) { const filePath = path.join(this.memoryDataPath, file); const stats = await fs.stat(filePath); const libraryName = file.replace('.json', ''); // Get library size (node count) by reading the file try { const data = await fs.readFile(filePath, 'utf-8'); const memoryState = JSON.parse(data); const nodeCount = memoryState.nodes ? memoryState.nodes.length : 0; libraries.push({ name: libraryName, size: nodeCount, lastModified: stats.mtime }); } catch (error) { // Skip corrupted files console.error(`Skipping corrupted library file: ${file}`, error); } } } return { libraries: libraries.sort((a, b) => b.lastModified.getTime() - a.lastModified.getTime()) }; } catch (error) { console.error('Failed to list libraries:', error); return { libraries: [] }; }
  • Wrapper handler in AdvancedReasoningServer that calls memory.listLibraries() and formats the MCP response with current library info and total count.
    public async listLibraries(): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> { try { const result = await this.memory.listLibraries(); return { content: [{ type: "text", text: JSON.stringify({ currentLibrary: this.memory.getCurrentLibraryName(), libraries: result.libraries, totalLibraries: result.libraries.length }, null, 2) }] }; } catch (error) {
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    const LIST_LIBRARIES_TOOL: Tool = { name: "list_memory_libraries", description: `List all available memory libraries with metadata. Shows all existing memory libraries with information about: - Library name - Number of memory nodes - Last modified date Returns organized, searchable library information.`, inputSchema: { type: "object", properties: {}, required: [] } };
  • src/index.ts:1394-1407 (registration)
    Registration of all tools including list_memory_libraries via the ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ ADVANCED_REASONING_TOOL, QUERY_MEMORY_TOOL, CREATE_LIBRARY_TOOL, LIST_LIBRARIES_TOOL, SWITCH_LIBRARY_TOOL, GET_LIBRARY_INFO_TOOL, CREATE_SYSTEM_JSON_TOOL, GET_SYSTEM_JSON_TOOL, SEARCH_SYSTEM_JSON_TOOL, LIST_SYSTEM_JSON_TOOL ], }));
  • src/index.ts:1424-1426 (registration)
    Tool dispatch registration in the CallToolRequestHandler switch statement.
    case "list_memory_libraries": return await reasoningServer.listLibraries();

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/angrysky56/advanced-reasoning-mcp'

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