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());
120 const std::string& name,
122 auto it = tools_.find(name);
123 if (
it == tools_.end()) {
124 logger->warn(
"Unknown tool: {}", name);
126 resp.
result =
"Error: Unknown tool '" + name +
"'";
129 logger->info(
"Dispatch: tool='{}'", name);
142 auto it = tools_.find(name);
143 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).
@ optional
optional: every escape asks the host's path approver
MCPServerBase concrete base class + ServerResponse.
Structured result from tool execution.
std::string result
Human-readable result.