Interface ToolInjection

All Known Implementing Classes:
ShellToolAgentHook

public interface ToolInjection
Interface for hooks that need a specific tool injected. Hooks implementing this interface can declare which tool they need, and the framework will automatically inject the matching tool.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Get the required tool name that this hook needs.
    default Class<? extends org.springframework.ai.tool.ToolCallback>
    Get the required tool type (class) that this hook needs.
    void
    injectTool(org.springframework.ai.tool.ToolCallback tool)
    Inject a tool into the hook.
  • Method Details

    • injectTool

      void injectTool(org.springframework.ai.tool.ToolCallback tool)
      Inject a tool into the hook. Only the tool matching the required tool name or type will be injected.
      Parameters:
      tool - the tool callback to inject
    • getRequiredToolName

      default String getRequiredToolName()
      Get the required tool name that this hook needs. Return null to match by tool type instead.
      Returns:
      the tool name required by this hook, or null to match by type
    • getRequiredToolType

      default Class<? extends org.springframework.ai.tool.ToolCallback> getRequiredToolType()
      Get the required tool type (class) that this hook needs. Return null to match by tool name instead. If both name and type are null, the first available tool will be injected.
      Returns:
      the tool class type required by this hook, or null to match by name