ConduitMcp.Client.Resource (ConduitMCP v0.11.0)

Copy Markdown View Source

A resource listed by a server (resources/list).

raw keeps the string-keyed wire map untouched (including icons and any future keys); the other fields are conveniences lifted from it. uri is the server's string, never parsed or normalized here.

Summary

Functions

Builds a Resource from a wire Resource map listed by server_id.

Types

t()

@type t() :: %ConduitMcp.Client.Resource{
  annotations: map() | nil,
  description: String.t() | nil,
  meta: map(),
  mime_type: String.t() | nil,
  name: String.t(),
  raw: map(),
  server_id: String.t(),
  size: non_neg_integer() | nil,
  title: String.t() | nil,
  uri: String.t()
}

Functions

from_wire(server_id, raw)

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

Builds a Resource from a wire Resource map listed by server_id.

uri and name must be strings; otherwise the result is a :protocol error with reason :invalid_resource.

iex> {:ok, res} =
...>   ConduitMcp.Client.Resource.from_wire("docs", %{"uri" => "file:///a.md", "name" => "a"})
iex> res.uri
"file:///a.md"