Skip to main content

invalid_tool_input_result

Function invalid_tool_input_result 

Source
pub fn invalid_tool_input_result(tool_name: &str, error: &Error) -> ToolResult
Expand description

Synthesise the structured validation-error ToolResult returned to the model when its arguments fail to deserialize into a TypedTool::Input.

Factored out (and pub) so the exact self-correction wording is consistent with TypedToolAdapter and is directly unit-testable. The error is an error ToolResult (not a thrown anyhow::Error): it flows through the normal balanced tool_use / tool_result path so history stays balanced and the model gets a concrete, machine-actionable hint on its next turn.