Skip to main content

Module parse_tool_call

Module parse_tool_call 

Source
Expand description

Parse and validate provider tool calls at the Core boundary.

Rust port of the AI SDK’s parse-tool-call.ts (packages/ai/src/generate-text/parse-tool-call.ts). Providers deliver the model’s raw argument text; Core owns JSON parsing, prototype-pollution rejection, schema validation, and the one-shot repair callback.

Structs§

RawToolCall
Provider-facing tool call before Core parses and validates its input.
ToolCallRepair
Async callback that may replace one invalid tool call.
ToolCallRepairContext
Context supplied to a one-shot tool-call repair callback.

Enums§

ToolCallRepairReply
A host’s answer to one tool-call repair request.

Functions§

apply_tool_call_repair
Resolve one invalid tool call against a host’s repair reply.
apply_tool_call_repair_to_result
Apply a repair reply to a serialized GenerateTextResult or GenerateObjectResult, or StreamTextResultAggregated, returning the patched result.
parse_tool_call
Parse and validate a provider tool call using the AI SDK operation contract.
tool_call_repair_context
Build the repair argument a host needs, as JSON, or None when the call was made without a tool set.
tool_call_repair_inputs
Recover the three repair inputs from the same prompt and options a caller already passed to generate_text / stream_text.