OzMcp.Structs.Prompt (OzMcp v0.9.0)

Copy Markdown View Source

Helper module used to build Prompt structure.

(MCP protocol: 2025-11-25)

Short example:

%Prompt{}
  |> Prompt.name("get_weather")
  |> Prompt.description("Get the weather for a city")
  |> Prompt.build()

Result:

%{name: "get_weather", description: "Get the weather for a city"}

Long example:

%Prompt{}
  |> Prompt.name("get_weather")
  |> Prompt.title("Get the weather")
  |> Prompt.description("Get the weather for a city")
  |> Prompt.arguments([
    %PromptArgument{}
    |> PromptArgument.name("city")
    |> PromptArgument.description("The city name")
    |> PromptArgument.required(true)
  ])
  |> Prompt.icons([
    %Icon{}
    |> Icon.src("https://img.com/icon.png")
    |> Icon.mime_type("image/png")
    |> Icon.sizes(["16x16"])
  ])
  |> Prompt.build()

Result:

%{
  name: "get_weather",
  description: "Get the weather for a city",
  title: "Get the weather",
  arguments: [%{name: "city", description: "The city name", required: true}],
  icons: [
    %{
      src: "https://img.com/icon.png",
      sizes: ["16x16"],
      mimeType: "image/png"
    }
  ]
}

The required_scopes field holds the scopes that a principal must hold to use the prompt. OzMcp uses them for the check of prompts/get and for the filter of prompts/list. They are never sent to the client.

Specification: Prompt

Fields

FieldSetterTypeRequired
namename/2stringyes
titletitle/2stringno
descriptiondescription/2stringno
argumentsarguments/2list of OzMcp.Structs.PromptArgument.t/0no
_meta_meta/2mapno
iconsicons/2list of OzMcp.Structs.Icon.t/0no
required_scopesrequired_scopes/2list of scopes, never sentno
extrasextras/2mapno

Summary

Types

t()

@type t() :: %OzMcp.Structs.Prompt{
  _meta: map() | nil,
  arguments: [OzMcp.Structs.PromptArgument.t()] | nil,
  description: String.t() | nil,
  extras: map() | nil,
  icons: [OzMcp.Structs.Icon.t()] | nil,
  name: String.t(),
  required_scopes: [String.t()],
  title: String.t() | nil
}

Functions

arguments(struct, value)

@spec arguments(t(), [OzMcp.Structs.PromptArgument.t()] | nil) :: t()

build(struct)

@spec build(t()) :: map()

description(struct, value)

@spec description(t(), String.t() | nil) :: t()

extras(struct, value)

@spec extras(t(), map() | nil) :: t()

icons(struct, value)

@spec icons(t(), [OzMcp.Structs.Icon.t()] | nil) :: t()

name(struct, value)

@spec name(t(), String.t()) :: t()

required_scopes(struct, value)

@spec required_scopes(t(), [String.t()]) :: t()

title(struct, value)

@spec title(t(), String.t() | nil) :: t()