pub struct Tool {
pub name: ToolName,
pub description: Cow<'static, str>,
pub invoke: fn(&str) -> String,
}Expand description
A callable tool the agent can invoke at runtime.
The invocation is synchronous and deterministic - side-effectful tools
(e.g. shell commands) should be wrapped in a Plugin variant tool with
appropriate error handling inside invoke.
§Examples
use lmm_agent::types::{Tool, ToolName};
let echo = Tool {
name: ToolName::Plugin("echo".to_string()),
description: "Echoes input back.".into(),
invoke: |input| input.to_string(),
};
assert_eq!((echo.invoke)("hello"), "hello");Fields§
§name: ToolNameThe name/kind of this tool.
description: Cow<'static, str>Human-readable description shown in planning context.
invoke: fn(&str) -> StringSynchronous invocation function: input → output.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl UnwindSafe for Tool
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