pub struct ToolDefinition {
pub name: String,
pub description: String,
pub parameters: JsonSchema,
pub retry: Option<ToolRetryConfig>,
}Expand description
A tool the model can invoke during generation.
Providers translate this into their native tool format.
Fields§
§name: StringThe tool’s name, used to match ToolCall::name.
description: StringHuman-readable description shown to the model so it knows when to use this tool.
parameters: JsonSchemaJSON Schema describing the tool’s expected input.
retry: Option<ToolRetryConfig>Optional retry configuration for this tool.
When present, failed tool executions will be automatically retried with exponential backoff. This is a runtime-only setting — it is not serialized (skipped during serde) because it’s not part of the tool schema sent to the LLM.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
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 ToolDefinition
impl Debug for ToolDefinition
Source§impl<'de> Deserialize<'de> for ToolDefinition
impl<'de> Deserialize<'de> for ToolDefinition
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
Source§impl PartialEq for ToolDefinition
impl PartialEq for ToolDefinition
Source§impl Serialize for ToolDefinition
impl Serialize for ToolDefinition
impl StructuralPartialEq for ToolDefinition
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl !RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl !UnwindSafe for ToolDefinition
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