promoteTextEmittedToolCallMessage
promoteTextEmittedToolCallMessage(
message,options):AIMessage<MessageStructure<MessageToolSet>> |undefined
Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/toolCallRepair/promote.ts:104
Repair one assistant AIMessage: if it has NO native tool_calls but its content is a
standalone text-emitted call (allow-listed, within the payload cap), return a NEW AIMessage that
carries the promoted native tool_calls; otherwise return undefined (the caller keeps the
original, so the native happy path is untouched).
The returned message PRESERVES the original id. That is load-bearing: LangGraph’s message-state
reducer merges by id, so a same-id message REPLACES the original in graph state (rather than
appending a duplicate/dangling assistant message). Content is cleared to ‘’ since the raw
text-call is now represented natively as tool_calls.
Parameters
Section titled “Parameters”message
Section titled “message”AIMessage
options
Section titled “options”Returns
Section titled “Returns”AIMessage<MessageStructure<MessageToolSet>> | undefined