Class ChatMcpTool

java.lang.Object
io.meeds.chat.mcp.ChatMcpTool
All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin

@Service public class ChatMcpTool extends Object implements io.meeds.mcp.server.plugin.McpToolPlugin
MCP tools exposing the Matrix chat to AI agents. Discovered by the platform mcp-server: a plain @Service implementing McpToolPlugin (no @McpTool annotation, no custom constructor) whose public methods become tools. Each method must have a matching entry, by snake_case name, in ai-tool-definitions.json or it is silently ignored by the mcp-server.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected MatrixService
     

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

    DEFAULT_LIMIT, DEFAULT_OFFSET
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getChatMessages(String conversationId, Integer limit)
    Returns the most recent messages of one of the current user's conversations, in chronological order.
    Returns the current user's unread conversations together with their recent messages, to help build a "catch me up" digest of what the user missed.
    Lists the chat conversations (direct messages and space rooms) the current user participates in.
    sendChatMessage(String conversationId, String text)
    Sends a text message to one of the current user's conversations, on the user's behalf.

    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
  • Field Details

    • matrixService

      @Autowired protected MatrixService matrixService
  • Constructor Details

    • ChatMcpTool

      public ChatMcpTool()
  • Method Details

    • listChatConversations

      public List<ChatConversation> listChatConversations()
      Lists the chat conversations (direct messages and space rooms) the current user participates in. Tool name: list_chat_conversations.
      Returns:
      the current user's conversations
    • getChatMessages

      public List<ChatMessage> getChatMessages(String conversationId, Integer limit)
      Returns the most recent messages of one of the current user's conversations, in chronological order. Tool name: get_chat_messages.
      Parameters:
      conversationId - the Matrix room id, as returned by list_chat_conversations
      limit - the maximum number of messages to return; defaults to 50 when omitted by the agent
      Returns:
      the conversation messages, oldest first
    • getUnreadChatMessages

      public List<ChatUnread> getUnreadChatMessages()
      Returns the current user's unread conversations together with their recent messages, to help build a "catch me up" digest of what the user missed. Tool name: get_unread_chat_messages.
      Returns:
      the current user's unread conversations
    • sendChatMessage

      public String sendChatMessage(String conversationId, String text)
      Sends a text message to one of the current user's conversations, on the user's behalf. Tool name: send_chat_message.
      Parameters:
      conversationId - the Matrix room id, as returned by list_chat_conversations
      text - the plain text message to send
      Returns:
      the created event id, or null when the message could not be sent