handleFunctionCalls

suspend fun handleFunctionCalls(functionCalls: List<FunctionCall>, tools: Map<String, BaseTool>, filters: Set<String> = emptySet(), toolConfirmations: Map<String, ToolConfirmation>? = null): Event?

Processes a list of function calls by executing them efficiently and safely.

This handles parallel execution, argument conversion, error processing, and merging all resulting EventActions and standard outputs.

Return

A single merged Event containing all responses and actions, or null if no tools executed.

Parameters

functionCalls

List of FunctionCall instances to process.

tools

A mapping from tool name to the available BaseTool instance.

filters

Optional set of specific function call IDs to process; others will be skipped.

toolConfirmations

Map of user-approved confirmations per function call ID.