Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Mcp reset error, #10497 (#10498)

Billy Bao58836d84fe0e
diff --git a/agent/component/agent_with_tools.py b/agent/component/agent_with_tools.py
index aa1ac296d2..32458fc85b 100644
--- a/agent/component/agent_with_tools.py
+++ b/agent/component/agent_with_tools.py
@@ -347,6 +347,10 @@ Respond immediately with your final comprehensive answer.
return "Error occurred."
def reset(self, temp=False):
+ """
+ Reset all tools if they have a reset method. This avoids errors for tools like MCPToolCallSession.
+ """
for k, cpn in self.tools.items():
- cpn.reset()
+ if hasattr(cpn, "reset") and callable(cpn.reset):
+ cpn.reset()