Skip to main content

from_fn_simple

Function from_fn_simple 

Source
pub fn from_fn_simple<I, O, F, Fut>(
    name: &str,
    description: &str,
    handler: F,
) -> AppResult<Box<dyn Callable>>
where I: DeserializeOwned + JsonSchema + Send + 'static, O: Serialize + Send + 'static, F: Fn(I) -> Fut + Send + Sync + 'static, Fut: Future<Output = AppResult<O>> + Send + 'static,
Expand description

Convenience: create a tool from a simpler handler that returns a Serialize type.

The handler takes only the input (no Context) and returns AppResult<O>. The output is automatically serialized to JSON.