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

    • 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
    • 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