Class UserMcpTool

java.lang.Object
io.meeds.mcp.server.tool.UserMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service public class UserMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
  • Constructor Details

    • UserMcpTool

      public UserMcpTool(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, org.exoplatform.portal.config.UserACL userAcl, io.meeds.social.translation.service.TranslationService translationService, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, org.exoplatform.social.core.manager.RelationshipManager relationshipManager, org.exoplatform.services.user.UserStateService userStateService)
  • Method Details

    • getMyUserInformation

      public UserModel getMyUserInformation()
    • getUserByUsername

      public UserModel getUserByUsername(String username)
    • searchUsers

      public List<UserModel> searchUsers(String query, Integer offset, Integer limit)
    • getUsersCount

      public long getUsersCount()
    • setMyAvatar

      public UserModel setMyAvatar(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String uploadId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Sets the current user's profile avatar from an image provided as exactly one of an http(s) URL, a base64 string, an ACL-checked reference to a file already attached to a platform object, or the upload id of a file the user sent with start_upload. Acts as the current user, so the avatar always belongs to the caller. Refused with an IllegalAccessException, before the image is fetched, when the platform marks the avatar as not editable, unless the user is an administrator.
      Parameters:
      imageUrl - the public http(s) URL of the image, or null
      imageBase64 - the base64 bytes of the image, or null
      attachmentObjectType - the type of the object holding an attachment to use, or null
      attachmentObjectId - the id of the object holding an attachment to use, or null
      uploadId - the upload id of an image the user uploaded, or null; consumed by the call
      Returns:
      the updated user
      Throws:
      IllegalAccessException - when the avatar is not editable, or the attachment not readable
      org.exoplatform.commons.exception.ObjectNotFoundException - when the profile, the attachment or the upload does not exist
    • setMyBanner

      public UserModel setMyBanner(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String uploadId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Sets the current user's profile banner from an image provided as exactly one of an http(s) URL, a base64 string, an ACL-checked reference to a readable platform attachment, or the upload id of a file the user sent with start_upload. Acts as the current user. Refused with an IllegalAccessException, before the image is fetched, when the platform marks the banner as not editable, unless the user is an administrator.
      Parameters:
      imageUrl - the public http(s) URL of the image, or null
      imageBase64 - the base64 bytes of the image, or null
      attachmentObjectType - the type of the object holding an attachment to use, or null
      attachmentObjectId - the id of the object holding an attachment to use, or null
      uploadId - the upload id of an image the user uploaded, or null; consumed by the call
      Returns:
      the updated user
      Throws:
      IllegalAccessException - when the banner is not editable, or the attachment not readable
      org.exoplatform.commons.exception.ObjectNotFoundException - when the profile, the attachment or the upload does not exist
    • listConnectionRequests

      public List<UserModel> listConnectionRequests(Integer offset, Integer limit)
    • listSentConnectionRequests

      public List<UserModel> listSentConnectionRequests(Integer offset, Integer limit)
    • listMyConnections

      public List<UserModel> listMyConnections(String query, Integer offset, Integer limit)
    • listUserConnections

      public List<UserModel> listUserConnections(String username, Integer offset, Integer limit)
    • getConnectionStatus

      public String getConnectionStatus(String username)
    • listConnectionSuggestions

      public List<UserModel> listConnectionSuggestions(Integer limit)
    • sendConnectionRequest

      public void sendConnectionRequest(String username)
    • acceptConnectionRequest

      public void acceptConnectionRequest(String username)
      Accepts the pending connection request sent by the given user to the current user.
      Parameters:
      username - the user who sent the request
    • refuseConnectionRequest

      public void refuseConnectionRequest(String username)
      Refuses the pending connection request sent by the given user to the current user.
      Parameters:
      username - the user who sent the request
    • removeConnection

      public void removeConnection(String username)
    • updateMyProfile

      public UserModel updateMyProfile(String aboutMe, String position, String company, String department, String team, String city, String country, String phones, String urls)
      Updates the given profile fields of the current user. A field the platform marks as not editable can only be changed by an administrator: for any other user, a value given for it is refused with an IllegalAccessException, before any field is written.
      Returns:
      the updated user
    • addWorkExperience

      public List<ExperienceModel> addWorkExperience(String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description)
      Adds a work experience to the current user's profile. Refused with an IllegalAccessException when the platform marks the experiences as not editable, unless the user is an administrator.
      Returns:
      the experiences of the current user after the change
    • updateWorkExperience

      public List<ExperienceModel> updateWorkExperience(String experienceId, String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Updates a work experience of the current user's profile. Refused with an IllegalAccessException when the platform marks the experiences as not editable, unless the user is an administrator.
      Returns:
      the experiences of the current user after the change
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeWorkExperience

      public List<ExperienceModel> removeWorkExperience(String experienceId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Removes a work experience from the current user's profile. Refused with an IllegalAccessException when the platform marks the experiences as not editable, unless the user is an administrator.
      Returns:
      the experiences of the current user after the change
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
    • setProfileFieldVisibility

      public ProfileFieldVisibilityModel setProfileFieldVisibility(String fieldName, Boolean hidden)
      Hides or shows one of the current user's profile fields. A field the platform marks as not editable is refused to a non-administrator, as Social's visibility endpoint refuses it before toggling.
      Parameters:
      fieldName - the field
      hidden - true to hide it, false or null to show it
      Returns:
      the user's field visibility after the change
    • getProfileFieldVisibility

      public ProfileFieldVisibilityModel getProfileFieldVisibility()
    • getUserOnlineStatus

      public OnlineStatusModel getUserOnlineStatus(String username)
    • listOnlineUsers

      public List<OnlineStatusModel> listOnlineUsers(Integer offset, Integer limit)