12#include <nlohmann/json.hpp>
33 if (tool ==
nullptr) {
34 logger->warn(
"Attempted to register null tool");
37 const auto& name = tool->
name();
38 if (tools_.count(name) > 0) {
39 logger->warn(
"Tool '{}' already registered — replacing", name);
42 logger->info(
"Registered tool: {}", name);
54 return tools_.count(name) > 0;
71 auto arr = nlohmann::json::array();
72 for (
const auto& [name, tool] : tools_) {
74 entry[
"name"] = tool->definition().name;
75 entry[
"description"] = tool->definition().description;
76 entry[
"inputSchema"] = nlohmann::json::parse(
77 tool->definition().input_schema);
78 arr.push_back(std::move(entry));
92 std::vector<const ToolDefinition*> defs;
93 defs.reserve(tools_.size());
94 for (
const auto& [name, tool] : tools_) {
95 defs.push_back(&tool->definition());
116 const std::string& name,
117 const std::string& args_json) {
118 auto it = tools_.find(name);
119 if (it == tools_.end()) {
120 logger->warn(
"Unknown tool: {}", name);
122 resp.
result =
"Error: Unknown tool '" + name +
"'";
125 logger->info(
"Dispatch: tool='{}'", name);
126 return it->second->execute(args_json);
138 auto it = tools_.find(name);
139 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.