Package com.tnsai.skills
Class SkillScopedToolCallFilter
java.lang.Object
com.tnsai.skills.SkillScopedToolCallFilter
- All Implemented Interfaces:
ToolCallFilter
ToolCallFilter that enforces the
allowed-tools field of each active skill (TNS-289).
Semantics
- No skills active — filter is permissive: every tool call is allowed. The agent's full tool catalog applies.
- One or more skills active, none declare allowed-tools —
still permissive.
allowed-toolsis opt-in scoping; an active skill that doesn't declare it doesn't constrain anything. - One or more skills declare allowed-tools — the union of
those lists is the whitelist. Any tool not in the union is
blocked with a
guidemessage naming the active skills.
Composes with other filters: callers wrap this filter together with their own (e.g. via a chain) when they have additional permission rules. The class doesn't try to be the only filter on the agent.
- Since:
- 0.10.0 (TNS-289)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates a tool call and returns a steering action.booleanChecks whether a tool call is allowed to execute.Lower-cased union ofallowed-toolsdeclared by every active skill.
-
Constructor Details
-
SkillScopedToolCallFilter
-
-
Method Details
-
isAllowed
Description copied from interface:ToolCallFilterChecks whether a tool call is allowed to execute.- Specified by:
isAllowedin interfaceToolCallFilter- 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
Description copied from interface:ToolCallFilterEvaluates 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
ToolCallFilter.isAllowed(String, Map).- Specified by:
evaluatein interfaceToolCallFilter- Parameters:
toolName- the name of the tool being calledarguments- the arguments passed to the tool- Returns:
- the action to take
-
unionAllowedTools
Lower-cased union ofallowed-toolsdeclared by every active skill. Empty when no active skill declares the field — which the filter treats as "no restriction".
-