feat: matrix MCP invite_user tool

Adds an invite_user tool to the per-agent matrix MCP so an agent can invite
another user to a room it's already in (e.g. pull a peer into an existing
chat). Mirrors the existing join_room/send_dm wiring:

- protocol.rs: DaemonRequest::InviteUser { room, user_id }
- handlers.rs: invite_user — parse user_id, resolve room, room.invite_user_by_id
- socket.rs: dispatch arm
- bin/mcp.rs: invite_user tool + InviteUserArgs

room accepts an id or alias; the caller must hold a power level high enough
to invite (the homeserver error is surfaced verbatim otherwise). The invitee
then accepts via join_room. allowedTools is already '*' for the matrix server,
so the tool is exposed without a nix change.
This commit is contained in:
atlas 2026-06-05 12:06:59 +02:00 committed by mara
commit c85dcc0dec
4 changed files with 57 additions and 0 deletions

View file

@ -81,6 +81,13 @@ pub enum DaemonRequest {
#[serde(rename = "join_room")]
JoinRoom { room: String },
/// Invite `user_id` (`@user:server`) to `room` (id or alias). The
/// calling agent must already be a member with a high enough power
/// level to invite. Idempotent-ish: inviting an already-joined or
/// already-invited user surfaces the matrix error from the server.
#[serde(rename = "invite_user")]
InviteUser { room: String, user_id: String },
/// Return the count of rooms with unread notifications. Used by
/// the harness `get_loose_ends` to surface unread matrix activity
/// without exposing message content.