Skip to main content
Glama

list_memory_libraries

Retrieve and view detailed metadata of all memory libraries, including library names, node counts, and modification dates, for organized and searchable access in the Advanced Reasoning MCP Server.

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

  • Handler method in AdvancedReasoningServer that executes the tool logic. Delegates to CognitiveMemory.listLibraries(), formats output with current library info into MCP-compatible JSON response.
    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) { return { content: [{ type: "text", text: JSON.stringify({ error: error instanceof Error ? error.message : String(error), status: 'failed' }, null, 2) }], isError: true }; }
  • Core implementation in CognitiveMemory class that lists memory libraries by scanning filesystem, parsing JSON files to count nodes, collecting metadata, and sorting by last modified 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: [] }; }
  • Tool schema definition with name, description, and input schema (no required parameters).
    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:1302-1315 (registration)
    Registers the tool in the server's list of available tools.
    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:1332-1334 (registration)
    Dispatch handler in CallToolRequestSchema switch statement that routes the tool call to reasoningServer.listLibraries().
    case "list_memory_libraries": return await reasoningServer.listLibraries();

Other Tools

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

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