pub struct ToolDefExtensionBuilder { /* private fields */ }Expand description
Builder for ToolDefExtension.
Implementations§
Source§impl ToolDefExtensionBuilder
impl ToolDefExtensionBuilder
Sourcepub fn tool_fn(
self,
def: ToolDef,
exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static,
) -> Self
pub fn tool_fn( self, def: ToolDef, exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static, ) -> Self
Register a tool with its definition and synchronous exec function.
Sourcepub fn tool_with_dry_run(
self,
def: ToolDef,
exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static,
dry_run: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static,
) -> Self
pub fn tool_with_dry_run( self, def: ToolDef, exec: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static, dry_run: impl Fn(&ToolArgs) -> Result<String, String> + Send + Sync + 'static, ) -> Self
Register a sync tool plus a custom --dry-run handler.
Sourcepub fn async_tool_fn<F, Fut>(self, def: ToolDef, exec: F) -> Self
pub fn async_tool_fn<F, Fut>(self, def: ToolDef, exec: F) -> Self
Register a tool with its definition and async exec function.
Sourcepub fn sanitize_errors(self, sanitize: bool) -> Self
pub fn sanitize_errors(self, sanitize: bool) -> Self
Replace callback errors with generic messages before exposing them to scripts.
Sourcepub fn build(&self) -> ToolDefExtension
pub fn build(&self) -> ToolDefExtension
Build the extension.
Each call mints a fresh, isolated invocation log. Clones of the
returned extension also get a fresh log so cloned configuration can be
reused across tenants without sharing traces. Use
ToolDefExtension::invocation_trace before registration when a caller
intentionally wants a handle for this extension’s trace.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ToolDefExtensionBuilder
impl !UnwindSafe for ToolDefExtensionBuilder
impl Freeze for ToolDefExtensionBuilder
impl Send for ToolDefExtensionBuilder
impl Sync for ToolDefExtensionBuilder
impl Unpin for ToolDefExtensionBuilder
impl UnsafeUnpin for ToolDefExtensionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more