Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tinyagent/mcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ async def close(self):
if self.exit_stack:
try:
await self.exit_stack.aclose()
except (RuntimeError, asyncio.CancelledError) as e:
# Log the error but don't re-raise it
except Exception as e:
# Log any cleanup error (including cancel-scope mismatches) but dont re-raise
self.logger.error(f"Error during client cleanup: {e}")
finally:
# Always reset these regardless of success or failure
# Reset client state unconditionally
self.session = None
self.exit_stack = AsyncExitStack()

Expand Down