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

Helper module used to build `GetPromptResult` structure.

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

## Short example:

```elixir
%GetPromptResult{}
  |> GetPromptResult.messages([
    %PromptMessage{}
    |> PromptMessage.role(:user)
    |> PromptMessage.content(
      %TextContent{}
      |> TextContent.text("Hello, world!")
    )
  ])
  |> GetPromptResult.build()
```

Result:

```elixir
%{
  messages: [
    %{"content" => %{type: "text", text: "Hello, world!"}, "role" => "user"}
  ]
}
```

## Long example:

```elixir
%GetPromptResult{}
  |> GetPromptResult.description("Get the weather for a city")
  |> GetPromptResult.messages([
    %PromptMessage{}
    |> PromptMessage.role(:user)
    |> PromptMessage.content(
      %TextContent{}
      |> TextContent.text("What is the weather in Paris?")
    ),
    %PromptMessage{}
    |> PromptMessage.role(:assistant)
    |> PromptMessage.content(
      %TextContent{}
      |> TextContent.text("The weather in Paris is sunny.")
    )
  ])
  |> GetPromptResult.build()
```

Result:

```elixir
%{
  messages: [
    %{
      "content" => %{type: "text", text: "What is the weather in Paris?"},
      "role" => "user"
    },
    %{
      "content" => %{type: "text", text: "The weather in Paris is sunny."},
      "role" => "assistant"
    }
  ],
  description: "Get the weather for a city"
}
```

Specification: [GetPromptResult](https://modelcontextprotocol.io/specification/2025-11-25/schema#getpromptresult)

## Fields

| Field | Setter | Type | Required |
|---|---|---|---|
| `messages` | `messages/2` | messages() | yes |
| `description` | `description/2` | string | no |
| `_meta` | `_meta/2` | map | no |

# `messages`

```elixir
@type messages() ::
  OzMcp.Structs.Types.list_of(%OzMcp.Structs.PromptMessage{
    content: term(),
    role: term()
  })
```

# `t`

```elixir
@type t() :: %OzMcp.Structs.GetPromptResult{
  _meta: map() | nil,
  description: String.t() | nil,
  messages: messages()
}
```

# `build`

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

# `description`

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

# `messages`

```elixir
@spec messages(t(), messages()) :: t()
```

---

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