ConduitMcp.Client.DiscoverResult (ConduitMCP v0.11.0)

Copy Markdown View Source

A modern (2026-07-28) server's answer to server/discover.

  • supported_versions - supportedVersions, in the server's order.
  • capabilities - the server's ServerCapabilities, string-keyed.
  • instructions - optional server instructions, or nil.
  • ttl_ms - how long the result may be cached. An absent, negative or non-integer ttlMs reads as 0, as the caching page requires; any upper clamp is the cache's job.
  • cache_scope - :public or :private. Anything else (or absent) reads as :private, the scope that never shares across credentials.
  • server_info - _meta["io.modelcontextprotocol/serverInfo"] as a ConduitMcp.Client.ServerInfo, or nil when absent or malformed (it is a SHOULD, and display-only).
  • meta - the result's _meta, or %{}.
  • raw - the whole string-keyed wire map.

Summary

Functions

Builds a DiscoverResult from a server/discover result map.

Types

t()

@type t() :: %ConduitMcp.Client.DiscoverResult{
  cache_scope: :public | :private,
  capabilities: map(),
  instructions: String.t() | nil,
  meta: map(),
  raw: map(),
  server_info: ConduitMcp.Client.ServerInfo.t() | nil,
  supported_versions: [String.t()],
  ttl_ms: non_neg_integer()
}

Functions

from_wire(raw)

@spec from_wire(term()) :: {:ok, t()} | {:error, ConduitMcp.Client.Error.t()}

Builds a DiscoverResult from a server/discover result map.

supportedVersions must be a list of strings and capabilities an object, and resultType must be absent or "complete"; otherwise the result is a :protocol error with reason :invalid_discover_result.

iex> {:ok, result} =
...>   ConduitMcp.Client.DiscoverResult.from_wire(%{
...>     "resultType" => "complete",
...>     "supportedVersions" => ["2026-07-28"],
...>     "capabilities" => %{"tools" => %{}},
...>     "ttlMs" => 60_000,
...>     "cacheScope" => "public"
...>   })
iex> {result.supported_versions, result.ttl_ms, result.cache_scope}
{["2026-07-28"], 60000, :public}