Class TaskMcpTool

java.lang.Object
io.meeds.task.mcp.TaskMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service @Profile("mcp-server") public class TaskMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
  • Constructor Details

    • TaskMcpTool

      public TaskMcpTool(ProjectService projectService, StatusService statusService, TaskService taskService, CommentService commentService, LabelService labelService, org.exoplatform.social.core.space.spi.SpaceService spaceService, io.meeds.social.translation.service.TranslationService translationService, org.exoplatform.services.resources.ResourceBundleService resourceBundleService, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, org.exoplatform.portal.config.UserACL userAcl, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, io.meeds.portal.permlink.service.PermanentLinkService permanentLinkService, org.exoplatform.social.metadata.favorite.FavoriteService favoriteService)
  • Method Details

    • listProjects

      public ProjectCollectionModel listProjects(Long spaceId, Integer offset, Integer limit)
    • listAssignedTasks

      public TaskCollectionModel listAssignedTasks(Integer limit, Boolean overdueOnly)
      Lists the open tasks assigned to the current user, or of which they are a coworker; with overdueOnly, only those whose due date is before today in the user's time zone (EXO-91122). Each task past its due date carries its days overdue.
      Parameters:
      limit - the most tasks returned
      overdueOnly - whether only the overdue tasks are listed
      Returns:
      the tasks, with their count
    • listTasks

      public TaskCollectionModel listTasks(Long projectId, Boolean hideCompletedTasks, Boolean includeChangeLog, Boolean overdueOnly, Integer offset, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Lists the tasks of a project, or, without one, every task the current user can access, personal tasks included; with overdueOnly, only the open tasks whose due date is before today in the user's time zone (EXO-91122). Each open task past its due date carries its days overdue. The count is the count of the tasks the same filters select.
      Parameters:
      projectId - the project, null for every accessible task
      hideCompletedTasks - whether the completed tasks are left out
      includeChangeLog - whether each task comes with its change log
      overdueOnly - whether only the overdue tasks are listed
      offset - the first task returned
      limit - the most tasks returned
      Returns:
      the tasks, with their count
      Throws:
      IllegalAccessException - when the user can't view the project
      org.exoplatform.commons.exception.ObjectNotFoundException - when the project doesn't exist
    • getProjectById

      public ProjectModel getProjectById(Long projectId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getProjectIdByTaskId

      public Long getProjectIdByTaskId(Long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getTaskById

      public TaskModel getTaskById(Long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • listTaskCommentsById

      public TaskCommentCollectionModel listTaskCommentsById(Long taskId, Integer offset, Integer limit) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • createProjectInSpace

      public ProjectModel createProjectInSpace(Long spaceId, String title, String description, String dueDate) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • createTaskInProject

      public TaskModel createTaskInProject(long projectId, String title, String description, String assignee, Set<String> coworkers, String startDate, String dueDate, Priority priority, Long statusId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Creates a task inside a project. Dates mirror the Task UI: a "Start Date" and a "Due date" (the vestigial endDate field is intentionally not exposed here).
      Parameters:
      projectId - id of the project to create the task in
      title - task title
      description - task description
      assignee - username of the assignee, or blank for the calling user: a personal task shows only in its assignee's list, so one without an assignee would be listed nowhere
      coworkers - usernames of the coworkers
      startDate - the start date (ISO string), or blank for none
      dueDate - the due date (ISO string), or blank for none
      priority - task priority (defaults to Priority.NONE when null)
      statusId - id of the target status, or null for the project default status
      Returns:
      the created task model
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - if the project does not exist
      IllegalAccessException - if the current user cannot create tasks in the project
    • createPersonalTask

      public TaskModel createPersonalTask(String title, String description, String assignee, Set<String> coworkers, String startDate, String dueDate, Priority priority, Long statusId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Creates a personal (label-less, project-less) task. Dates mirror the Task UI: a "Start Date" and a "Due date" (the vestigial endDate field is intentionally not exposed here).
      Parameters:
      title - task title
      description - task description
      assignee - username of the assignee
      coworkers - usernames of the coworkers
      startDate - the start date (ISO string), or blank for none
      dueDate - the due date (ISO string), or blank for none
      priority - task priority (defaults to Priority.NONE when null)
      statusId - id of the target status, or null for none; the task is then stored in that status's project, which the current user must be able to view
      Returns:
      the created task model
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - if the status does not exist
      IllegalAccessException - if the current user cannot create tasks in the project of the status
    • addTaskComment

      public TaskCommentModel addTaskComment(long taskId, String text) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • updateTaskTitle

      public TaskModel updateTaskTitle(long taskId, String title) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • updateTaskDescription

      public TaskModel updateTaskDescription(long taskId, String description) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • assignTaskToMe

      public TaskModel assignTaskToMe(long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • assignTask

      public TaskModel assignTask(long taskId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • addTaskCoworker

      public TaskModel addTaskCoworker(long taskId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • listProjectLabels

      public List<ProjectLabel> listProjectLabels(Long projectId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • listProjectStatuses

      public List<ProjectStatus> listProjectStatuses(Long projectId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • createProjectLabel

      public ProjectLabel createProjectLabel(Long projectId, String labelName) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • addProjectLabelToTask

      public void addProjectLabelToTask(Long taskId, Long labelId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeProjectLabelFromTask

      public void removeProjectLabelFromTask(Long taskId, Long labelId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • listTaskLabels

      public List<ProjectLabel> listTaskLabels(long taskId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • updateProjectLabel

      public ProjectLabel updateProjectLabel(long labelId, String name) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • deleteProjectLabel

      public void deleteProjectLabel(long labelId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • updateTaskStatus

      public void updateTaskStatus(Long taskId, Long statusId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • setTaskDates

      public TaskModel setTaskDates(long taskId, String startDate, String dueDate) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Patches a task's start and due dates. This is a partial update: only the dates actually passed (non-blank) are updated, so setting one date (e.g. the due date) never wipes the other one that was set before. These are the two dates surfaced by the Task UI ("Start Date" + "Due date"); the vestigial endDate field is intentionally not exposed here.
      Parameters:
      taskId - id of the task to update
      startDate - the new start date (ISO string), or blank to leave it unchanged
      dueDate - the new due date (ISO string), or blank to leave it unchanged
      Returns:
      the updated task model
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - if the task does not exist
      IllegalAccessException - if the current user cannot edit the task
    • completeTask

      public TaskModel completeTask(long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • reopenTask

      public TaskModel reopenTask(long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • setTaskPriority

      public TaskModel setTaskPriority(long taskId, Priority priority) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • listUnscheduledTasks

      public TaskCollectionModel listUnscheduledTasks(Long projectId, Integer limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • updateProject

      public ProjectModel updateProject(Long projectId, String name, String description, String color) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • addProjectMember

      public ProjectModel addProjectMember(Long projectId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • removeProjectMember

      public ProjectModel removeProjectMember(Long projectId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • setProjectManager

      public ProjectModel setProjectManager(Long projectId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • removeProjectManager

      public ProjectModel removeProjectManager(Long projectId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • createProjectStatus

      public ProjectStatus createProjectStatus(Long projectId, String name) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • renameProjectStatus

      public ProjectStatus renameProjectStatus(Long statusId, String name) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getProjectStatistics

      public ProjectStatisticsModel getProjectStatistics(Long projectId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • favoriteProject

      public void favoriteProject(Long projectId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • unfavoriteProject

      public void unfavoriteProject(Long projectId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • favoriteTask

      public void favoriteTask(long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • unfavoriteTask

      public void unfavoriteTask(long taskId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • deleteTaskComment

      public void deleteTaskComment(long commentId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • listProjectActivitySince

      public ProjectActivityModel listProjectActivitySince(Long projectId, Integer days) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getCurrentUserZone

      protected ZoneId getCurrentUserZone()
      Returns:
      the current user's time zone, the server's when they have none
    • getToday

      protected LocalDate getToday(ZoneId zone)
      Parameters:
      zone - a time zone
      Returns:
      today in that zone