Skip to main content

tool_fail

Function tool_fail 

Source
pub fn tool_fail(
    message: impl Into<String>,
    code: Option<String>,
    hint: Option<String>,
) -> Error
Expand description

Build a coded tool-failure Error (parity with Node new ToolError(message, {code, hint})). Throwing this from a safe_tool body produces {success:false, code, error, hint?}; thrown from a classic tool() body, the catch site formats it via format_tool_error as JSON.