Class ChatRoomSpaceScopeResolver

java.lang.Object
io.meeds.chat.mcp.ChatRoomSpaceScopeResolver
All Implemented Interfaces:
io.meeds.mcp.server.plugin.SpaceScopeResolver

@Service("chatRoomSpaceScopeResolver") public class ChatRoomSpaceScopeResolver extends Object implements io.meeds.mcp.server.plugin.SpaceScopeResolver
Tells the MCP server which space a chat room belongs to, for the chat tools that reach a room by its id (get_chat_messages, send_chat_message) while their call is limited to one space: a digital worker's run in a space's room can then read that room, and no other.

Only an enabled space room answers. A direct message, an unknown or disabled room, a room found by prefix only, and any room that cannot be read answer no space, so the call is refused. The room id is compared exactly once both sides are normalised, since a room is stored either as its local part or as its full id.

  • Field Details

  • Constructor Details

    • ChatRoomSpaceScopeResolver

      public ChatRoomSpaceScopeResolver()
  • Method Details

    • getName

      public String getName()
      Returns the resolver's name.
      Specified by:
      getName in interface io.meeds.mcp.server.plugin.SpaceScopeResolver
      Returns:
      "chat_room"
    • spaceOf

      public Long spaceOf(String objectId)
      Tells the space of a room, never throwing.
      Specified by:
      spaceOf in interface io.meeds.mcp.server.plugin.SpaceScopeResolver
      Parameters:
      objectId - the Matrix room id, with or without its server name
      Returns:
      the room's space id, null when the room is not an enabled space room or cannot be read