pub struct Tool {
pub annotations: Option<ToolAnnotations>,
pub description: Option<String>,
pub input_schema: ToolInputSchema,
pub name: String,
}
Expand description
Definition for a tool the client can call.
JSON schema
{
"description": "Definition for a tool the client can call.",
"type": "object",
"required": [
"inputSchema",
"name"
],
"properties": {
"annotations": {
"description": "Optional additional tool information.",
"$ref": "#/definitions/ToolAnnotations"
},
"description": {
"description": "A human-readable description of the tool.\n\nThis can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a \"hint\" to the model.",
"type": "string"
},
"inputSchema": {
"description": "A JSON Schema object defining the expected parameters for the tool.",
"type": "object",
"required": [
"type"
],
"properties": {
"properties": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": true
}
},
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string",
"const": "object"
}
}
},
"name": {
"description": "The name of the tool.",
"type": "string"
}
}
}
Fields§
§annotations: Option<ToolAnnotations>
Optional additional tool information.
description: Option<String>
A human-readable description of the tool.
This can be used by clients to improve the LLM’s understanding of available tools. It can be thought of like a “hint” to the model.
input_schema: ToolInputSchema
§name: String
The name of the tool.
Implementations§
Source§impl Tool
impl Tool
pub fn new(name: &str, input_schema: ToolInputSchema) -> Self
pub fn with_description(self, description: &str) -> Self
pub fn with_annotations(self, annotations: impl Into<ToolAnnotations>) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tool
impl<'de> Deserialize<'de> for Tool
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
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 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