Interface ToolProvider

All Known Implementing Classes:
McpToolProvider
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ToolProvider
A tool provider. It is called when an AI service is invoked and supplies tools for that invocation.

Tools returned in ToolProviderResult will be included in the request to the LLM.

By default, a tool provider is called once at the beginning of an AI service invocation. Override isDynamic() to return true if this provider should be re-evaluated before each LLM call in the tool execution loop. A dynamic provider can return different tools based on the current conversation state.

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Whether this tool provider is dynamic (i.e., should be re-evaluated before each LLM call in the tool execution loop).
    Provides tools for the request to the LLM.
  • Method Details

    • provideTools

      ToolProviderResult provideTools(ToolProviderRequest request)
      Provides tools for the request to the LLM.
      Parameters:
      request - the ToolProviderRequest, contains UserMessage, ChatMemory ID (see MemoryId) and InvocationParameters.
      Returns:
      ToolProviderResult contains tools that should be included in the request to the LLM.
    • isDynamic

      default boolean isDynamic()
      Whether this tool provider is dynamic (i.e., should be re-evaluated before each LLM call in the tool execution loop).

      A static provider (default, returns false) is called once per AI service invocation. A dynamic provider (returns true) has its provideTools(ToolProviderRequest) called before each LLM call, allowing it to return different tools based on the current conversation state.

      Returns:
      true if this provider should be re-evaluated before each LLM call
      Since:
      1.13.0