pub struct NativeTool { /* private fields */ }Expand description
A native (in-memory) tool implemented as a Rust async function
Native tools execute directly in the runtime process with no IPC overhead. They are defined as async closures that accept parameters and return results.
Implementations§
Source§impl NativeTool
impl NativeTool
Sourcepub fn new<F, Fut>(
name: impl Into<String>,
description: impl Into<String>,
input_schema: JsonValue,
executor: F,
) -> Self
pub fn new<F, Fut>( name: impl Into<String>, description: impl Into<String>, input_schema: JsonValue, executor: F, ) -> Self
Create a new native tool
§Arguments
name- Unique identifier for the tooldescription- Human-readable descriptioninput_schema- JSON Schema describing input parametersexecutor- Async function that executes the tool
Trait Implementations§
Source§impl Debug for NativeTool
impl Debug for NativeTool
Source§impl Tool for NativeTool
impl Tool for NativeTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description for LLM
Source§fn input_schema(&self) -> JsonValue
fn input_schema(&self) -> JsonValue
JSON schema for input parameters
Auto Trait Implementations§
impl Freeze for NativeTool
impl !RefUnwindSafe for NativeTool
impl Send for NativeTool
impl Sync for NativeTool
impl Unpin for NativeTool
impl !UnwindSafe for NativeTool
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