MCP prompt discovery and retrieval. Supports listing prompt templates and rendering prompts with arguments.
Functions
collect-pages
fn (session: ::mcp::types/Session, cursor: Str?, acc: Vec): Vec
get-prompt
fn (session: ::mcp::types/Session, name: Str, arguments: Map?): Vec<::mcp::types/PromptMessage>
Get a prompt from the MCP server by name, optionally with arguments.
Returns a Vec of PromptMessage (role + content pairs). Each message has
a role ("user" or "assistant") and content map.
Example
::prompts ::mcp::prompts
messages ::prompts/get-prompt(session, "code-review", {language: "hot", code: "add(1, 2)"})
message first(messages)
message.role // => "user"
message.content // => {type: "text", text: "Please review..."}
// With no arguments
messages ::prompts/get-prompt(session, "greeting", {})
get-result
fn (session: ::mcp::types/Session, name: Str, arguments: Map?): Map
Get a prompt and retain modern result type, MRTR, and metadata fields.
get-with-input
fn (session: ::mcp::types/Session, name: Str, arguments: Map?, handler: Fn, max-rounds: Int): Vec<::mcp::types/PromptMessage>
Get a prompt while fulfilling modern Multi Round-Trip input requests.
list
fn (session: ::mcp::types/Session): Vec<::mcp::types/Prompt>
List prompts available on the MCP server (first page).
Returns a Vec of Prompt, each with name, description, and arguments fields.
Example
::prompts ::mcp::prompts
prompts ::prompts/list(session)
// prompts => [{name: "code-review", description: "...", arguments: [...]}, ...]
first(prompts).name // => "code-review"
list-all
fn (session: ::mcp::types/Session): Vec<::mcp::types/Prompt>
List all prompts across all pages, following pagination automatically.
Follows nextCursor links until all pages are exhausted. Returns a
single Vec containing every prompt.
Example
::prompts ::mcp::prompts
all-prompts ::prompts/list-all(session)
length(all-prompts) // => total number of prompts across all pages
list-page
fn (session: ::mcp::types/Session, cursor: Str?): Map
List prompts with an explicit cursor for manual pagination.
Returns a Map with prompts (Vec of Prompt) and next-cursor (Str or null).
Pass null as the cursor for the first page.
Example
::prompts ::mcp::prompts
page ::prompts/list-page(session, null)
page.prompts // => [{name: "code-review", ...}, ...]
page.next-cursor // => "cursor-abc" or null