Context handed to a tool runner (and, optionally, to tools that opt in) for a single batch.
Tools may declare a second arg ctx :: RunContext.t() on their
run/2 callback to observe cancellation. The runner inspects the
callback's exported arity and passes the context only when the
callback was implemented as run/2-with-ctx vs the legacy
run/1-shape.
Summary
Functions
Signal cancellation. Subsequent cancelled?/1 checks return true.
Returns true if the cancel ref has been signalled.
Construct a new run context.
Types
@type t() :: %Mojentic.LLM.Tools.RunContext{ cancel_ref: reference() | nil, cancelled?: boolean(), correlation_id: String.t() | nil, on_call_complete: (Mojentic.LLM.Tools.ToolCallOutcome.t() -> :ok) | nil, on_call_start: (Mojentic.LLM.Tools.ToolCallExecution.t() -> :ok) | nil, source: String.t() | nil }
Functions
Signal cancellation. Subsequent cancelled?/1 checks return true.
Returns true if the cancel ref has been signalled.
When cancel_ref is an :atomics reference we treat any non-zero
value as cancelled. When nil, always returns false.
Construct a new run context.