diff --git a/src/strands/tools/mcp/mcp_client.py b/src/strands/tools/mcp/mcp_client.py index 6ce591bc5..fed635fbc 100644 --- a/src/strands/tools/mcp/mcp_client.py +++ b/src/strands/tools/mcp/mcp_client.py @@ -801,4 +801,10 @@ def _matches_patterns(self, tool: MCPAgentTool, patterns: list[_ToolMatcher]) -> return False def _is_session_active(self) -> bool: - return self._background_thread is not None and self._background_thread.is_alive() + if self._background_thread is None or not self._background_thread.is_alive(): + return False + + if self._close_future is not None and self._close_future.done(): + return False + + return True