pub struct ToolSchema {
pub name: String,
pub description: String,
pub params: Vec<ParamSchema>,
pub examples: Vec<Example>,
pub map_positionals: bool,
}Expand description
Schema describing a tool’s interface.
Fields§
§name: StringTool name.
description: StringShort description.
params: Vec<ParamSchema>Parameter definitions.
examples: Vec<Example>Usage examples.
map_positionals: boolMap remaining positional args to named params by schema order. Only for MCP/external tools that expect named JSON params. Builtins handle their own positionals and should leave this false.
Implementations§
Source§impl ToolSchema
impl ToolSchema
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
) -> ToolSchema
pub fn new( name: impl Into<String>, description: impl Into<String>, ) -> ToolSchema
Create a new tool schema.
Sourcepub fn with_positional_mapping(self) -> ToolSchema
pub fn with_positional_mapping(self) -> ToolSchema
Enable positional->named parameter mapping for MCP/external tools.
Sourcepub fn param(self, param: ParamSchema) -> ToolSchema
pub fn param(self, param: ParamSchema) -> ToolSchema
Add a parameter to the schema.
Trait Implementations§
Source§impl Clone for ToolSchema
impl Clone for ToolSchema
Source§fn clone(&self) -> ToolSchema
fn clone(&self) -> ToolSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolSchema
impl Debug for ToolSchema
Source§impl<'de> Deserialize<'de> for ToolSchema
impl<'de> Deserialize<'de> for ToolSchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ToolSchema
impl Serialize for ToolSchema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ToolSchema
impl RefUnwindSafe for ToolSchema
impl Send for ToolSchema
impl Sync for ToolSchema
impl Unpin for ToolSchema
impl UnsafeUnpin for ToolSchema
impl UnwindSafe for ToolSchema
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