Class DefaultCompletionRegistry

java.lang.Object
dev.tachyonmcp.core.server.features.completions.DefaultCompletionRegistry
All Implemented Interfaces:
Completions, CompletionRegistry

@InternalApi public class DefaultCompletionRegistry extends Object implements CompletionRegistry
Registry of completion handlers, keyed independently by prompt name and by resource URI/template.
  • Constructor Details

    • DefaultCompletionRegistry

      public DefaultCompletionRegistry()
    • DefaultCompletionRegistry

      public DefaultCompletionRegistry(Mode mode)
  • Method Details

    • registerForPrompt

      public Completions registerForPrompt(String promptName, CompletionFn fn)
      Description copied from interface: Completions
      Registers a completion function for a prompt's arguments.
      Specified by:
      registerForPrompt in interface Completions
      Parameters:
      promptName - the prompt name, as declared in its PromptDescriptor
      fn - the completion function
      Returns:
      this registry
    • registerForPromptAsync

      public Completions registerForPromptAsync(String promptName, AsyncCompletionFn fn)
      Description copied from interface: Completions
      Registers an asynchronous completion function for a prompt's arguments.
      Specified by:
      registerForPromptAsync in interface Completions
      Parameters:
      promptName - the prompt name
      fn - the asynchronous completion function
      Returns:
      this registry
    • registerForResource

      public Completions registerForResource(String uriOrTemplate, CompletionFn fn)
      Description copied from interface: Completions
      Registers a completion function for a resource or resource-template's variables.
      Specified by:
      registerForResource in interface Completions
      Parameters:
      uriOrTemplate - the resource URI, or the resource template's uriTemplate
      fn - the completion function
      Returns:
      this registry
    • registerForResourceAsync

      public Completions registerForResourceAsync(String uriOrTemplate, AsyncCompletionFn fn)
      Description copied from interface: Completions
      Registers an asynchronous completion function for a resource or resource-template's variables.
      Specified by:
      registerForResourceAsync in interface Completions
      Parameters:
      uriOrTemplate - the resource URI, or the resource template's uriTemplate
      fn - the asynchronous completion function
      Returns:
      this registry
    • unregisterForPrompt

      public boolean unregisterForPrompt(String promptName)
      Description copied from interface: Completions
      Removes the completion function registered for the specified prompt name.
      Specified by:
      unregisterForPrompt in interface Completions
      Parameters:
      promptName - the prompt name
      Returns:
      true if a function was removed, false otherwise
    • unregisterForResource

      public boolean unregisterForResource(String uriOrTemplate)
      Description copied from interface: Completions
      Removes the completion function registered for the specified resource URI or template.
      Specified by:
      unregisterForResource in interface Completions
      Parameters:
      uriOrTemplate - the resource URI or template
      Returns:
      true if a function was removed, false otherwise
    • isEmpty

      public boolean isEmpty()
      Returns whether no completion handlers are registered.
      Specified by:
      isEmpty in interface CompletionRegistry