MCPcopy Create free account
hub / github.com/OpenOSINT/OpenOSINT / _process_ollama_tool_turn

Function _process_ollama_tool_turn

openosint/agent.py:458–470  ·  view source on GitHub ↗

Execute all tool calls from one Ollama response and append results to messages.

(
    ctx: _AgentRunContext,
    ollama_msg: Any,
)

Source from the content-addressed store, hash-verified

456
457
458async def _process_ollama_tool_turn(
459 ctx: _AgentRunContext,
460 ollama_msg: Any,
461) -> None:
462 """Execute all tool calls from one Ollama response and append results to messages."""
463 ctx.messages.append(_build_ollama_assistant_message(ollama_msg))
464 for ollama_tool_call in ollama_msg.tool_calls:
465 tool_name = ollama_tool_call.function.name
466 tool_input = dict(ollama_tool_call.function.arguments)
467 result = await _execute_tool(tool_name, tool_input, ctx.on_tool_call)
468 ctx.tool_calls.append(ToolCall(name=tool_name, input=tool_input, result=result))
469 logger.info("Ollama tool executed: %s → %d chars", tool_name, len(result))
470 ctx.messages.append({"role": "tool", "content": result})
471
472
473# ---------------------------------------------------------------------------

Callers 1

runMethod · 0.85

Calls 3

_execute_toolFunction · 0.85
ToolCallClass · 0.85

Tested by

no test coverage detected