pub async fn execute_action_tool(
conn: &mut PgConnection,
app_config: &ApplicationConfiguration,
tool_call: &ChatbotConversationMessageToolCall,
answer: &ClientToolAnswer,
user_context: &ChatbotTurnContext,
) -> ChatbotResult<ActionToolOutcome>Expand description
Runs the confirmed (or records the declined) action tool call the LLM asked for.
tool_call’s row id is stored on the audit row so it traces back to the conversation.
The tool’s category and its call requirements are both re-checked here, immediately
before the mutation, rather than trusted from whatever planned the call: the proof
ConfirmableActionTool::execute requires can only be minted by that check.
Fails with ChatbotErrorType::InvalidToolAnswer when answer is not a
ConfirmAnswer, with ChatbotErrorType::ToolUseError when the caller may no longer
use the tool, and with ChatbotErrorType::InvalidToolName when no action tool goes by
tool_call’s name. A declined answer never touches the database beyond what the
caller writes for the closed call itself, and needs no authorization of its own.