ConduitMcp.Client.Prompt (ConduitMCP v0.11.0)

Copy Markdown View Source

A prompt listed by a server (prompts/list).

arguments is the list of wire PromptArgument maps (string keys: "name", "title", "description", "required"), keeping only entries that are maps with a string "name". raw keeps the wire map untouched. Prompt argument values sent to prompts/get are always strings.

Summary

Functions

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

Types

t()

@type t() :: %ConduitMcp.Client.Prompt{
  arguments: [map()],
  description: String.t() | nil,
  meta: map(),
  name: String.t(),
  raw: map(),
  server_id: String.t(),
  title: String.t() | nil
}

Functions

from_wire(server_id, raw)

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

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

name must be a string; otherwise the result is a :protocol error with reason :invalid_prompt.

iex> {:ok, prompt} =
...>   ConduitMcp.Client.Prompt.from_wire("docs", %{
...>     "name" => "summarize",
...>     "arguments" => [%{"name" => "topic", "required" => true}]
...>   })
iex> Enum.map(prompt.arguments, & &1["name"])
["topic"]