Package io.meeds.mcp.server.tool
Class SpaceMcpTool
java.lang.Object
io.meeds.mcp.server.tool.SpaceMcpTool
- All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin
@Service
public class SpaceMcpTool
extends Object
implements io.meeds.mcp.server.plugin.McpToolPlugin
-
Field Summary
Fields inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
DEFAULT_LIMIT, DEFAULT_OFFSET -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacceptSpaceInvitation(long spaceId) voidacceptSpaceJoinRequest(long spaceId, String username) cancelJoinRequest(long spaceId) longcountMySpaces(String query) createSpace(long spaceTemplateId, String name, String description, Visibility visibility, Registration registration, List<String> usernamesToInvite, Long parentSpaceId) declineSpaceInvitation(long spaceId) voiddeclineSpaceJoinRequest(long spaceId, String username) voiddeleteSpace(long spaceId) Deletes a space the current user holds the delete permission on, with the current user as the editor of the deletion, as the Social REST endpoint does.getAllSpaces(String query, Integer offset, Integer limit) getManagedSpaces(String query, Integer offset, Integer limit) getMySpaces(String query, Integer offset, Integer limit) getSpaceById(long spaceId) getSpaceMembers(long spaceId, Integer offset, Integer limit) voidinviteUsersToSpace(long spaceId, List<String> usernamesToInvite) joinSpace(long spaceId) leaveSpace(long spaceId) listSpaceJoinRequests(long spaceId, Integer offset, Integer limit) listSubSpaces(long parentSpaceId, Integer offset, Integer limit) listUsersOfSpaceByRole(long spaceId, SpaceRole spaceRole, Integer offset, Integer limit) voidremoveUserRoleInSpace(long spaceId, String username, SpaceRole spaceRole) Removes a role of a member of a space the current user manages.voidremoveUsersFromSpace(long spaceId, List<String> usernamesToRemove) Removes users from a space the current user manages.requestToJoinSpace(long spaceId) setSpaceAvatar(long spaceId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) setSpaceBanner(long spaceId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) voidsetUserRoleInSpace(long spaceId, String username, SpaceRole spaceRole) updateSpaceSettings(long spaceId, String name, String description, Visibility visibility, Registration registration) Updates the settings of a space the current user manages.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
getCurrentUserAclIdentity, getCurrentUserLocale, getCurrentUserLocale, getCurrentUserName, getLocale
-
Constructor Details
-
SpaceMcpTool
public SpaceMcpTool()
-
-
Method Details
-
createSpace
public SpaceModel createSpace(long spaceTemplateId, String name, String description, Visibility visibility, Registration registration, List<String> usernamesToInvite, Long parentSpaceId) throws org.exoplatform.social.core.space.SpaceException - Throws:
org.exoplatform.social.core.space.SpaceException
-
updateSpaceSettings
public SpaceModel updateSpaceSettings(long spaceId, String name, String description, Visibility visibility, Registration registration) Updates the settings of a space the current user manages. The current user is the editor of the update, as in the Social REST endpoint.- Parameters:
spaceId- the spacename- the new display name, ignored when blankdescription- the new description, ignored when blankvisibility- the new visibility, ignored when nullregistration- the new registration, ignored when null- Returns:
- the updated space
-
getAllSpaces
-
getMySpaces
-
countMySpaces
-
getManagedSpaces
-
getSpaceById
-
listUsersOfSpaceByRole
-
inviteUsersToSpace
-
removeUsersFromSpace
Removes users from a space the current user manages. Refused before any removal when one of them is the space's only manager, or when the list holds every manager; each user is then checked again against the space as stored, right before its removal, so that a change made elsewhere before that read is taken into account. The read and the removal are not one transaction: a manager demoted or removed elsewhere between them, by a concurrent removal of the other manager among others, can still leave the space without one. A refusal at that point leaves the users removed before it removed. The current user is the editor of each removal, as in the Social REST endpoint.- Parameters:
spaceId- the spaceusernamesToRemove- the users, possibly prefixed with "@"- Throws:
IllegalStateException- when the space doesn't exist, the current user can't manage it, or a removal would leave it without a manager
-
setUserRoleInSpace
-
removeUserRoleInSpace
Removes a role of a member of a space the current user manages. The current user is the editor of the change, as in the Social REST endpoint.- Parameters:
spaceId- the spaceusername- the memberspaceRole- the role to remove- Throws:
IllegalStateException- when the space doesn't exist, the current user can't manage it, the user isn't a member of it, or the role is the manager one of its only manager
-
setSpaceAvatar
public SpaceModel setSpaceAvatar(long spaceId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
setSpaceBanner
public SpaceModel setSpaceBanner(long spaceId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
joinSpace
public SpaceModel joinSpace(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
requestToJoinSpace
public SpaceModel requestToJoinSpace(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
cancelJoinRequest
public SpaceModel cancelJoinRequest(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
leaveSpace
public SpaceModel leaveSpace(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
acceptSpaceInvitation
public SpaceModel acceptSpaceInvitation(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
declineSpaceInvitation
public SpaceModel declineSpaceInvitation(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
listSpaceJoinRequests
public List<UserModel> listSpaceJoinRequests(long spaceId, Integer offset, Integer limit) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
acceptSpaceJoinRequest
public void acceptSpaceJoinRequest(long spaceId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
declineSpaceJoinRequest
public void declineSpaceJoinRequest(long spaceId, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
getSpaceMembers
public List<SpaceMemberModel> getSpaceMembers(long spaceId, Integer offset, Integer limit) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
listSubSpaces
public List<SpaceModel> listSubSpaces(long parentSpaceId, Integer offset, Integer limit) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundExceptionIllegalAccessException
-
deleteSpace
public void deleteSpace(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.social.core.space.SpaceException Deletes a space the current user holds the delete permission on, with the current user as the editor of the deletion, as the Social REST endpoint does.- Parameters:
spaceId- technical id of the space- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the space doesn't existorg.exoplatform.social.core.space.SpaceException- when the space service refuses the deletion
-