pub trait ToolHandler:
Send
+ Sync
+ 'static {
// Required method
fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, BlockError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Async handler invoked when the LLM (or a Lua call to
tool.call(name, ...)) targets a Rust-implemented tool supplied via
BlockConfig::host_tools.
input arrives as a serde_json::Value (converted from Lua before
the handler is invoked). The returned value is converted back to a
Lua value and delivered to the caller. Errors are propagated as
LuaError::external (visible inside the script) and as BlockError
on the Rust side.
Required Methods§
fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, BlockError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".