pub fn safe_tool<F, Fut>(
name: impl Into<CompactString>,
description: impl Into<String>,
parameters: Value,
f: F,
) -> RegisteredToolExpand description
RegisteredTool::text equivalent that wraps the body in a structured envelope. The body
returns either:
Ok(envelope)produced byok(data)/fail(code, msg, hint)— passed throughOk(value)of any otherValue— auto-wrapped asok(value)Err(crate::Error::ToolFail{..})— converted tofailenvelope with the carried code/hintErr(other)— converted to{success:false, code:"internal", error: format_tool_error(...)}