#[non_exhaustive]pub struct ToolDefinition {
pub name: String,
pub description: String,
pub input_schema: Value,
pub tags: Vec<ToolTag>,
pub cache_control: Option<CacheControl>,
}Expand description
Tool description sent to the provider so the model can decide when and how to call it.
ToolDefinition is the wire-level shape; tool implementations
live behind the ailoop-tools Tool / ToolDyn traits and only
produce a ToolDefinition when they are mounted on a
ChatRequest.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringTool name; must match the name the model emits on
crate::AssistantBlock::ToolCall.
description: StringHuman-readable description used by the model to decide when to invoke the tool.
input_schema: ValueJSON Schema (2020-12) for the tool’s input arguments.
Tags consumed by capability gating and approval middleware.
cache_control: Option<CacheControl>Cache breakpoint for this tool entry on providers that support per-tool prompt caching (Anthropic). Adapters without per-tool caching ignore the field.
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn new(
name: &str,
description: &str,
input_schema: Value,
tags: Vec<ToolTag>,
) -> ToolDefinition
pub fn new( name: &str, description: &str, input_schema: Value, tags: Vec<ToolTag>, ) -> ToolDefinition
Build a definition with the given identity, schema, and tags and no cache breakpoint.
Sourcepub fn with_cache_control(self, cache_control: CacheControl) -> ToolDefinition
pub fn with_cache_control(self, cache_control: CacheControl) -> ToolDefinition
Builder-style helper: attach a cache breakpoint to this tool entry.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more