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>) -> Self
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new tool schema.
Sourcepub fn with_positional_mapping(self) -> Self
pub fn with_positional_mapping(self) -> Self
Enable positional→named parameter mapping for MCP/external tools.
Sourcepub fn param(self, param: ParamSchema) -> Self
pub fn param(self, param: ParamSchema) -> Self
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 moreAuto Trait Implementations§
impl Freeze for ToolSchema
impl RefUnwindSafe for ToolSchema
impl Send for ToolSchema
impl Sync for ToolSchema
impl Unpin 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