Class McpBpmConfig.BpmTools

java.lang.Object
com.ssgllc.fish.config.mcp.McpBpmConfig.BpmTools
Enclosing class:
McpBpmConfig

public static class McpBpmConfig.BpmTools extends Object
Tool implementations for BPM operations.

Backed by CustomBpmDeploymentService.

  • Field Details

    • mapper

      protected final com.fasterxml.jackson.databind.ObjectMapper mapper
  • Method Details

    • listDeployedProcessDefinitions

      @Tool(name="list-deployed-process-definitions", description="List the latest deployed version of every process definition in the Flowable engine (what can actually run). Suspended definitions are included and flagged.") public String listDeployedProcessDefinitions()
      Lists the process definitions deployed to the Flowable engine — the authoritative set of processes that can actually run, as opposed to the modeler BpmModel authoring rows (which are not runnable until deploy-bpm-model pushes them to the engine). Suspended definitions are included and flagged. Only the latest version per key is returned.
      Returns:
      JSON array of {id, key, name, version, deploymentId, category, description, tenantId, suspended}
    • listDeployedFormDefinitions

      @Tool(name="list-deployed-form-definitions", description="List the latest deployed version of every form definition in the Flowable form engine (all categories).") public String listDeployedFormDefinitions()
      Lists the form definitions deployed to the Flowable form engine, regardless of category. Forms bundled in a process deployment and forms managed in Casetivity both appear; the category field distinguishes them. Only the latest version per key is returned.
      Returns:
      JSON array of {id, key, name, version, deploymentId, category, description, resourceName, tenantId}
    • getProcessDefinitionBpmn

      @Tool(name="get-process-definition-bpmn", description="Get the BPMN XML for a process deployment.") public String getProcessDefinitionBpmn(@ToolParam(description="Process deployment ID") String definitionIdentifier)
      Returns the raw BPMN 2.0 XML string for the named process deployment. The returned string is the XML content directly (not JSON-wrapped).
      Parameters:
      definitionIdentifier - deployment ID as stored in the process repository
      Returns:
      BPMN 2.0 XML string, or a JSON error object if the deployment is not found
    • getBpmModelByKey

      @Tool(name="get-bpm-model-by-key", description="Get a BPM model (process/form/decision) by key and type code. typeCode is PROCESS, FORM, or DECISION.") public String getBpmModelByKey(@ToolParam(description="Model key") String key, @ToolParam(description="Type code: PROCESS, FORM, or DECISION") String typeCode)
    • getBpmModelForEditor

      @Tool(name="get-bpm-model-for-editor", description="Get the latest editable version (definition + metadata) of a BPM model by its model id.") public String getBpmModelForEditor(@ToolParam(description="BpmModel id") String modelId)
    • upsertBpmModelDefinition

      @Tool(name="upsert-bpm-model-definition", description="Create or update a BPM model definition, adding a new version. typeCode is PROCESS, FORM, or DECISION. featureBranch attributes the change to a config feature branch.") public String upsertBpmModelDefinition(@ToolParam(description="Model key") String key, @ToolParam(description="Model name") String name, @ToolParam(description="Type code: PROCESS, FORM, or DECISION") String typeCode, @ToolParam(description="Model definition (BPMN/DMN XML or form JSON)") String definition, @ToolParam(required=false,description="Config audit feature branch") String featureBranch)
    • importBpmModelFromBpmn

      @Tool(name="import-bpm-model-from-bpmn", description="Import a BPM process model from BPMN 2.0 XML, creating or versioning the model with the given key. featureBranch attributes the change to a config feature branch.") public String importBpmModelFromBpmn(@ToolParam(description="BPMN 2.0 XML") String bpmnXml, @ToolParam(description="Model name") String name, @ToolParam(description="Process key") String key, @ToolParam(required=false,description="Config audit feature branch") String featureBranch)
    • setBpmModelActive

      @Tool(name="set-bpm-model-active", description="Activate or archive a BPM model by id. featureBranch attributes the change to a config feature branch.") public String setBpmModelActive(@ToolParam(description="BpmModel id") String modelId, @ToolParam(description="true to activate, false to archive") boolean active, @ToolParam(required=false,description="Config audit feature branch") String featureBranch)
    • deployBpmModel

      @Tool(name="deploy-bpm-model", description="Deploy a BpmModel to the Flowable engine so its process can run. import/upsert only version the model; this deploys it. replaceDefinitions and replaceForms both default to true (Replace mode).") public String deployBpmModel(@ToolParam(description="BpmModel id") String modelId, @ToolParam(required=false,description="Replace existing process definitions; defaults to true") Boolean replaceDefinitions, @ToolParam(required=false,description="Replace existing forms; defaults to true") Boolean replaceForms)
      Deploys the latest version of a BPM model to the Flowable engine so its process definition becomes runnable. The upsert-bpm-model-definition and import-bpm-model-from-bpmn tools only create/version the model row — until this deploy runs, starting the process fails with "No process definition found".

      replaceDefinitions / replaceForms mirror the Upload Deployment page's deploy modes and both default to true (Replace). This is a runtime engine deployment, not a config write, so it carries no featureBranch param.

      Parameters:
      modelId - BpmModel id
      replaceDefinitions - replace existing process definitions; defaults to true
      replaceForms - replace existing forms; defaults to true
      Returns:
      JSON confirming the deploy, or a JSON error (e.g. a missing referenced subprocess)
    • previewBpmModelDeployment

      @Tool(name="preview-bpm-model-deployment", description="Preflight a BpmModel deploy: returns the forms/decisions/called-processes that would be bundled, plus any referenced artifacts missing from the model store (a missing subprocess makes the deploy fail).") public String previewBpmModelDeployment(@ToolParam(description="BpmModel id") String modelId)
      Preflight for deployBpmModel(java.lang.String, java.lang.Boolean, java.lang.Boolean): returns the forms, decision tables, and called processes that would be bundled into the deployment, plus any referenced artifacts that have no matching model in the store. A missing subprocess makes the deploy fail (it is inlined), whereas a missing form/decision/called-process may be a deliberate reliance on a pre-deployed engine artifact.
      Parameters:
      modelId - BpmModel id
      Returns:
      JSON object {"deployPreview":{...},"missingReferences":{...}}
    • toJson

      protected String toJson(Object value)
      Serializes value to a compact JSON string (no indent). Returns {"error":"serialization failed"} if serialization throws.
      Parameters:
      value - the object to serialize; may be null
      Returns:
      compact JSON string
    • bytesToString

      protected String bytesToString(byte[] bytes)
      Decodes a byte array to a UTF-8 string. Used to convert binary report output to a returnable string.
      Parameters:
      bytes - raw bytes
      Returns:
      decoded string
    • handleTool

      protected String handleTool(Callable<Object> action)
      Invokes action, serializes the result with toJson(java.lang.Object), and returns it. Any exception thrown by the action is caught and converted to a standard {"error":"<message>"} response via errorJson(java.lang.Exception). Use this in every @Tool method to eliminate identical try/catch boilerplate.
      Parameters:
      action - the tool logic to invoke; may throw any exception
      Returns:
      compact JSON string — the serialized result on success, or an error object on failure
    • errorJson

      protected String errorJson(Exception e)
      Produces a standard {"error":"<message>"} JSON response from an exception. Falls back to the simple class name when Throwable.getMessage() is null.
      Parameters:
      e - the exception to convert
      Returns:
      JSON error string