Class DefaultPromptRegistry

java.lang.Object
dev.tachyonmcp.core.server.features.AbstractRegistry<PromptDescriptor,dev.tachyonmcp.core.server.features.prompts.PromptEntry>
dev.tachyonmcp.core.server.features.prompts.DefaultPromptRegistry
All Implemented Interfaces:
Prompts, PromptRegistry

@InternalApi public class DefaultPromptRegistry extends AbstractRegistry<PromptDescriptor,dev.tachyonmcp.core.server.features.prompts.PromptEntry> implements PromptRegistry
  • Constructor Details

    • DefaultPromptRegistry

      public DefaultPromptRegistry(FeatureConfig config)
      Creates a prompt registry with the given feature configuration. `@param` config the feature configuration governing registry behavior and page size
  • Method Details

    • register

      public Prompts register(PromptDescriptor descriptor, PromptFn fn)
      Registers a prompt unless prompt support is disabled by the configured mode.
      Specified by:
      register in interface Prompts
      Parameters:
      descriptor - the prompt descriptor to register
      fn - the prompt function
      Returns:
      this registry
    • registerAsync

      public Prompts registerAsync(PromptDescriptor descriptor, AsyncPromptFn fn)
      Description copied from interface: Prompts
      Registers a prompt with an asynchronous function.
      Specified by:
      registerAsync in interface Prompts
      Parameters:
      descriptor - the prompt descriptor
      fn - the asynchronous prompt function
      Returns:
      the prompt registry
    • unregister

      public boolean unregister(String name)
      Removes the registered prompt with the specified name.
      Specified by:
      unregister in interface Prompts
      Parameters:
      name - the name of the prompt to remove
      Returns:
      true if a prompt was removed, false if no matching prompt was registered
    • find

      public Optional<PromptDescriptor> find(String name)
      Finds a registered prompt descriptor by name.
      Specified by:
      find in interface Prompts
      Parameters:
      name - the prompt name
      Returns:
      the matching prompt descriptor, or an empty optional if no prompt is registered with that name
    • descriptors

      public List<PromptDescriptor> descriptors()
      Returns all registered prompt descriptors sorted by name.
      Specified by:
      descriptors in interface Prompts
      Returns:
      the registered prompt descriptors in ascending name order