Module agentforge4j.runtime
Package com.agentforge4j.runtime.tool
Class IntegrationToolProviderResolver
java.lang.Object
com.agentforge4j.runtime.tool.IntegrationToolProviderResolver
- All Implemented Interfaces:
ToolProviderResolver
The single OSS
ToolProviderResolver: it merges two tool sources into one capability index
at construction (tool-load) time —
- the active
IntegrationDefinitions of anIntegrationRepository, each materialized into aToolProvidervia aToolProviderFactory; and - pre-built
ToolProviderinstances supplied directly — for example configuration-backed MCP providers supplied by the embedding application, or providers passed towithToolProviders.
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 Summary
ConstructorsConstructorDescriptionIntegrationToolProviderResolver(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. -
Method Summary
Modifier and TypeMethodDescriptionLists the descriptors available within the given scope.Resolves a capability to its provider and descriptor for the given scope.
-
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; nevernull(may be empty)factory- realises each active integration as a tool provider; nevernullpreBuiltProviders- providers supplied directly, not via the repository; nevernull(may be empty)- Throws:
CapabilityResolutionException- if two sources expose the same capability
-
-
Method Details
-
resolve
Description copied from interface:ToolProviderResolverResolves a capability to its provider and descriptor for the given scope.- Specified by:
resolvein interfaceToolProviderResolver- Parameters:
capability- non-blank capability idscope- workflow/run scope used by binding-aware resolvers- Returns:
- the resolved tool
-
available
Description copied from interface:ToolProviderResolverLists the descriptors available within the given scope.- Specified by:
availablein interfaceToolProviderResolver- Parameters:
scope- workflow/run scope- Returns:
- descriptors available within
scope
-