# `ConduitMcp.Discover`
[🔗](https://github.com/nyo16/conduit_mcp/blob/v0.11.0/lib/conduit_mcp/discover.ex#L1)

Builds the result of `server/discover`, the modern-era method a client uses
to learn which protocol versions, capabilities and instructions a server
has, without a handshake.

`server/discover` is era-exempt: it is served on the modern path even when
the request carries no `_meta` (see `ConduitMcp.Era`), because a client may
call it precisely to find out which era the server speaks. It is
authenticated like every other POST.

The result body is:

  * `"supportedVersions"` — `ConduitMcp.Protocol.supported_versions/0`,
    modern and legacy versions newest first;
  * `"capabilities"` — `ConduitMcp.Capabilities.build/2` with `era:
    :modern` (list-changed notifications and `resources.subscribe` are
    advertised because `subscriptions/listen` delivers them; the tasks
    extension when it is enabled);
  * `"instructions"` — see `instructions/2`; omitted when there are none.

`ConduitMcp.Protocol.Modern` adds `resultType`, the cache hints and the
`serverInfo` `_meta`.

# `instructions`

```elixir
@spec instructions(module(), Plug.Conn.t() | map()) :: String.t() | nil
```

The server's instructions, or `nil`.

The transport's `:instructions` option (resolved into
`conn.private[:instructions]`) wins; otherwise the server module's
`__instructions__/0`, generated by `use ConduitMcp.Server, instructions:`
and by `use ConduitMcp.Endpoint, instructions:`. Only a string counts.
Used for both `server/discover` and the legacy `initialize` result.

# `result`

```elixir
@spec result(module(), Plug.Conn.t() | map()) :: map()
```

The `server/discover` result body for `server_module` on `conn`.

---

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