hive-matrix-mcp: add send_redact tool to delete matrix events
This commit is contained in:
parent
79af902d47
commit
1c0f7a72f7
4 changed files with 106 additions and 3 deletions
|
|
@ -162,6 +162,20 @@ struct MarkReadArgs {
|
|||
account: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
struct SendRedactArgs {
|
||||
room: String,
|
||||
/// Full matrix event id of the message to redact.
|
||||
event_id: String,
|
||||
/// Optional human-readable reason recorded on the redaction event.
|
||||
#[serde(default)]
|
||||
reason: Option<String>,
|
||||
/// Matrix account to act as (a `name` from `hyperhive.matrixAccounts`).
|
||||
/// Omit to use the agent's primary account.
|
||||
#[serde(default)]
|
||||
account: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
struct ListRoomsArgs {
|
||||
/// Matrix account to act as (a `name` from `hyperhive.matrixAccounts`).
|
||||
|
|
@ -399,6 +413,24 @@ impl MatrixBridge {
|
|||
)
|
||||
}
|
||||
|
||||
#[tool(description = "Redact (delete) a specific matrix event in a room — \
|
||||
asks the homeserver to strip the event's content, optionally with a \
|
||||
`reason`. Works on your own events; redacting others' needs moderator \
|
||||
power level. Irreversible.")]
|
||||
async fn send_redact(&self, Parameters(args): Parameters<SendRedactArgs>) -> String {
|
||||
render(
|
||||
call(
|
||||
args.account,
|
||||
DaemonOp::SendRedact {
|
||||
room: args.room,
|
||||
event_id: args.event_id,
|
||||
reason: args.reason,
|
||||
},
|
||||
)
|
||||
.await,
|
||||
)
|
||||
}
|
||||
|
||||
#[tool(
|
||||
description = "List rooms this agent has joined. Each row has the room \
|
||||
id, canonical alias (when set), display name, and joined-member count."
|
||||
|
|
@ -523,7 +555,8 @@ impl MatrixBridge {
|
|||
#[tool_handler(instructions = "Matrix client for an agent on a hyperhive swarm. Use \
|
||||
`send_message` to post in a joined room, `send_dm` to message a \
|
||||
specific user, `send_reaction` to react with an emoji, `send_reply` \
|
||||
to thread a reply, `mark_read` to acknowledge an event. Discover \
|
||||
to thread a reply, `mark_read` to acknowledge an event, `send_redact` \
|
||||
to delete an event. Discover \
|
||||
rooms with `list_rooms`, members with `list_room_members`, recent \
|
||||
timeline with `read_room`. See pending invites with `list_invites`; \
|
||||
accept or reject an invite with `resolve_invite`; join a public \
|
||||
|
|
|
|||
Loading…
Reference in a new issue