48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#pragma once
|
|
#include <nlohmann/json.hpp>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace aethera::web {
|
|
struct Plot;
|
|
}
|
|
|
|
namespace aethera::mcp {
|
|
|
|
enum struct Tool_Call_Result : std::uint8_t {
|
|
ok,
|
|
unknown_tool,
|
|
invalid_arguments,
|
|
unknown_plot,
|
|
rejected
|
|
};
|
|
|
|
struct Tool_Call_Output {
|
|
Tool_Call_Result result{Tool_Call_Result::ok}; /* 调用的已知业务结果。 */
|
|
nlohmann::json content{}; /* 成功值或结构化错误细节。 */
|
|
std::string message{}; /* 供协议适配器显示的简短说明。 */
|
|
};
|
|
|
|
struct Control_Service final {
|
|
static std::shared_ptr<Control_Service> create();
|
|
~Control_Service();
|
|
Control_Service(const Control_Service&) = delete;
|
|
Control_Service& operator=(const Control_Service&) = delete;
|
|
|
|
[[nodiscard]] std::shared_ptr<web::Plot> find_plot(
|
|
std::string_view id) const;
|
|
[[nodiscard]] nlohmann::json plot_catalog() const;
|
|
[[nodiscard]] nlohmann::json tool_catalog() const;
|
|
[[nodiscard]] Tool_Call_Output call_tool(
|
|
std::string_view name, const nlohmann::json& arguments);
|
|
|
|
private:
|
|
Control_Service();
|
|
struct Private;
|
|
std::unique_ptr<Private> d;
|
|
};
|
|
|
|
}
|