pub struct ToolDefinition {
pub name: String,
pub description: Option<String>,
pub input_schema: Option<Value>,
pub title: Option<String>,
}Expand description
A tool that the LLM may invoke, expressed as a name + JSON Schema.
This is the agent domain’s own type. Adapter layers are responsible for converting their internal tool representations:
- MCP adapter:
McpTool → ToolDefinition - Built-in tools: constructed directly
The agent domain must not reference McpTool or any crate-external
tool type directly.
Fields§
§name: StringUnique function name exposed to the LLM (e.g. "filesystem_read_file").
description: Option<String>Human-readable description sent to the LLM to explain when to use the tool.
input_schema: Option<Value>JSON Schema object describing the tool’s input parameters.
title: Option<String>Human-readable display title from MCP annotations.title.
When present, surfaces prefer this over the heuristic
format_tool_display_name(). Not serialized to the LLM.
Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Attach a human-readable description.
Sourcepub fn with_input_schema(self, schema: Value) -> Self
pub fn with_input_schema(self, schema: Value) -> Self
Attach a JSON Schema for the tool’s input parameters.
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 (const: unstable) · 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
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnsafeUnpin 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