# `Snodo.Component.Wrap`
[🔗](https://github.com/joshrotenberg/snodo/blob/v0.4.1/lib/snodo/component/wrap.ex#L1)

Opt-in middleware for one tool, resource, or prompt callback.

A component declares `wrap: [MyWrapper, {AnotherWrapper, option: value}]`.
Each wrapper implements `call/4`. The first declared wrapper runs first and
receives a continuation that calls the next wrapper with a context and
arguments. A wrapper may call that continuation, replace the context or
arguments, or return a result without invoking the handler.

The options passed to `call/4` include the declaration's options plus
`:component`, `:kind`, `:operation`, and `:slot`. Those keys identify the
component and wrapper occurrence. Resource and prompt wrappers also run on
an explicitly defined `complete/2` callback. Middleware runs inside the
component callback, after router lookup, authorization, and input validation.

# `continuation`

```elixir
@type continuation() :: (Snodo.Context.t(), term() -&gt; term())
```

# `kind`

```elixir
@type kind() :: :tool | :resource | :prompt
```

# `call`

```elixir
@callback call(Snodo.Context.t(), term(), continuation(), keyword()) :: term()
```

Runs one middleware layer and may call the continuation or return a result.

---

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