Skip to main content

validate_tool_input

Function validate_tool_input 

Source
pub fn validate_tool_input<Input>(
    tool_name: &str,
    raw: Value,
) -> Result<Input, ToolResult>
where Input: DeserializeOwned,
Expand description

Deserialize raw model args into a typed Input, or synthesise the structured validation-error result.

Returns Ok(typed) for the happy path and Err(result) carrying the balanced error ToolResult for the self-correction path. TypedToolAdapter uses this to ensure TypedTool::execute is never reached with invalid arguments.

ยงErrors

Returns the synthesised error ToolResult when raw does not deserialize into Input.