| … | … | @@ -25,11 +25,7 @@ |
| 25 | 25 | #include <ctime> |
| 26 | 26 | #include <algorithm> |
| 27 | 27 | #include <fstream> |
| 28 | | |
| 29 | | #if HAVE_MCP |
| 30 | 28 | #include <json/json.h> |
| 31 | | #include <sstream> |
| 32 | | #endif // HAVE_MCP |
| 33 | 29 | |
| 34 | 30 | #include <opencog/util/Logger.h> |
| 35 | 31 | #include <opencog/cogserver/mcp-tools/McpPlugin.h> |
| … | … | @@ -47,6 +43,13 @@ McpEval::McpEval(const AtomSpacePtr& asp) |
| 47 | 43 | _done = false; |
| 48 | 44 | } |
| 49 | 45 | |
| 46 | // Helper function to convert Json::Value to compact string |
| 47 | static std::string json_to_string(const Json::Value& value) { |
| 48 | Json::StreamWriterBuilder builder; |
| 49 | builder["indentation"] = ""; |
| 50 | return Json::writeString(builder, value); |
| 51 | } |
| 52 | |
| 50 | 53 | // Helper function to publish a resource file as MCP resource response |
| 51 | 54 | static bool publish_resource(const std::string& doc_base, |
| 52 | 55 | const std::string& uri, |
| … | … | @@ -87,7 +90,6 @@ void McpEval::eval_expr(const std::string &expr) |
| 87 | 90 | if (0 == expr.size()) return; |
| 88 | 91 | if (0 == expr.compare("\n")) return; |
| 89 | 92 | |
| 90 | | #if HAVE_MCP |
| 91 | 93 | logger().debug("[McpEval] received %s", expr.c_str()); |
| 92 | 94 | try |
| 93 | 95 | { |
| … | … | @@ -395,10 +397,6 @@ void McpEval::eval_expr(const std::string &expr) |
| 395 | 397 | _result = json_to_string(error_response) + "\n"; |
| 396 | 398 | _done = true; |
| 397 | 399 | } |
| 398 | | #else |
| 399 | | _result = "MCP support not compiled in\n"; |
| 400 | | _done = true; |
| 401 | | #endif //HAVE_MCP |
| 402 | 400 | } |
| 403 | 401 | |
| 404 | 402 | std::string McpEval::poll_result() |
| … | … | @@ -435,7 +433,6 @@ void McpEval::interrupt(void) |
| 435 | 433 | */ |
| 436 | 434 | void McpEval::register_plugin(std::shared_ptr<McpPlugin> plugin) |
| 437 | 435 | { |
| 438 | | #if HAVE_MCP |
| 439 | 436 | if (!plugin) return; |
| 440 | 437 | |
| 441 | 438 | _plugins.push_back(plugin); |
| … | … | @@ -453,7 +450,6 @@ void McpEval::register_plugin(std::shared_ptr<McpPlugin> plugin) |
| 453 | 450 | _tool_to_plugin[tool_name] = plugin; |
| 454 | 451 | } |
| 455 | 452 | } |
| 456 | | #endif // HAVE_MCP |
| 457 | 453 | } |
| 458 | 454 | |
| 459 | 455 | /** |
| … | … | @@ -461,7 +457,6 @@ void McpEval::register_plugin(std::shared_ptr<McpPlugin> plugin) |
| 461 | 457 | */ |
| 462 | 458 | void McpEval::unregister_plugin(std::shared_ptr<McpPlugin> plugin) |
| 463 | 459 | { |
| 464 | | #if HAVE_MCP |
| 465 | 460 | if (!plugin) return; |
| 466 | 461 | |
| 467 | 462 | // Remove from plugins list |
| … | … | @@ -479,7 +474,6 @@ void McpEval::unregister_plugin(std::shared_ptr<McpPlugin> plugin) |
| 479 | 474 | ++it; |
| 480 | 475 | } |
| 481 | 476 | } |
| 482 | | #endif // HAVE_MCP |
| 483 | 477 | } |
| 484 | 478 | |
| 485 | 479 | /* ============================================================== */ |