Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
server_base.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
14#pragma once
15
19
20#include <string>
21#include <vector>
22
23namespace entropic {
24
34 std::string result;
35 std::vector<Directive> directives;
36};
37
67public:
68 virtual ~MCPServerBase() = default;
69
75 explicit MCPServerBase(std::string name);
76
82 const std::string& name() const;
83
89 void register_tool(ToolBase* tool);
90
96 std::string list_tools() const;
97
110 std::string execute(const std::string& tool_name,
111 const std::string& args_json);
112
123 virtual std::string get_permission_pattern(
124 const std::string& tool_name,
125 const std::string& args_json) const;
126
136 virtual bool skip_duplicate_check(
137 const std::string& tool_name) const;
138
147 virtual bool configure(const std::string& config_json);
148
157 virtual bool set_working_dir(const std::string& path);
158
165 const ToolRegistry& registry() const { return registry_; }
166
167protected:
168 std::string name_;
170
171private:
178 static std::string serialize_response(const ServerResponse& response);
179
187 static void inject_anchor_if_needed(
188 const ToolBase& tool,
189 const std::string& args_json,
190 ServerResponse& response);
191};
192
193} // namespace entropic
Concrete base class for MCP servers (80% logic).
Definition server_base.h:66
std::string list_tools() const
List all registered tools as a JSON array string.
std::string execute(const std::string &tool_name, const std::string &args_json)
Execute a tool and wrap result in ServerResponse JSON.
const std::string & name() const
Get the server name.
std::string name_
Server name.
virtual bool skip_duplicate_check(const std::string &tool_name) const
Check if a tool should skip duplicate detection.
void register_tool(ToolBase *tool)
Register a tool with this server.
virtual std::string get_permission_pattern(const std::string &tool_name, const std::string &args_json) const
Generate permission pattern for 'Always Allow/Deny'.
ToolRegistry registry_
Tool registry.
virtual bool set_working_dir(const std::string &path)
Set the working directory.
virtual bool configure(const std::string &config_json)
Configure the server after creation.
const ToolRegistry & registry() const
Get the tool registry (const).
Abstract base class for individual MCP tools.
Definition tool_base.h:45
Manages a collection of ToolBase instances.
Directive processing for tool-to-engine communication.
Activate model on GPU (WARM → ACTIVE).
Structured result from tool execution.
Definition server_base.h:33
std::vector< Directive > directives
Engine-level side effects.
Definition server_base.h:35
std::string result
Human-readable result.
Definition server_base.h:34
Abstract base class for individual MCP tools.
Tool registration, lookup, and dispatch.