Helper module used to build GetPromptResult structure.
(MCP protocol: 2025-11-25)
Short example:
%GetPromptResult{}
|> GetPromptResult.messages([
%PromptMessage{}
|> PromptMessage.role(:user)
|> PromptMessage.content(
%TextContent{}
|> TextContent.text("Hello, world!")
)
])
|> GetPromptResult.build()Result:
%{
messages: [
%{"content" => %{type: "text", text: "Hello, world!"}, "role" => "user"}
]
}Long example:
%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:
%{
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
Fields
| Field | Setter | Type | Required |
|---|---|---|---|
messages | messages/2 | messages() | yes |
description | description/2 | string | no |
_meta | _meta/2 | map | no |