McpServer.registerResourceTemplate

Register a resource template with a reader receiving the matched URI and captured {var} parameters. An optional per-template draft CacheableResult freshness hint is emitted on a matching resources/read (draft only).

This is the context-less form; for a reader that needs the per-request RequestContext (logging, cancellation, elicitation) use the overload taking a (string, string[string], RequestContext) reader.

  1. void registerResourceTemplate(ResourceTemplate descriptor, ResourceContents delegate(string uri, string[string] params) @(safe) reader, Nullable!CacheHint cache)
    class McpServer
    @safe
    void
    registerResourceTemplate
    (,
    ResourceContents delegate
    (
    string uri
    ,
    string[string] params
    )
    @safe
    reader
    ,
    Nullable!CacheHint cache = Nullable!CacheHint.init
    )
  2. void registerResourceTemplate(ResourceTemplate descriptor, TemplateReader reader, Nullable!CacheHint cache)