Class ToolFilter
java.lang.Object
io.agentscope.harness.agent.tools.ToolFilter
Applies the
allow / deny lists from
workspace/tools.json (or Managed Agents toolset export) against a Toolkit.
Semantics:
- When
allowis non-empty, catalogued tools not listed are removed. HarnessPlatformToolsnames always surviveallow(Harness runtime must keep working). Explicitdenystill removes them.denyentries are always removed, regardless ofallow.- When both are empty/absent the toolkit is left untouched.
Names that don't correspond to a currently registered tool are logged at WARN and otherwise ignored — typos in the workspace file should not abort the agent.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapply(io.agentscope.core.tool.Toolkit toolkit, ToolsConfig cfg) Removes tools fromtoolkitthat are excluded bycfg's allow/deny lists.static booleanisAllowed(String name, ToolsConfig cfg) Returns whether a tool withnamesurvivescfg's allow/deny rules.
-
Method Details
-
isAllowed
Returns whether a tool withnamesurvivescfg's allow/deny rules.This is useful when prompt construction depends on a tool being available after filtering.
-
apply
Removes tools fromtoolkitthat are excluded bycfg's allow/deny lists. Anullcfgor one with no allow/deny entries is a no-op.
-