prompts/get. Register one with server.prompt(config, handler):
Record<string, string> of the supplied arguments. Required arguments are validated before the handler runs — a missing required argument returns McpError(InvalidParams) without invoking the handler.
Return values
| Returned value | Conversion |
|---|---|
string | Single user text message |
PromptMessage | Wrapped in a one-element array |
PromptMessage[] | Used as-is (multi-turn sequence) |
PromptResult(messages, description?) | Passed through as-is |
PromptMessage.content supports the content types text, image, audio, resource (embedded), and resource_link.
Config fields
| Field | Behavior |
|---|---|
name | Inferred from handler.name when omitted |
title | Human-readable label for UIs |
description | Inferred from the name (camelCase → words) when omitted |
arguments | Array of { name, description?, required? } |
timeout | Per-call timeout in milliseconds |
disabled | Hides the prompt and rejects prompts/get |
auth | Per-prompt authorization check |
Dynamic registration
Prompts can be registered before or afterrun() — adding one to a running server sends notifications/prompts/list_changed automatically.