Class AdHocToolDescriptor

java.lang.Object
org.cibseven.connect.ai.agent.agentic.AdHocToolDescriptor

public final class AdHocToolDescriptor extends Object
One startable activity of an agentic ad hoc sub process, described as a tool for a language model: what it is called, what it does, which values it may be given and which variables it declares as its result.

Built at parse time from the model and stored on the scope's activity under CATALOG, so the catalogue exists before any instance runs and a broken declaration refuses the deployment rather than a turn; on a parse again of a deployment made while the agent was off, the broken tool is left out instead (CIB7-2367). Read at run time to build one tool specification per entry — the activity is the tool, so a wrong activity name is not expressible for the model at all.

Written and read at two different times: AgenticAdHocParseListener builds the catalogue while the model is deployed, and the connector's AdHocToolProvider reads it on every turn. Both live in this module; the scope's activity is what the two share.

  • Field Details

    • CATALOG

      public static final PropertyKey<List<AdHocToolDescriptor>> CATALOG
      Where the catalogue sits on the scope's activity: a list of these, in model order, one per directly startable child.
    • PARAMETER_TYPES

      public static final Set<String> PARAMETER_TYPES
      The types a parameter may declare — JSON schema scalars, because that is what a tool specification can say and what an activation can carry as a variable. In this order, which is the order a deployment error lists them in.
    • TOOL_CALL_VARIABLE

      public static final String TOOL_CALL_VARIABLE
      The local variable that carries every argument of one tool call, as a map from parameter name to value (CIB7-2136), on the performance of a tool that declares a parameter. Its input mapping reads it as toolCall.<name>, so what comes from the model is told apart from what comes from the process, and no parameter shadows a process variable of the same name. The name is reserved: no parameter may carry it.
      See Also:
  • Constructor Details

  • Method Details

    • toolCallValue

      public static ObjectValue toolCallValue(Map<String,Object> arguments)
      The value TOOL_CALL_VARIABLE holds for a call's arguments: a TreeMap, Java-serialized whatever the engine's default serialization format. Under JSON a map read back in a later command holds an Integer where the call set a Long, and a plain read of toolCall.<name> hands that on; Java serialization keeps the types, and every engine can write it, Spin or not, as it writes the chat log and the conversation. A TreeMap has the same serialized form however it was built, so a read does not write it again.
    • anyParameters

      public static boolean anyParameters(List<AdHocToolDescriptor> catalog)
      Whether any tool of the catalogue declares a parameter (CIB7-2136): then the scope keeps an empty TOOL_CALL_VARIABLE, so a tool started by something other than the agent reads its parameters as null instead of failing on the missing map. Not where a TOOL_CALL_VARIABLE is visible already: in a scope that is itself the tool of an outer agent such a tool reads the outer call's map, and in a process with a variable of that name, that variable.
    • getActivityId

      public String getActivityId()
      The BPMN activity id — the tool's name, and what an activation request names.
    • getName

      public String getName()
      The label from the diagram, or null when the element has none.
    • getDocumentation

      public String getDocumentation()
      The element's documentation text, or null when it has none.
    • getReadVariables

      public List<String> getReadVariables()
      The process variables this activity reads, as far as its model says: what its mappings name (CIB7-2169). Shown to the model in the description, so it knows what a call uses.
    • getResultVariables

      public List<String> getResultVariables()
      The process variables this activity declares as its result, in document order, without duplicates. What the agent is shown when the activity finishes — a declaration, not a measurement.
    • isBlockedWhileOthersRun

      public boolean isBlockedWhileOthersRun()
      Whether this activity may only start while nothing else in the scope runs.
    • getParameters

      public List<AdHocToolDescriptor.Parameter> getParameters()
      The declared input parameters, possibly empty, never null.