pub struct ToolSpec {
pub name: String,
pub description: String,
pub input_schema: Value,
}Expand description
A tool’s name, purpose, and argument schema.
Fields§
§name: StringThe name a model calls it by — what crate::effect::Effect::Tool
and a crate::message::ContentBlock::ToolUse carry.
description: StringWhat it does — this is the text a model reads to decide whether to call it, so it is prompt, not documentation. Say when to use the tool, not only what it does: trigger conditions measurably raise the rate at which a model reaches for the right one.
input_schema: ValueJSON Schema for the arguments.
inputSchema on the wire (MCP’s spelling), input_schema also
accepted so hand-written JSON in either convention loads.
Implementations§
Source§impl ToolSpec
impl ToolSpec
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
input_schema: Value,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, input_schema: Value, ) -> Self
A fully described tool. For one with nothing to configure, see
Self::no_args.
Sourcepub fn no_args(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn no_args(name: impl Into<String>, description: impl Into<String>) -> Self
A tool taking no arguments.
Sourcepub fn required_args(&self) -> Vec<&str>
pub fn required_args(&self) -> Vec<&str>
The argument names the schema marks required.
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 Freeze for ToolSpec
impl RefUnwindSafe for ToolSpec
impl Send for ToolSpec
impl Sync for ToolSpec
impl Unpin for ToolSpec
impl UnsafeUnpin for ToolSpec
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