pub struct ToolSchema {
pub name: String,
pub description: String,
pub parameters: Value,
pub dangerous: bool,
pub metadata: HashMap<String, Value>,
pub required_scopes: Vec<String>,
}Expand description
Tool/function schema for LLM function calling
Fields§
§name: StringTool name
description: StringTool description
parameters: ValueInput parameters schema (JSON Schema)
dangerous: boolWhether tool is dangerous and requires confirmation
metadata: HashMap<String, Value>Tool metadata
required_scopes: Vec<String>Scopes required to execute this tool (e.g. “fs:read”, “network:external”) Empty means no scope restrictions — tool is always allowed.
Implementations§
Source§impl ToolSchema
impl ToolSchema
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn with_required_scopes(self, scopes: Vec<String>) -> Self
pub fn with_parameters(self, parameters: Value) -> Self
pub fn with_dangerous(self, dangerous: bool) -> Self
pub fn add_metadata(self, key: impl Into<String>, value: Value) -> Self
Trait Implementations§
Source§impl Clone for ToolSchema
impl Clone for ToolSchema
Source§fn clone(&self) -> ToolSchema
fn clone(&self) -> ToolSchema
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 ToolSchema
impl Debug for ToolSchema
Source§impl<'de> Deserialize<'de> for ToolSchema
impl<'de> Deserialize<'de> for ToolSchema
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 ToolSchema
impl RefUnwindSafe for ToolSchema
impl Send for ToolSchema
impl Sync for ToolSchema
impl Unpin for ToolSchema
impl UnsafeUnpin for ToolSchema
impl UnwindSafe for ToolSchema
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