12#include <nlohmann/json.hpp>
25 if (tool ==
nullptr) {
26 logger->warn(
"Attempted to register null tool");
29 const auto& name = tool->
name();
30 if (tools_.count(name) > 0) {
31 logger->warn(
"Tool '{}' already registered — replacing", name);
34 logger->info(
"Registered tool: {}", name);
45 return tools_.count(name) > 0;
55 auto arr = nlohmann::json::array();
56 for (
const auto& [name, tool] : tools_) {
58 entry[
"name"] = tool->definition().name;
59 entry[
"description"] = tool->definition().description;
60 entry[
"inputSchema"] = nlohmann::json::parse(
61 tool->definition().input_schema);
62 arr.push_back(std::move(entry));
74 std::vector<const ToolDefinition*> defs;
75 defs.reserve(tools_.size());
76 for (
const auto& [name, tool] : tools_) {
77 defs.push_back(&tool->definition());
91 const std::string& name,
92 const std::string& args_json) {
93 auto it = tools_.find(name);
94 if (it == tools_.end()) {
95 logger->warn(
"Unknown tool: {}", name);
97 resp.
result =
"Error: Unknown tool '" + name +
"'";
100 logger->info(
"Dispatch: tool='{}'", name);
101 return it->second->execute(args_json);
112 auto it = tools_.find(name);
113 if (it == tools_.end()) {
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Activate model on GPU (WARM → ACTIVE).
MCPServerBase concrete base class + ServerResponse.
Structured result from tool execution.
std::string result
Human-readable result.