LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Configuration
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsConfigurationTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsmiddlewarepatchDanglingToolCalls
Function●Since v1.6

patchDanglingToolCalls

Patch dangling tool calls in a messages array. Returns the patched messages array and a flag indicating if patching was needed.

Copy
patchDanglingToolCalls(
  messages: BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]
): __type

Parameters

NameTypeDescription
messages*BaseMessage<MessageStructure<MessageToolSet>, MessageType>[]

The messages array to patch

View source on GitHub