Skip to main content
Glama

list_memories

Retrieve all stored memories from the Memory MCP server to manage and organize data efficiently.

Instructions

List all stored memories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'list_memories' MCP tool. It calls the database manager to fetch all memories and formats them into a human-readable string response.
    def list_memories() -> str: """ List all stored memories. Returns: A formatted list of all memories with ID and title """ try: memories = db.list_memories() if not memories: return "No memories stored yet." result = "Stored Memories:\n\n" for memory in memories: result += f"ID: {memory['id']} - {memory['title']}\n" return result except Exception as e: return f"Error listing memories: {str(e)}"
  • Registration of the 'list_memories' tool in the server's list_tools() method, including name, description, and input schema.
    types.Tool( name="list_memories", description="List all stored memories.", inputSchema={ "type": "object", "properties": {}, "title": "listMemoriesArguments", }, ),
  • The input schema for the 'list_memories' tool, defining an empty object since no parameters are required.
    inputSchema={ "type": "object", "properties": {}, "title": "listMemoriesArguments", },
  • DatabaseManager helper method that queries the SQLite database for all memories, returning a list of id-title dicts used by the tool handler.
    def list_memories(self) -> List[Dict[str, Any]]: """Get a list of all memories with basic information.""" if not self.conn: self.initialize_db() if self.conn is None: raise RuntimeError("Database connection not available") cursor = self.conn.execute("SELECT id, title FROM memories") return [{"id": row[0], "title": row[1]} for row in cursor.fetchall()]
  • Dispatch handler in the server's call_tool() method that invokes the list_memories tool function and wraps the result in TextContent.
    elif name == "list_memories": result = list_memories() return [types.TextContent(type="text", text=result)]

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

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