Phantom.Prompt (phantom v0.1.1)

View Source

The Model Context Protocol (MCP) provides a standardized way for servers to expose prompt templates to clients. Prompts allow servers to provide structured messages and instructions for interacting with language models. Clients can discover available prompts, retrieve their contents, and provide arguments to customize them.

https://modelcontextprotocol.io/specification/2025-03-26/server/prompts

Summary

Functions

Formats the response from an MCP Router to the MCP specification

Types

json()

@type json() :: %{
  :name => String.t(),
  optional(:description) => String.t(),
  optional(:arguments) => %{required(String.t()) => String.t()}
}

t()

@type t() :: %Phantom.Prompt{
  arguments: [Phantom.Prompt.Argument.t()],
  completion_function: atom(),
  description: String.t(),
  function: atom(),
  handler: module(),
  name: String.t()
}

Functions

build(attrs)

@spec build(map() | Keyword.t()) :: t()

response(results, prompt)

Formats the response from an MCP Router to the MCP specification

to_json(prompt)

@spec to_json(t()) :: json()