Centralized registry for all agent tools. More...
#include <tool_registry.h>
Classes | |
| struct | ToolEntry |
Public Types | |
| using | HandlerFactory = std::function<std::unique_ptr<resources::CommandHandler>()> |
Public Member Functions | |
| void | RegisterTool (const ToolDefinition &def, HandlerFactory factory) |
| std::vector< ToolDefinition > | GetAllTools () const |
| std::optional< ToolDefinition > | GetToolDefinition (const std::string &name) const |
| std::vector< ToolDefinition > | GetToolsByCategory (const std::string &category) const |
| absl::StatusOr< std::unique_ptr< resources::CommandHandler > > | CreateHandler (const std::string &tool_name) const |
Static Public Member Functions | |
| static ToolRegistry & | Get () |
Private Member Functions | |
| ToolRegistry ()=default | |
Private Attributes | |
| std::map< std::string, ToolEntry > | tools_ |
Centralized registry for all agent tools.
Replaces the hardcoded switch/case in ToolDispatcher. Allows tools to self-register and provides a unified way to discover, query, and instantiate tools.
Definition at line 42 of file tool_registry.h.
| using yaze::cli::agent::ToolRegistry::HandlerFactory = std::function<std::unique_ptr<resources::CommandHandler>()> |
Definition at line 45 of file tool_registry.h.
|
privatedefault |
|
static |
Definition at line 9 of file tool_registry.cc.
Referenced by yaze::cli::agent::ToolDispatcher::Dispatch(), yaze::cli::agent::ToolDispatcher::GetAvailableTools(), and yaze::cli::agent::ToolDispatcher::GetToolInfo().
| void yaze::cli::agent::ToolRegistry::RegisterTool | ( | const ToolDefinition & | def, |
| HandlerFactory | factory ) |
Definition at line 14 of file tool_registry.cc.
References yaze::cli::agent::ToolDefinition::name, and tools_.
| std::vector< ToolDefinition > yaze::cli::agent::ToolRegistry::GetAllTools | ( | ) | const |
Definition at line 18 of file tool_registry.cc.
References yaze::zelda3::name, and tools_.
Referenced by yaze::cli::agent::ToolDispatcher::GetAvailableTools().
| std::optional< ToolDefinition > yaze::cli::agent::ToolRegistry::GetToolDefinition | ( | const std::string & | name | ) | const |
Definition at line 27 of file tool_registry.cc.
References yaze::zelda3::name, and tools_.
Referenced by yaze::cli::agent::ToolDispatcher::Dispatch(), and yaze::cli::agent::ToolDispatcher::GetToolInfo().
| std::vector< ToolDefinition > yaze::cli::agent::ToolRegistry::GetToolsByCategory | ( | const std::string & | category | ) | const |
Definition at line 35 of file tool_registry.cc.
References yaze::zelda3::category, yaze::zelda3::name, and tools_.
| absl::StatusOr< std::unique_ptr< resources::CommandHandler > > yaze::cli::agent::ToolRegistry::CreateHandler | ( | const std::string & | tool_name | ) | const |
Definition at line 46 of file tool_registry.cc.
References tools_.
Referenced by yaze::cli::agent::ToolDispatcher::Dispatch().
|
private |
Definition at line 69 of file tool_registry.h.
Referenced by CreateHandler(), GetAllTools(), GetToolDefinition(), GetToolsByCategory(), and RegisterTool().