pub struct ToolDef {
pub name: String,
pub description: String,
pub parameters: Vec<ParamDef>,
}Expand description
A tool definition parsed from a markdown file with YAML frontmatter.
Fields§
§name: String§description: String§parameters: Vec<ParamDef>Implementations§
Source§impl ToolDef
impl ToolDef
Sourcepub fn from_markdown(content: &str) -> Result<Self, String>
pub fn from_markdown(content: &str) -> Result<Self, String>
Parse a tool definition from markdown content with YAML-like frontmatter.
Expected format:
---
name: toolName
description: What the tool does
parameters:
- name: paramName
type: string
description: What the param is
required: true
---
Optional body (ignored for now)Sourcepub fn from_file(path: &Path) -> Result<Self, String>
pub fn from_file(path: &Path) -> Result<Self, String>
Load a tool definition from a markdown file.
Sourcepub fn to_openai_json(&self) -> Value
pub fn to_openai_json(&self) -> Value
Convert to OpenAI-compatible tool JSON.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolDef
impl<'de> Deserialize<'de> for ToolDef
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 ToolDef
impl RefUnwindSafe for ToolDef
impl Send for ToolDef
impl Sync for ToolDef
impl Unpin for ToolDef
impl UnsafeUnpin for ToolDef
impl UnwindSafe for ToolDef
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