# `ExMCP.Server.HandlerBridge`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/server/handler_bridge.ex#L1)

Normalizes `ExMCP.Server.Handler` callback returns into canonical
`c:GenServer.handle_call/3` replies.

`use ExMCP.Server.Handler` injects a thin `handle_call/3` clause per MCP
message that delegates here. Handler authors may answer with any of the
historical shapes (`{:ok, result, state}`, `{:ok, result}`, `{:ok, state}`,
`{:error, reason, state}`, `{:error, reason}`); this module collapses them so
callers such as the HTTP message processor see exactly one
shape and handler state never leaks into a reply (audit M13):

  * `{:ok, result}` for single-result calls
  * `{:ok, entries, next_cursor}` for paginated list calls
  * `{:error, reason}` for failures

Keeping the bodies here also keeps the generated `__using__` block small and
makes the bridge directly testable.

# `reply`

```elixir
@type reply() :: {:reply, term(), state()}
```

# `state`

```elixir
@type state() :: term()
```

# `ack`

```elixir
@spec ack(module(), atom(), [term()], state()) :: reply()
```

Invokes a callback whose success carries no meaningful result
(subscriptions, log level), replying `{:ok, result_or_empty_map}`.

# `call`

```elixir
@spec call(module(), atom(), [term()], state()) :: reply()
```

Invokes a callback that answers with a single result.

# `list`

```elixir
@spec list(module(), atom(), [term()], state()) :: reply()
```

Invokes a paginated list callback, replying `{:ok, entries, next_cursor}`.

---

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