list_memories
Retrieve available memory entries from the Serena MCP server to access stored information for coding tasks.
Instructions
List available memories. Any memory can be read using the read_memory tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/serena/tools/memory_tools.py:43-53 (handler)Implementation of the MCP tool handler for "list_memories". The apply method retrieves the list of memories from the project's memories_manager and serializes it to JSON.class ListMemoriesTool(Tool): """ Lists memories in Serena's project-specific memory store. """ def apply(self) -> str: """ List available memories. Any memory can be read using the `read_memory` tool. """ return self._to_json(self.memories_manager.list_memories())
- src/serena/project.py:48-49 (helper)Core utility method in MemoriesManager that lists the names of memory files (stripping .md extension) in the project's memories directory.def list_memories(self) -> list[str]: return [f.name.replace(".md", "") for f in self._memory_dir.iterdir() if f.is_file()]
- src/serena/tools/tools_base.py:118-125 (registration)Class method that derives the MCP tool name 'list_memories' from the class name 'ListMemoriesTool'.@classmethod def get_name_from_cls(cls) -> str: name = cls.__name__ if name.endswith("Tool"): name = name[:-4] # convert to snake_case name = "".join(["_" + c.lower() if c.isupper() else c for c in name]).lstrip("_") return name
- src/serena/tools/tools_base.py:359-367 (registration)ToolRegistry discovers all Tool subclasses (including ListMemoriesTool) via iter_subclasses and registers them by name.for cls in iter_subclasses(Tool): if not any(cls.__module__.startswith(pkg) for pkg in tool_packages): continue is_optional = issubclass(cls, ToolMarkerOptional) name = cls.get_name_from_cls() if name in self._tool_dict: raise ValueError(f"Duplicate tool name found: {name}. Tool classes must have unique names.") self._tool_dict[name] = RegisteredTool(tool_class=cls, is_optional=is_optional, tool_name=name)