tool_call_requested


Description:

public signal void tool_call_requested (ToolCall tool_call, ArrayList<Message> return_messages)

Emitted when a tool call is detected and needs to be executed.

For non-agent usage: Connect to this signal to handle tool execution.

The handler is responsible for: 1. Execute the tool: Get the tool from `chat.tools.get(tool_call.function.name)` and call `tool.execute(chat, tool_call)` 2. Create tool reply message: `new Message.tool_reply(tool_call.id, tool_call.function.name, result)` 3. Append it to return_messages: `return_messages.add(tool_reply)`

Chat will collect all tool reply messages and send them automatically.

For agent usage: This signal is not used - agent.execute_tools() is called directly by Chat.toolsReply().

Parameters:

tool_call

The tool call that needs to be executed

return_messages

Array to append tool reply messages to