MCPcopy Index your code
hub / github.com/TanStack/ai / shouldAutoSend

Method shouldAutoSend

packages/ai-client/src/chat-client.ts:1359–1370  ·  view source on GitHub ↗

* Check if all tool calls are complete and we should auto-send. * Requires that there is at least one tool call in the last assistant message; * a text-only response has nothing to auto-send.

()

Source from the content-addressed store, hash-verified

1357 * a text-only response has nothing to auto-send.
1358 */
1359 private shouldAutoSend(): boolean {
1360 const messages = this.processor.getMessages()
1361 const lastAssistant = messages.findLast(
1362 (m: UIMessage) => m.role === 'assistant',
1363 )
1364 if (!lastAssistant) return false
1365 const hasToolCalls = lastAssistant.parts.some(
1366 (p: MessagePart) => p.type === 'tool-call',
1367 )
1368 if (!hasToolCalls) return false
1369 return this.processor.areAllToolsComplete()
1370 }
1371
1372 /**
1373 * Get current messages

Callers 2

streamResponseMethod · 0.95
checkForContinuationMethod · 0.95

Calls 2

areAllToolsCompleteMethod · 0.80
getMessagesMethod · 0.45

Tested by

no test coverage detected