Class ToolsConfigLoader

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

public final class ToolsConfigLoader extends Object
Loads workspace/tools.json into a ToolsConfig.

Reads through WorkspaceManager.readManagedWorkspaceFileUtf8(io.agentscope.core.agent.RuntimeContext, java.lang.String) so that the filesystem-overlay (sandbox / remote) path is honoured exactly like AGENTS.md. Performs ${ENV_VAR} substitution against System.getenv(java.lang.String) on the raw JSON text before parsing so that secrets in headers, env entries, urls, etc. are kept out of the file. Parse failures never throw — they log and return Optional.empty() so the agent still builds with its default toolkit.

  • Method Details

    • load

      public static Optional<ToolsConfig> load(WorkspaceManager wsManager)
      Reads tools.json relative to the workspace managed by wsManager. Returns Optional.empty() when the file is missing, blank, unreadable (e.g. sandbox filesystem accessed before its call context exists), or unparseable.