pub struct EchoTool;Expand description
Echo 工具:原样返回输入。
这是最简单的工具实现,用于测试和调试工具调用流程。 它不会对输入进行任何处理,直接返回原始数据。
适用场景:
- 测试工具调用机制
- 调试数据传递流程
- 作为其他工具实现的参考模板
输入格式:
{
"text": "要回显的文本"
}Trait Implementations§
Source§impl Tool for EchoTool
impl Tool for EchoTool
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
返回工具描述。
Source§fn categories(&self) -> &'static [ToolCategory]
fn categories(&self) -> &'static [ToolCategory]
返回工具分类。
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
返回输入参数的 JSON Schema。
Source§fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
执行工具的核心逻辑。
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
获取工具定义 (ToolDefinition) Read more
Auto Trait Implementations§
impl Freeze for EchoTool
impl RefUnwindSafe for EchoTool
impl Send for EchoTool
impl Sync for EchoTool
impl Unpin for EchoTool
impl UnsafeUnpin for EchoTool
impl UnwindSafe for EchoTool
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