Package com.tnsai.agents.execution
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.
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 Summary
-
Method Details
-
isAllowed
Checks whether a tool call is allowed to execute.- Parameters:
toolName- the name of the tool being calledarguments- the arguments passed to the tool- Returns:
- true if the tool call should proceed, false to block it
-
evaluate
Evaluates a tool call and returns a steering action.Override this method to provide richer feedback than allow/block:
ToolCallAction.allow()— proceed as-isToolCallAction.block()— reject the callToolCallAction.guide(String)— don't execute, provide corrective feedbackToolCallAction.fallback(String)— suggest an alternative tool
The default implementation delegates to
isAllowed(String, Map).- Parameters:
toolName- the name of the tool being calledarguments- the arguments passed to the tool- Returns:
- the action to take
-