pub fn format_tool_error(e: &Error) -> StringExpand description
Error-aware serialization for tool-execution error paths. Replaces e.to_string() at the
sites that hand the model a failure message:
Error::Tool(s)→s(drops the"tool error: "prefix frome.to_string()).Error::ToolExecutionFailed { output, .. }→output(drops the"tool execution failed: "prefix).Error::ToolFail { output, code:None, hint:None, .. }→output.Error::ToolFail { output, code, hint, .. }(either set) → JSON{message, code?, hint?}.- everything else →
e.to_string()(thethiserror-formatted string).