Package io.meeds.chat.mcp
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
FieldsFields inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
DEFAULT_LIMIT, DEFAULT_OFFSET -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChatMessages(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, waitMethods inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
getCurrentUserAclIdentity, getCurrentUserLocale, getCurrentUserLocale, getCurrentUserName, getLocale
-
Field Details
-
matrixService
-
-
Constructor Details
-
ChatMcpTool
public ChatMcpTool()
-
-
Method Details
-
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
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 bylist_chat_conversationslimit- the maximum number of messages to return; defaults to 50 when omitted by the agent- Returns:
- the conversation messages, oldest first
-
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
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 bylist_chat_conversationstext- the plain text message to send- Returns:
- the created event id, or
nullwhen the message could not be sent
-