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

Manages a collection of ToolBase instances. More...

#include <entropic/mcp/tool_registry.h>

Public Member Functions

void register_tool (ToolBase *tool)
 Register a tool instance.
 
bool has_tool (const std::string &name) const
 Check if a tool is registered by name.
 
std::string get_tools_json () const
 Get all registered tool definitions as a JSON array string.
 
std::vector< const ToolDefinition * > get_definitions () const
 Get all registered tool definitions.
 
ServerResponse dispatch (const std::string &name, const std::string &args_json)
 Dispatch a tool call to the registered tool's execute().
 
ToolBaseget_tool (const std::string &name) const
 Get a registered tool by name.
 

Detailed Description

Manages a collection of ToolBase instances.

Replaces the dict-dispatch boilerplate repeated across servers. Servers call register_tool() during construction and the registry handles get_tools() and dispatch() automatically.

Version
1.8.5

Definition at line 31 of file tool_registry.h.

Member Function Documentation

◆ dispatch()

ServerResponse entropic::ToolRegistry::dispatch ( const std::string &  name,
const std::string &  args_json 
)

Dispatch a tool call to the registered tool's execute().

Dispatch a tool call to the registered tool.

Parameters
nameTool name.
args_jsonJSON arguments string.
Returns
ServerResponse from the tool, or error response if unknown.
Version
1.8.5
Parameters
nameTool name.
args_jsonJSON arguments string.
Returns
ServerResponse from the tool.

Definition at line 90 of file tool_registry.cpp.

◆ get_definitions()

std::vector< const ToolDefinition * > entropic::ToolRegistry::get_definitions ( ) const

Get all registered tool definitions.

Returns
Vector of ToolDefinition references.
Version
1.8.5
Returns
Vector of ToolDefinition pointers.

Definition at line 73 of file tool_registry.cpp.

◆ get_tool()

ToolBase * entropic::ToolRegistry::get_tool ( const std::string &  name) const

Get a registered tool by name.

Parameters
nameTool name.
Returns
Tool pointer, or nullptr if not found.
Version
1.8.5
Parameters
nameTool name.
Returns
Tool pointer, or nullptr if not found.

Definition at line 111 of file tool_registry.cpp.

◆ get_tools_json()

std::string entropic::ToolRegistry::get_tools_json ( ) const

Get all registered tool definitions as a JSON array string.

Get all registered tool definitions as JSON array.

Returns
JSON array of tool definitions. Caller-owned string.
Version
1.8.5
Returns
JSON array string.

Definition at line 54 of file tool_registry.cpp.

◆ has_tool()

bool entropic::ToolRegistry::has_tool ( const std::string &  name) const

Check if a tool is registered by name.

Parameters
nameTool name.
Returns
true if registered.
Version
1.8.5
Parameters
nameTool name.
Returns
true if registered.

Definition at line 44 of file tool_registry.cpp.

◆ register_tool()

void entropic::ToolRegistry::register_tool ( ToolBase tool)

Register a tool instance.

Parameters
toolNon-owning pointer to a ToolBase. Caller retains ownership.
Version
1.8.5
Parameters
toolNon-owning pointer to a ToolBase.

Definition at line 24 of file tool_registry.cpp.


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