Class InstalledModulesContextSupplier

java.lang.Object
com.inductiveautomation.ignition.designer.ai.context.InstalledModulesContextSupplier
All Implemented Interfaces:
Supplier<String>

public final class InstalledModulesContextSupplier extends Object implements Supplier<String>
Renders a markdown listing of every Ignition module currently installed on the connected gateway, suitable for injection into an AI agent's system prompt via Agent.getAdditionalContext(). Each entry shows the module's qualified id, display name, and version when available.

The list is read from the supplied source on each call, so modules added or removed after construction are reflected.

Example:

InstalledModulesContextSupplier supplier =
    new InstalledModulesContextSupplier(clientContext::getModules);

// In an Agent implementation:
@Override
public Optional<String> getAdditionalContext() {
  return supplier.getOptional();
}
  • Constructor Details

    • InstalledModulesContextSupplier

      public InstalledModulesContextSupplier(Supplier<List<ModuleInfo>> modulesSupplier)
      Creates a supplier backed by the given source.
      Parameters:
      modulesSupplier - source of installed-module info, queried on every render.
  • Method Details

    • get

      public String get()
      Returns the rendered listing of installed modules. Callers folding this into Agent.getAdditionalContext() should prefer getOptional(), which omits the section when no modules are installed.
      Specified by:
      get in interface Supplier<String>
      Returns:
      a markdown listing of installed modules.
    • getOptional

      public Optional<String> getOptional()
      Returns the rendered listing wrapped in an Optional, or Optional.empty() when no modules are reported. Designed to be returned directly from Agent.getAdditionalContext() or composed with other context suppliers.
      Returns:
      the rendered listing if any modules are installed, otherwise empty.