Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::PluginServer Class Reference

A loaded MCP server plugin and its C-ABI entry points. More...

#include <entropic/mcp/plugin_server.h>

Public Member Functions

 ~PluginServer ()
 Destroy the plugin instance, then close the library.
 
 PluginServer (const PluginServer &)=delete
 
PluginServeroperator= (const PluginServer &)=delete
 
 PluginServer (PluginServer &&)=delete
 
PluginServeroperator= (PluginServer &&)=delete
 
const std::string & name () const
 Server name, used as the tool-routing prefix.
 
const std::filesystem::path & path () const
 Path this plugin was loaded from.
 
std::string list_tools () const
 List the plugin's tools.
 
std::string execute (const std::string &tool_name, const std::string &args_json)
 Execute one of the plugin's tools.
 
entropic_error_t configure (const std::string &config_json)
 Pass configuration to the plugin instance.
 
entropic_error_t set_working_dir (const std::string &dir)
 Set the plugin's working directory.
 

Static Public Member Functions

static entropic_error_t load (const std::filesystem::path &path, std::unique_ptr< PluginServer > &out)
 Load a plugin .so and construct its server instance.
 

Detailed Description

A loaded MCP server plugin and its C-ABI entry points.

Non-copyable and non-movable: it owns a raw dlopen handle and a plugin instance whose lifetime is tied to that library staying mapped.

Version
2.10.1

Definition at line 46 of file plugin_server.h.

Constructor & Destructor Documentation

◆ ~PluginServer()

entropic::PluginServer::~PluginServer ( )

Destroy the plugin instance, then close the library.

Version
2.10.1

Order matters: the instance's destructor lives inside the library, so the library must outlive it. destroy() therefore happens-after every other call on the handle, and dlclose happens-after destroy().

@req REQ-MCP-006

Version
2.10.1

Definition at line 40 of file plugin_server.cpp.

Member Function Documentation

◆ configure()

entropic_error_t entropic::PluginServer::configure ( const std::string &  config_json)

Pass configuration to the plugin instance.

Parameters
config_jsonJSON configuration string.
Returns
Whatever the plugin's configure entry point returns.
Version
2.10.1

Serialised on the same per-instance mutex as execute().

Parameters
config_jsonJSON configuration string; borrowed for the call.
Returns
The plugin's own entropic_error_t result, forwarded verbatim. @req REQ-MCP-006
Version
2.10.1

Definition at line 345 of file plugin_server.cpp.

◆ execute()

std::string entropic::PluginServer::execute ( const std::string &  tool_name,
const std::string &  args_json 
)

Execute one of the plugin's tools.

Parameters
tool_nameLocal tool name (no server prefix).
args_jsonJSON arguments.
Returns
ServerResponse JSON envelope.
Version
2.10.1

Serialised on a per-instance mutex so the threading promise the plugin header makes to authors — "the engine never runs these concurrently on one handle" — holds by construction rather than by every upstream caller behaving. No ordering is promised between distinct handles and the calling thread is not fixed.

Parameters
tool_nameLocal tool name (no server prefix); borrowed for the call.
args_jsonJSON arguments; borrowed for the call.
Returns
The plugin's ServerResponse JSON envelope, copied out of plugin-owned memory; empty when the plugin returned null. @req REQ-MCP-006 @req REQ-MCP-002 @req REQ-MCP-007
Version
2.10.1

Definition at line 328 of file plugin_server.cpp.

◆ list_tools()

std::string entropic::PluginServer::list_tools ( ) const

List the plugin's tools.

Returns
JSON array string; "[]" if the plugin returned nothing.
Version
2.10.1

Descriptors use inputSchema (camelCase), which is what ServerManager::get_tool_schema parses so a plugin tool gets the same argument validation a built-in does.

Returns
JSON array string of tool descriptors; "[]" when the plugin returned nothing. @req REQ-MCP-007 @req REQ-MCP-008 @req REQ-MCP-006
Version
2.10.1

Definition at line 303 of file plugin_server.cpp.

◆ load()

entropic_error_t entropic::PluginServer::load ( const std::filesystem::path &  path,
std::unique_ptr< PluginServer > &  out 
)
static

Load a plugin .so and construct its server instance.

Load a plugin .so and construct its server instance.

Performs the full sequence: dlopen, resolve all nine entry points, verify entropic_plugin_api_version() against ENTROPIC_MCP_PLUGIN_API_VERSION, then entropic_create_server(). Every failure is logged with the offending path before returning.

Parameters
pathFilesystem path to the plugin shared object.
[out]outReceives the loaded plugin on success; untouched otherwise.
Returns
ENTROPIC_OK, ENTROPIC_ERROR_PLUGIN_LOAD_FAILED (dlopen or a missing entry point or a null instance), or ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH.
Version
2.10.1

dlopen, then dlsym of all nine entry points, then the API-version check, then entropic_create_server(). Every failure is typed and logged with its path — a configured plugin never fails silently.

Parameters
pathPlugin shared object path.
[out]outReceives the loaded plugin on success; left untouched on failure.
Returns
ENTROPIC_OK on success; ENTROPIC_ERROR_PLUGIN_LOAD_FAILED when dlopen fails, an entry point is missing, or the factory yields a null/unnamed instance; ENTROPIC_ERROR_PLUGIN_VERSION_MISMATCH when the plugin reports a different API version. @req REQ-MCP-005 @req REQ-MCP-004
Version
2.10.1

Definition at line 70 of file plugin_server.cpp.

◆ name()

const std::string & entropic::PluginServer::name ( ) const
inline

Server name, used as the tool-routing prefix.

Returns
Name reported by entropic_mcp_server_name() at load time. @utility
Version
2.10.1

Definition at line 84 of file plugin_server.h.

◆ path()

const std::filesystem::path & entropic::PluginServer::path ( ) const
inline

Path this plugin was loaded from.

Returns
Filesystem path. @utility
Version
2.10.1

Definition at line 92 of file plugin_server.h.

◆ set_working_dir()

entropic_error_t entropic::PluginServer::set_working_dir ( const std::string &  dir)

Set the plugin's working directory.

Parameters
dirDirectory path.
Returns
Whatever the plugin's set_working_dir entry point returns.
Version
2.10.1

Serialised on the same per-instance mutex as execute().

Parameters
dirDirectory path; borrowed for the call.
Returns
The plugin's own entropic_error_t result, forwarded verbatim. @req REQ-MCP-006
Version
2.10.1

Definition at line 360 of file plugin_server.cpp.


The documentation for this class was generated from the following files: