Class ToolTestService

java.lang.Object
ai.mindconnect.adminui.service.ToolTestService

@Service public class ToolTestService extends Object
One-shot execution of an AgentTool with admin-supplied JSON arguments. Powers the "Test" button on the tool-detail page so an admin can verify a tool's wiring without going through an agent.

Each test runs in a synthetic session (sessionId = randomUUID(), userId = "admin-test"). Session-scoped tools (todo_write, workspace_write, …) therefore write into an isolated scratch session that's never reused — no risk of polluting a real conversation. The session directory is left on disk for inspection; the admin can clean it up later if it accumulates.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ToolTestService(ai.mindconnect.agent.tool.ToolRegistry toolRegistry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    test(ai.mindconnect.agent.domain.AgentDefinition agent, ai.mindconnect.agent.tool.AgentTool agentTool, String argumentsJson)
    Parses argumentsJson as a Map<String,Object> and invokes the tool.
    test(ai.mindconnect.common.Namespace namespace, ai.mindconnect.agent.tool.AgentTool agentTool, String argumentsJson)
    Namespace-based variant for testing a tool without an agent context — used by the top-level tool catalog, where there is no owning agent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ToolTestService

      public ToolTestService(ai.mindconnect.agent.tool.ToolRegistry toolRegistry)
  • Method Details

    • test

      public ToolTestService.Result test(ai.mindconnect.agent.domain.AgentDefinition agent, ai.mindconnect.agent.tool.AgentTool agentTool, String argumentsJson)
      Parses argumentsJson as a Map<String,Object> and invokes the tool. argumentsJson == null || "" is treated as "no arguments" ({}). Returns the full execution outcome — the UI renders both success and failure shapes from the same record.
    • test

      public ToolTestService.Result test(ai.mindconnect.common.Namespace namespace, ai.mindconnect.agent.tool.AgentTool agentTool, String argumentsJson)
      Namespace-based variant for testing a tool without an agent context — used by the top-level tool catalog, where there is no owning agent. The agent is only ever needed for its Namespace, so this is the real implementation and the agent-based overload delegates here.