pulsatrix 1.1.0
Loading...
Searching...
No Matches
pulsatrix::orch::ToolRegistry Class Reference

The tools an agent may use. RunToolLoop() takes executor(), and a planned MCP server will serve the same registry, so a tool is defined once. More...

#include <tool_registry.hpp>

Public Member Functions

ToolRegistry & add (Tool tool)
 Adds tool.
 
const Tool * find (std::string_view name) const
 The tool named name, or nullptr.
 
std::size_t size () const
 
bool empty () const
 
const std::vector< Tool > & tools () const
 The tools, in the order they were added.
 
std::vector< ToolSpec > specs () const
 The tools as ChatRequest::tools wants them, in the order they were added.
 
ToolOutcome call (std::string_view name, const JsonValue &input) const
 Runs tool name on input. An unknown tool, an input that doesn't match the schema, or a handler that throws gives an error result the model can act on, never an exception.
 
ToolExecutor executor () const
 An executor for RunToolLoop() that calls call(). It refers to this registry, which must outlive it.
 

Detailed Description

The tools an agent may use. RunToolLoop() takes executor(), and a planned MCP server will serve the same registry, so a tool is defined once.

Note
Calls are const and may run concurrently if the handlers allow it; add() may not.

Member Function Documentation

◆ add()

ToolRegistry & pulsatrix::orch::ToolRegistry::add ( Tool  tool)

Adds tool.

Exceptions
std::invalid_argumentif its name is invalid or taken, it has no handler, its schema isn't an object schema that passes CheckSchema(), or it's strict and the schema doesn't suit strict mode.

◆ call()

ToolOutcome pulsatrix::orch::ToolRegistry::call ( std::string_view  name,
const JsonValue &  input 
) const

Runs tool name on input. An unknown tool, an input that doesn't match the schema, or a handler that throws gives an error result the model can act on, never an exception.

◆ empty()

bool pulsatrix::orch::ToolRegistry::empty ( ) const
inline

◆ executor()

ToolExecutor pulsatrix::orch::ToolRegistry::executor ( ) const

An executor for RunToolLoop() that calls call(). It refers to this registry, which must outlive it.

◆ find()

const Tool * pulsatrix::orch::ToolRegistry::find ( std::string_view  name) const

The tool named name, or nullptr.

◆ size()

std::size_t pulsatrix::orch::ToolRegistry::size ( ) const
inline

◆ specs()

std::vector< ToolSpec > pulsatrix::orch::ToolRegistry::specs ( ) const

The tools as ChatRequest::tools wants them, in the order they were added.

◆ tools()

const std::vector< Tool > & pulsatrix::orch::ToolRegistry::tools ( ) const
inline

The tools, in the order they were added.


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