# `OzMcp.Structs.Prompt`
[🔗](https://github.com/oz-elixir/oz_mcp/blob/v0.9.0/lib/oz_mcp/structs/prompt.ex#L1)

Helper module used to build `Prompt` structure.

_(MCP protocol: 2025-11-25)_

## Short example:

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

Result:

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

## Long example:

```elixir
%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:

```elixir
%{
  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](https://modelcontextprotocol.io/specification/2025-11-25/schema#prompt)

## Fields

| Field | Setter | Type | Required |
|---|---|---|---|
| `name` | `name/2` | string | yes |
| `title` | `title/2` | string | no |
| `description` | `description/2` | string | no |
| `arguments` | `arguments/2` | list of `t:OzMcp.Structs.PromptArgument.t/0` | no |
| `_meta` | `_meta/2` | map | no |
| `icons` | `icons/2` | list of `t:OzMcp.Structs.Icon.t/0` | no |
| `required_scopes` | `required_scopes/2` | list of scopes, never sent | no |
| `extras` | `extras/2` | map | no |

# `t`

```elixir
@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
}
```

# `arguments`

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

# `build`

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

# `description`

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

# `extras`

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

# `icons`

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

# `name`

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

# `required_scopes`

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

# `title`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
