Class ToolFilter

java.lang.Object
io.agentscope.harness.agent.tools.ToolFilter

public final class ToolFilter extends Object
Applies the allow / deny lists from workspace/tools.json (or Managed Agents toolset export) against a Toolkit.

Semantics:

  • When allow is non-empty, catalogued tools not listed are removed.
  • HarnessPlatformTools names always survive allow (Harness runtime must keep working). Explicit deny still removes them.
  • deny entries are always removed, regardless of allow.
  • 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 Details

    • isAllowed

      public static boolean isAllowed(String name, ToolsConfig cfg)
      Returns whether a tool with name survives cfg's allow/deny rules.

      This is useful when prompt construction depends on a tool being available after filtering.

    • apply

      public static void apply(io.agentscope.core.tool.Toolkit toolkit, ToolsConfig cfg)
      Removes tools from toolkit that are excluded by cfg's allow/deny lists. A null cfg or one with no allow/deny entries is a no-op.