Class ToolInvoker

java.lang.Object
com.shaft.commandline.runtime.ToolInvoker

public final class ToolInvoker extends Object
Runs a single tool call end-to-end: routes the connection, parses arguments, renders the result, and returns a process exit code. This is the shared path behind call and every curated alias.
  • Method Details

    • invoke

      public static int invoke(McpConnector connector, String toolName, ToolOptions options, List<String> keyValues, boolean requiresSession, PrintWriter out, PrintWriter err)
      Parameters:
      connector - the connection provider
      toolName - the MCP tool name
      options - the shared tool options (--json, --args, --stdio-ok)
      keyValues - repeated key=value argument tokens
      requiresSession - whether the tool needs live browser/device state
      out - standard output writer
      err - standard error writer
      Returns:
      the process exit code (0 success, 1 tool/transport error)