Class ProcessesMcpTool

java.lang.Object
org.exoplatform.processes.mcp.ProcessesMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service @Profile("mcp-server") public class ProcessesMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
MCP tools exposing the eXo Processes add-on to the AI agent (EVA).

A process type (WorkFlow) is backed by a Task/Kanban project (WorkFlow.projectId); a request (Work) IS a task (Work.taskId) whose status is the task's Kanban column (default columns: Request, RequestInProgress, Validated, Refused, Canceled).

Every method acts as the current user: the current user's social identity id is resolved and passed to the self-scoping ProcessesService calls (getWorks / getWorkById filter by createdBy), so platform ACLs are enforced.

Approver actions ride the existing Task MCP tools by design: to respond to a pending request, the agent calls the eXo Task tools on the request's task id (update_task_status to Validated/Refused, add_task_comment). This class deliberately does NOT duplicate that task-write path; it only surfaces the pending requests to act on via getPendingApprovals().

  • Constructor Details

    • ProcessesMcpTool

      public ProcessesMcpTool(org.exoplatform.processes.service.ProcessesService processesService, org.exoplatform.task.service.TaskService taskService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, ProcessSpaceScopeResolver processSpaceScopeResolver)
      Parameters:
      processesService - reads and writes the processes and requests
      taskService - reads the pending requests' tasks
      identityManager - resolves the current user's identity
      spaceService - reads a listed space and its members
      processSpaceScopeResolver - tells the space of a process, so that a space's listing names only the processes its lookup accepts
  • Method Details

    • listProcesses

      public List<ProcessModel> listProcesses(Long spaceId) throws IllegalAccessException
      Lists the enabled process types (request types) the current user can see, so the agent can discover what a user may request and get the process id to pass to submit_work_request. With a space, it lists only the processes of that space, by the rule of the "process" resolver, so the listing never names a process the space scope refuses; an unknown space, or one the user isn't a member of, lists none. The space's processes are read page by page over the user's processes, a process met twice is listed once, and the reading stops once 200 are found. The process query has no order, so a page boundary may still skip a process. READ.
      Parameters:
      spaceId - the space whose processes to list, null or not positive for every process the user can see
      Returns:
      at most 200 processes
      Throws:
      IllegalAccessException - when the processes can't be read
    • getMyRequests

      public List<RequestModel> getMyRequests(String status) throws Exception
      Throws:
      Exception
    • getRequestDetails

      public RequestModel getRequestDetails(long requestId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
    • submitWorkRequest

      public RequestModel submitWorkRequest(long processId, String title, String description) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • cancelWorkRequest

      public RequestModel cancelWorkRequest(long requestId) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      IllegalArgumentException
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getPendingApprovals

      public List<PendingApprovalModel> getPendingApprovals() throws Exception
      Throws:
      Exception