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

### What problem does this PR solve?

Fix #10497

### Type of change

- [X] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Billy Bao 2025-10-13 09:34:44 +08:00 committed by GitHub
parent ad56137a59
commit 58836d84fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()