list_memories
Retrieve all stored memories from the Memory MCP server to manage and organize data efficiently.
Instructions
List all stored memories.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_memories"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- memory_mcp/server.py:247-264 (handler)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)}" - memory_mcp/server.py:370-378 (registration)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", }, ), - memory_mcp/server.py:373-377 (schema)The input schema for the 'list_memories' tool, defining an empty object since no parameters are required.
inputSchema={ "type": "object", "properties": {}, "title": "listMemoriesArguments", }, - memory_mcp/server.py:126-136 (helper)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()] - memory_mcp/server.py:438-440 (handler)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)]