diff --git a/src/language/modules/LinearSolverModule.cpp b/src/language/modules/LinearSolverModule.cpp
index 9e626ba2b0e4707df0495de2057a00d81ea4b118..a5bb2cf90058b9232bd84e2f2bbdd71eb02ef3c7 100644
--- a/src/language/modules/LinearSolverModule.cpp
+++ b/src/language/modules/LinearSolverModule.cpp
@@ -57,29 +57,36 @@ LinearSolverModule::LinearSolverModule()
 
                                               ));
 
-  this->_addBuiltinFunction("printLSOptions", std::make_shared<BuiltinFunctionEmbedder<void()>>(
+  this->_addBuiltinFunction("getLSOptions", std::make_shared<BuiltinFunctionEmbedder<std::string()>>(
+
+                                              []() -> std::string {
+                                                std::ostringstream os;
+                                                os << rang::fgB::yellow << "Linear solver options" << rang::style::reset
+                                                   << '\n';
+                                                os << LinearSolverOptions::default_options;
+                                                return os.str();
+                                              }
+
+                                              ));
+
+  this->_addBuiltinFunction("getLSAvailable", std::make_shared<BuiltinFunctionEmbedder<std::string()>>(
 
-                                                []() -> void {
-                                                  std::cout << rang::fgB::yellow << "Linear solver options"
-                                                            << rang::style::reset << '\n';
-                                                  std::cout << LinearSolverOptions::default_options;
+                                                []() -> std::string {
+                                                  std::ostringstream os;
+
+                                                  os << rang::fgB::yellow << "Available linear solver options"
+                                                     << rang::style::reset << '\n';
+                                                  os << rang::fgB::blue << " libraries" << rang::style::reset << '\n';
+
+                                                  printLSEnumListNames<LSLibrary>(os);
+                                                  os << rang::fgB::blue << " methods" << rang::style::reset << '\n';
+                                                  printLSEnumListNames<LSMethod>(os);
+                                                  os << rang::fgB::blue << " preconditioners" << rang::style::reset
+                                                     << '\n';
+                                                  printLSEnumListNames<LSPrecond>(os);
+
+                                                  return os.str();
                                                 }
 
                                                 ));
-
-  this->_addBuiltinFunction("printLSAvailable",
-                            std::make_shared<BuiltinFunctionEmbedder<void()>>(
-
-                              []() -> void {
-                                std::cout << rang::fgB::yellow << "Available linear solver options"
-                                          << rang::style::reset << '\n';
-                                std::cout << rang::fgB::blue << " libraries" << rang::style::reset << '\n';
-                                printLSEnumListNames<LSLibrary>(std::cout);
-                                std::cout << rang::fgB::blue << " methods" << rang::style::reset << '\n';
-                                printLSEnumListNames<LSMethod>(std::cout);
-                                std::cout << rang::fgB::blue << " preconditioners" << rang::style::reset << '\n';
-                                printLSEnumListNames<LSPrecond>(std::cout);
-                              }
-
-                              ));
 }