pub async fn complete_provider_with_tools<F>(
handler: Arc<dyn ExtensionHandler>,
params: ProviderCompleteParams,
registry: &ToolRegistry,
session_tools: &SessionToolSet,
hook_bus: &Arc<HookBus>,
context_factory: F,
max_tool_output: usize,
max_iterations: usize,
tools_requested: &mut u32,
) -> Result<ProviderCompleteResult, String>where
F: FnMut() -> ToolContext,Expand description
Interior extension-provider tool loop. session_tools is built ONCE by
the caller (under the same registry read guard passed as registry) and
reused for every tool call in every interior round — the registry stays
read-locked for the whole outer provider call, so no catalog drift is
possible inside this loop and one set snapshot governs all rounds.