Interface ToolCallFilter

All Known Implementing Classes:
AllowAllToolFilter, SkillScopedToolCallFilter
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 ToolCallFilter
Filter for controlling tool call execution.

Implementations decide whether a tool call should proceed, be blocked, receive corrective guidance, or be redirected to an alternative tool.

The default evaluate(String, Map) method delegates to the legacy isAllowed(String, Map) for backward compatibility. New implementations should override evaluate() directly to leverage GUIDE and FALLBACK actions.

See Also:
  • Method Details

    • isAllowed

      boolean isAllowed(String toolName, Map<String,Object> arguments)
      Checks whether a tool call is allowed to execute.
      Parameters:
      toolName - the name of the tool being called
      arguments - the arguments passed to the tool
      Returns:
      true if the tool call should proceed, false to block it
    • evaluate

      default ToolCallAction evaluate(String toolName, Map<String,Object> arguments)
      Evaluates a tool call and returns a steering action.

      Override this method to provide richer feedback than allow/block:

      The default implementation delegates to isAllowed(String, Map).

      Parameters:
      toolName - the name of the tool being called
      arguments - the arguments passed to the tool
      Returns:
      the action to take