Class NoteMcpTool

java.lang.Object
io.meeds.notes.mcp.NoteMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service @Profile("mcp-server") public class NoteMcpTool 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
    Constructor
    Description
    NoteMcpTool(WikiService wikiService, NoteService noteService, org.exoplatform.social.core.manager.ActivityManager activityManager, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.processor.I18NActivityProcessor i18NActivityProcessor, org.exoplatform.social.core.space.spi.SpaceService spaceService, io.meeds.social.translation.service.TranslationService translationService, 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.upload.UploadService uploadService, org.exoplatform.social.attachment.AttachmentService attachmentService, org.exoplatform.commons.file.services.FileService fileService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createChildNote(Long parentNoteId, String title, String summary, String htmlContent)
    Creates a note as a child of an existing note, in the same notebook (space or personal) as its parent, as the current user.
    createPersonalNote(String title, String summary, String htmlContent)
    Creates a note in the calling user's own (personal) notebook, at its root.
    createSpaceNote(Long spaceId, String title, String summary, String htmlContent)
    Creates a note at the root of a space's notebook, as the current user.
    void
    deleteNote(long noteId)
     
    getNote(long noteId, String language)
     
    getNoteTranslations(long noteId)
    Lists the language codes a note has translations for (e.g.
    getNoteVersions(long noteId, String language)
    Lists the version history of a note: each version's number, id, title, content, date and author.
    getSpaceNoteTree(long spaceId)
     
    void
    moveNote(long noteId, long targetParentNoteId)
     
    io.meeds.mcp.server.tool.model.ActivityModel
    publishNote(long noteId)
     
    removeNoteCover(long noteId, String language)
    Removes a note's cover ("featured") image.
    removeNoteTranslation(long noteId, String language)
     
    restoreNoteVersion(long noteId, long versionNumber, String language)
    Restores a note to a previous version identified by its version_number (from get_note_versions), creating a new current version from it.
    searchNotes(String query, Long spaceId, Integer offset, Integer limit, Boolean isFavorites)
     
    setNoteCover(long noteId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText, String language)
    Sets a note's cover ("featured") image from exactly one of a public http(s) URL, base64 bytes, or an ACL-checked reference to an existing platform attachment.
    setNoteSummary(long noteId, String summary, String language)
    Sets (or replaces) a note's summary — the short excerpt shown on note cards.
    updateNote(long noteId, String title, String htmlContent, String language)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin

    getCurrentUserAclIdentity, getCurrentUserLocale, getCurrentUserLocale, getCurrentUserName, getLocale
  • Constructor Details

    • NoteMcpTool

      public NoteMcpTool(WikiService wikiService, NoteService noteService, org.exoplatform.social.core.manager.ActivityManager activityManager, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.processor.I18NActivityProcessor i18NActivityProcessor, org.exoplatform.social.core.space.spi.SpaceService spaceService, io.meeds.social.translation.service.TranslationService translationService, 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.upload.UploadService uploadService, org.exoplatform.social.attachment.AttachmentService attachmentService, org.exoplatform.commons.file.services.FileService fileService)
  • Method Details

    • getSpaceNoteTree

      public NoteRootTreeModel getSpaceNoteTree(long spaceId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
      IllegalAccessException
    • getNote

      public NoteModel getNote(long noteId, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getNoteTranslations

      public List<String> getNoteTranslations(long noteId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Lists the language codes a note has translations for (e.g. ["en", "fr"]). The default (untranslated) content is what get_note returns without a language; an empty list means the note has only its default content. Read as the current user, so the note's ACL is enforced. Read-only.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeNoteTranslation

      public NoteModel removeNoteTranslation(long noteId, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • createSpaceNote

      public NoteModel createSpaceNote(Long spaceId, String title, String summary, String htmlContent) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Creates a note at the root of a space's notebook, as the current user. The space's notebook is created on first use. The Notes service enforces the space ACL (the user must be allowed to redact or publish in the space).
      Parameters:
      spaceId - id of the space whose notebook receives the note
      title - title of the note
      summary - optional plain-text summary shown on note cards
      htmlContent - body of the note, HTML or markdown
      Returns:
      the created note, read back as the current user
      Throws:
      IllegalAccessException - when the user can't access the space or add notes to it
      org.exoplatform.commons.exception.ObjectNotFoundException - when the space doesn't exist
    • createPersonalNote

      public NoteModel createPersonalNote(String title, String summary, String htmlContent) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Creates a note in the calling user's own (personal) notebook, at its root. The notebook is resolved from the authenticated user only, never from the tool arguments, so a caller can't target someone else's notebook; it is created on first use, as the Notes REST layer does. The Notes service then re-checks that the user manages that notebook (a personal notebook is only managed by its owner).
      Parameters:
      title - title of the note
      summary - optional plain-text summary shown on note cards
      htmlContent - body of the note, HTML or markdown
      Returns:
      the created note, read back as the current user
      Throws:
      IllegalAccessException - when there is no authenticated user, or the user isn't allowed to add notes to that notebook
      org.exoplatform.commons.exception.ObjectNotFoundException - when the notebook has no home note
    • createChildNote

      public NoteModel createChildNote(Long parentNoteId, String title, String summary, String htmlContent) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Creates a note as a child of an existing note, in the same notebook (space or personal) as its parent, as the current user.
      Parameters:
      parentNoteId - id of the note under which the new note is created
      title - title of the note
      summary - optional plain-text summary shown on note cards
      htmlContent - body of the note, HTML or markdown
      Returns:
      the created note, read back as the current user
      Throws:
      IllegalAccessException - when the user can't view the parent note or add notes to its notebook
      org.exoplatform.commons.exception.ObjectNotFoundException - when the parent note doesn't exist
    • updateNote

      public NoteModel updateNote(long noteId, String title, String htmlContent, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • publishNote

      public io.meeds.mcp.server.tool.model.ActivityModel publishNote(long noteId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • deleteNote

      public void deleteNote(long noteId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • moveNote

      public void moveNote(long noteId, long targetParentNoteId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • searchNotes

      public List<NoteModel> searchNotes(String query, Long spaceId, Integer offset, Integer limit, Boolean isFavorites)
    • getNoteVersions

      public List<NoteVersionModel> getNoteVersions(long noteId, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Lists the version history of a note: each version's number, id, title, content, date and author. Read as the current user, so the note's ACL is enforced. Read-only.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • restoreNoteVersion

      public NoteModel restoreNoteVersion(long noteId, long versionNumber, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Restores a note to a previous version identified by its version_number (from get_note_versions), creating a new current version from it. Only a user who can edit the note may restore it.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • setNoteCover

      public NoteModel setNoteCover(long noteId, String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId, String altText, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Sets a note's cover ("featured") image from exactly one of a public http(s) URL, base64 bytes, or an ACL-checked reference to an existing platform attachment. Only a user who can edit the note may set it. The image is wired into the note metadata so it actually renders on the note.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • setNoteSummary

      public NoteModel setNoteSummary(long noteId, String summary, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Sets (or replaces) a note's summary — the short excerpt shown on note cards. Only a user who can edit the note may set it; the note's cover image is preserved.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • removeNoteCover

      public NoteModel removeNoteCover(long noteId, String language) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Removes a note's cover ("featured") image. Only a user who can edit the note may remove it.
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException