# `Mojentic.LLM.Tools.RunContext`
[🔗](https://github.com/svetzal/mojentic-ex/blob/v1.5.0/lib/mojentic/llm/tools/run_context.ex#L1)

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.

# `t`

```elixir
@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() -&gt; :ok) | nil,
  on_call_start: (Mojentic.LLM.Tools.ToolCallExecution.t() -&gt; :ok) | nil,
  source: String.t() | nil
}
```

# `cancel`

Signal cancellation. Subsequent `cancelled?/1` checks return true.

# `cancelled?`

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.

# `new`

Construct a new run context.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
