17#include <nlohmann/json.hpp>
73 auto args = nlohmann::json::parse(
args_json);
74 std::string url = args.at(
"url").get<std::string>();
77 static constexpr int cap_max = 50000;
81 logger->info(
"[web_fetch] url='{}' max_length={}", url,
max_length);
86 tool_error_json(
"not_implemented",
"Web fetch is not implemented in this build; "
87 "the web server is a placeholder (mcp.enable_web)."),
139 auto args = nlohmann::json::parse(
args_json);
140 std::string
query = args.at(
"query").get<std::string>();
143 static constexpr int cap_max = 10;
147 logger->info(
"[web_search] query='{}' max_results={}",
153 tool_error_json(
"not_implemented",
"Web search is not implemented in this build; "
154 "the web server is a placeholder (mcp.enable_web)."),
179 web_fetch_ = std::make_unique<WebFetchTool>(
184 web_search_ = std::make_unique<WebSearchTool>(
190 logger->info(
"WebServer initialized with 2 tools");
Concrete base class for MCP servers (80% logic).
void register_tool(ToolBase *tool)
Register a tool with this server.
WebServer(const std::string &data_dir)
Construct with data dir.
~WebServer() override
Destructor.
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).
ToolDefinition load_tool_definition(const std::string &tool_name, const std::string &server_prefix, const std::string &data_dir)
Load a tool definition from a JSON file.
@ optional
optional: every escape asks the host's path approver
std::string tool_error_json(const std::string &code, const std::string &message)
A declared tool error: {"error": code, "message": message}.
MCPAccessLevel
MCP tool access level for per-identity authorization.
@ READ
Read-only operations (e.g., read_file, list_directory)
MCPServerBase concrete base class + ServerResponse.
Structured result from tool execution.
Web MCP server — web_fetch + web_search.