pub struct Tool {
pub name: String,
pub description: Option<String>,
pub input_schema: ToolInputSchema,
pub title: Option<String>,
pub icons: Option<Vec<Icon>>,
pub annotations: Option<ToolAnnotations>,
pub execution: Option<ToolExecution>,
pub output_schema: Option<ToolOutputSchema>,
pub meta: Option<HashMap<String, Value>>,
}Expand description
Tool definition.
Describes a callable tool with its input schema and metadata.
Fields§
§name: StringTool name (machine-readable identifier)
description: Option<String>Tool description
input_schema: ToolInputSchemaJSON Schema for input parameters
title: Option<String>Human-readable title
icons: Option<Vec<Icon>>Tool icons
annotations: Option<ToolAnnotations>Tool annotations (hints about behavior)
execution: Option<ToolExecution>Tool execution properties
output_schema: Option<ToolOutputSchema>Output schema for structured results
meta: Option<HashMap<String, Value>>Extension metadata (tags, version, etc.)
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn new(name: impl Into<String>, description: impl Into<String>) -> Tool
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Tool
Create a new tool with name and description.
Sourcepub fn with_schema(self, schema: ToolInputSchema) -> Tool
pub fn with_schema(self, schema: ToolInputSchema) -> Tool
Set the input schema.
Sourcepub fn with_output_schema(self, schema: ToolOutputSchema) -> Tool
pub fn with_output_schema(self, schema: ToolOutputSchema) -> Tool
Set the output schema.
Sourcepub fn with_annotations(self, annotations: ToolAnnotations) -> Tool
pub fn with_annotations(self, annotations: ToolAnnotations) -> Tool
Set the annotations.
Sourcepub fn with_execution(self, execution: ToolExecution) -> Tool
pub fn with_execution(self, execution: ToolExecution) -> Tool
Set tool execution properties.
Sourcepub fn destructive(self) -> Tool
pub fn destructive(self) -> Tool
Mark as destructive (hint for clients).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tool
impl<'de> Deserialize<'de> for Tool
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tool, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Tool, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Tool
impl Serialize for Tool
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
impl StructuralPartialEq for Tool
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl UnwindSafe for Tool
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