Learn R Programming

aisdk (version 1.1.0)

repair_tool_call: Repair Tool Call

Description

Attempts to repair a failed tool call. This implements a multi-layer repair strategy inspired by Opencode's experimental_repairToolCall:

  1. Try to fix tool name case issues (e.g., "GetWeather" -> "get_weather")

  2. If repair fails, route to an "invalid" tool for graceful handling

Usage

repair_tool_call(tool_call, tools, error_message = NULL)

Value

A repaired tool call list, or an "invalid" tool call if unrepairable.

Arguments

tool_call

A list with name, arguments, and optionally id.

tools

A list of available Tool objects.

error_message

Optional error message from the failed call.