Skip to main content

parse_tool_call

Function parse_tool_call 

Source
pub async fn parse_tool_call(
    tool_call: RawToolCall,
    tools: Option<&[Tool]>,
    repair_tool_call: Option<&ToolCallRepair>,
    messages: &[ModelMessage],
    instructions: Option<&str>,
) -> ToolCall
Expand description

Parse and validate a provider tool call using the AI SDK operation contract.

JSON is parsed exactly; partial-JSON repair is deliberately not automatic. When a tool set was supplied, lookup, parsing, or schema validation failure gives the optional repair callback one attempt. As in AI SDK, calls made without a tool set bypass repair. A remaining failure is represented on the returned call so callers retain both the model output and its typed error.