|
|
| ToolRegistry (const ToolRegistry &other) |
| |
|
ToolRegistry & | operator= (const ToolRegistry &other) |
| |
|
| ToolRegistry (ToolRegistry &&other) noexcept |
| |
|
ToolRegistry & | operator= (ToolRegistry &&other) noexcept |
| |
| core::Result< core::Unit > | add (protocol::ToolDefinition definition, ToolHandler handler) |
| | Register a tool definition and handler.
|
| |
| core::Result< protocol::ToolDefinition > | get (std::string_view name) const |
| | Look up a registered tool definition by name.
|
| |
| core::Result< protocol::ToolResult > | call (std::string_view name, protocol::Json arguments) const |
| | Invoke a tool without session metadata.
|
| |
| core::Result< protocol::ToolResult > | call (protocol::ToolCall call) const |
| | Invoke a tool from a parsed protocol call without session metadata.
|
| |
| core::Result< core::Unit > | validate (const protocol::ToolCall &call) const |
| | Validate that a parsed tool call can target a registered tool.
|
| |
| core::Result< protocol::ToolResult > | call (std::string_view name, protocol::Json arguments, const SessionContext &session_context) const |
| | Invoke a tool with full session metadata.
|
| |
| core::Result< protocol::ToolResult > | call (protocol::ToolCall call, const SessionContext &session_context) const |
| | Invoke a parsed protocol call with full session metadata.
|
| |
|
core::Result< protocol::ToolResult > | call (protocol::ToolCall call, const SessionContext &session_context, CancellationToken cancellation) const |
| | Invoke a parsed protocol call with session metadata and cooperative cancellation.
|
| |
|
core::Result< protocol::ToolResult > | call (protocol::ToolCall call, const SessionContext &session_context, CancellationToken cancellation, const JsonSchemaValidator *schema_validator) const |
| |
| core::Result< protocol::ToolResult > | call (std::string_view name, protocol::Json arguments, const std::string &session_id) const |
| | Invoke a tool with only a session id.
|
| |
|
std::vector< protocol::ToolDefinition > | list () const |
| | Return registered tool definitions sorted by name.
|
| |
Registry of named MCP tools and their handlers.
The registry owns copies of tool definitions and std::function handlers. It performs duplicate and bounded-name validation on add(): names must be non-empty, fit the SDK length limit, and contain no control characters. Calls are synchronous: the selected handler is copied under the registry lock, invoked on the caller's thread outside the lock, and any handler error is returned unchanged.
The registry synchronizes add/get/list/call access internally. Handler callbacks may reenter the registry without deadlocking.