pub struct ToolSpec {
pub name: String,
pub description: String,
pub parameters: Value,
pub effects: Vec<ToolEffect>,
}Expand description
Description of a callable tool, exposed to models for tool calling.
Fields§
§name: StringUnique name within a ToolRuntime (e.g. search or github.create_issue).
description: String§parameters: ValueJSON Schema of the arguments object.
effects: Vec<ToolEffect>What a call does besides answering, as the provider declares it (a
plugin manifest’s effects). Never sent to models. Empty: nothing
declared. An agent node asks for approval before a call whose tool
sends or pays, unless the node
auto approves it.
Implementations§
Source§impl ToolSpec
impl ToolSpec
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
parameters: Value,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> Self
A tool without declared effects.
Sourcepub fn with_effects(self, effects: Vec<ToolEffect>) -> Self
pub fn with_effects(self, effects: Vec<ToolEffect>) -> Self
The same tool, declaring effects.
Sourcepub fn needs_approval(&self) -> bool
pub fn needs_approval(&self) -> bool
Whether a person should approve a call of this tool before it runs: it sends a message or pays.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolSpec
impl<'de> Deserialize<'de> for ToolSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ToolSpec
Auto Trait Implementations§
impl Forget for ToolSpec
impl Freeze for ToolSpecwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
PhantomData<ToolEffect>: Freeze,
impl Move for ToolSpec
impl RefUnwindSafe for ToolSpec
impl Send for ToolSpec
impl Sync for ToolSpec
impl Unpin for ToolSpec
impl UnsafeUnpin for ToolSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
PhantomData<ToolEffect>: UnsafeUnpin,
impl UnwindSafe for ToolSpec
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