Class IntegrationToolProviderResolver

java.lang.Object
com.agentforge4j.runtime.tool.IntegrationToolProviderResolver
All Implemented Interfaces:
ToolProviderResolver

public final class IntegrationToolProviderResolver extends Object implements ToolProviderResolver
The single OSS ToolProviderResolver: it merges two tool sources into one capability index at construction (tool-load) time —
  1. the active IntegrationDefinitions of an IntegrationRepository, each materialized into a ToolProvider via a ToolProviderFactory; and
  2. pre-built ToolProvider instances supplied directly — for example configuration-backed MCP providers supplied by the embedding application, or providers passed to withToolProviders.

Materializing eagerly means MCP connections are established once, when the runtime is assembled, rather than per resolve. It fails fast with CapabilityResolutionException as soon as two sources — in either combination — expose the same capability, naming the capability and both contributing sources, so an ambiguous configuration is rejected up front. It never resolves ambiguity by silent first-wins; resolve(java.lang.String, com.agentforge4j.core.spi.tool.ToolScope) is then an O(1) lookup.

The merged set is read once at construction. Rebuilding the index when integrations change (reload) is wired by a later phase; this resolver holds an immutable snapshot.

  • Constructor Details

    • IntegrationToolProviderResolver

      public IntegrationToolProviderResolver(IntegrationRepository repository, ToolProviderFactory factory, List<ToolProvider> preBuiltProviders)
      Merges the repository's active integrations and the supplied pre-built providers into one capability index, rejecting cross-source duplicates up front.
      Parameters:
      repository - source of active integrations; never null (may be empty)
      factory - realises each active integration as a tool provider; never null
      preBuiltProviders - providers supplied directly, not via the repository; never null (may be empty)
      Throws:
      CapabilityResolutionException - if two sources expose the same capability
  • Method Details