Self-hosted AI workspace.
Python
fix: rag add_directory records the dir so list/remove can see it (#1369)
Afonso Coutinhoc495ec31f66a
diff --git a/mcp_servers/rag_server.py b/mcp_servers/rag_server.pyindex 1afd7fce9..d70aa1ccf 100644--- a/mcp_servers/rag_server.py+++ b/mcp_servers/rag_server.py@@ -112,6 +112,15 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:try:result = _rag_manager.index_personal_documents(directory)indexed = result.get("indexed_count", 0) if isinstance(result, dict) else 0+ # Record the directory so `list` and `remove_directory` can see it.+ # Indexing was just done above, so pass index=False to avoid a second+ # (ownerless) pass. Without this the directory was indexed but never+ # tracked in indexed_directories, so it was invisible/unremovable.+ if _personal_docs_manager and hasattr(_personal_docs_manager, "add_directory"):+ try:+ _personal_docs_manager.add_directory(directory, index=False)+ except Exception:+ passreturn [TextContent(type="text", text=f"Directory '{directory}' added to RAG index ({indexed} chunks indexed)")]except Exception as e:return [TextContent(type="text", text=f"Error: Failed to index directory: {e}")]