McpServer.registerDynamicPrompt

Register a *dynamic* prompt whose handler may, on a stateless (MRTR) draft request, ask the client for more input instead of returning a final result.

This is the prompts counterpart of the MRTR registerDynamicTool overload: the handler receives the raw Json arguments and the per-request RequestContext, and returns a PromptResponse — either PromptResponse.complete(result) or, when it needs the client to gather more input, PromptResponse.inputRequired(requests) (optionally with an opaque requestState). On the draft protocol the handler reads the client's answers from ctx.inputResponses() and the echoed ctx.requestState() when the request is resubmitted. The draft schema types GetPromptResultResponse.result as GetPromptResult | InputRequiredResult, which this enables; on the 2025-era protocols a handler simply always completes, so its wire output carries only a plain GetPromptResult.

  1. void registerDynamicPrompt(Prompt descriptor, GetPromptResult delegate(Json) @(safe) handler)
  2. void registerDynamicPrompt(Prompt descriptor, MrtrPromptHandler handler)
    class McpServer
    @safe
    void
    registerDynamicPrompt