Skip to main content

definition_of

Function definition_of 

Source
pub fn definition_of<T: RustTool>(tool: &T) -> Result<ToolDefinition, ToolError>
Expand description

Build a ToolDefinition from any RustTool implementor.

The generated schema is sanitized for broad compatibility with LLM SDKs that expect "type" to always be a single string (not the array form ["string", "null"] that schemars emits for Option<T> fields).

ยงErrors

Returns Err if the JSON schema serialization fails.