Agents 1.4.0
Edge AI Agents SDK
Loading...
Searching...
No Matches
agents::tools::ToolRegistry Class Reference

Registry for tools that agents can use. More...

#include <tool_registry.h>

Public Member Functions

void registerTool (std::shared_ptr< Tool > tool)
 Register a tool.
std::shared_ptr< ToolgetTool (const std::string &name) const
 Get a tool by name.
std::vector< std::shared_ptr< Tool > > getAllTools () const
 Get all registered tools.
bool hasTool (const std::string &name) const
 Check if a tool is registered.
void removeTool (const std::string &name)
 Remove a tool.
void clear ()
 Clear all tools.
JsonObject getToolSchemas () const
 Get tool schemas as JSON.
void registerStandardTools (const std::shared_ptr< LLMInterface > llm=nullptr, const std::vector< mcpConfig > mcpConfig={})
 Create and register standard tools.

Static Public Member Functions

static ToolRegistry & global ()
 Get the global tool registry.

Detailed Description

Registry for tools that agents can use.

The ToolRegistry provides a central place to register, retrieve, and manage tools that agents can use.

Member Function Documentation

◆ getAllTools()

std::vector< std::shared_ptr< Tool > > agents::tools::ToolRegistry::getAllTools ( ) const

Get all registered tools.

Returns
The tools

◆ getTool()

std::shared_ptr< Tool > agents::tools::ToolRegistry::getTool ( const std::string & name) const

Get a tool by name.

Parameters
nameThe name of the tool
Returns
The tool

◆ getToolSchemas()

JsonObject agents::tools::ToolRegistry::getToolSchemas ( ) const

Get tool schemas as JSON.

Returns
The tool schemas

◆ global()

ToolRegistry & agents::tools::ToolRegistry::global ( )
static

Get the global tool registry.

Returns
The global tool registry
Examples
autonomous_agent_example.cpp, and streaming_chat.cpp.

◆ hasTool()

bool agents::tools::ToolRegistry::hasTool ( const std::string & name) const

Check if a tool is registered.

Parameters
nameThe name of the tool
Returns
True if the tool is registered, false otherwise

◆ registerStandardTools()

void agents::tools::ToolRegistry::registerStandardTools ( const std::shared_ptr< LLMInterface > llm = nullptr,
const std::vector< mcpConfig > mcpConfig = {} )

Create and register standard tools.

Parameters
llmOptional LLM interface for tools that require it
mcpConfigOptional config of the MCP server

◆ registerTool()

void agents::tools::ToolRegistry::registerTool ( std::shared_ptr< Tool > tool)

Register a tool.

Parameters
toolThe tool to register

◆ removeTool()

void agents::tools::ToolRegistry::removeTool ( const std::string & name)

Remove a tool.

Parameters
nameThe name of the tool