# `ExAthena.ToolContext`
[🔗](https://github.com/udin-io/ex_athena/blob/v0.7.1/lib/ex_athena/tool_context.ex#L1)

Context handed to every tool execution.

Carries the working directory the loop should treat as root, the current
permission mode, the session id (if any), and a free-form `assigns` map for
custom tools to stash arbitrary data the consumer needs (project id,
conversation id, ticket id — whatever the host cares about).

Tools that don't care about context can ignore it, but `cwd` and `phase`
are load-bearing for any tool that touches the filesystem or checks
permissions.

# `phase`

```elixir
@type phase() :: :plan | :default | :accept_edits | :trusted | :bypass_permissions
```

# `t`

```elixir
@type t() :: %ExAthena.ToolContext{
  assigns: map(),
  cwd: Path.t(),
  phase: phase(),
  session_id: String.t() | nil,
  tool_call_id: String.t() | nil
}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

Build a context. `:cwd` is required; everything else defaults.

# `resolve_path`

```elixir
@spec resolve_path(t(), String.t()) :: {:ok, Path.t()} | {:error, term()}
```

Resolve a user-supplied relative path against `ctx.cwd`, rejecting traversal.

---

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