INT
Nov 25

Tool Call Repair

Repair invalid tool calls using experimental_repairToolCall. Fix schema validation errors without requiring additional steps that pollute message history.

View Full Pattern on Desktop
Tool Call Repair preview

Problems Solved

  • Repair invalid tool calls automatically
  • Fix schema validation errors without additional steps
  • Handle tool call failures gracefully
  • Use structured outputs for repair

Use Cases

  • Handling invalid tool calls from smaller models
  • Repairing complex schema validation errors
  • Automatic tool call error recovery
  • Improving tool call success rate

AI SDK APIs

streamTextconvertToModelMessagestool(useChatexperimental_repairToolCallgenerateObjectNoSuchToolError

Tags

aitoolstool-call-repairexperimental-repairToolCallschema-validationerror-handlingai-sdktool-api

Requirements

Node.js
18+
Memory
512MB
Other
  • OpenAI API key

Environment Variables

External Services

openai

Ready to use?

View the full interactive pattern with live preview and copy the source code.

View Pattern on Desktop
End of Pattern