Skip to main content
Glama
evlon

codebuddy-matrix-channel

by evlon

codebuddy-matrix-channel

Ein Channel-Plugin (MCP-Server), das Matrix-Chats mit lokalen CodeBuddy-Code-Sitzungen von CodeBuddy Code verbindet.

Die Wirkung entspricht den in CodeBuddy integrierten Telegram-/Discord-/WeChat-Channels:

  • Nachrichten in Matrix-Räumen senden → erscheinen als #matrix · @alice:matrix.org: Hallo in der CodeBuddy-Sitzung

  • Antworten von CodeBuddy werden über das reply-Tool zurück in den Matrix-Raum gesendet

  • Optional: Berechtigungsanfragen von CodeBuddy werden an den „Kontrollraum" weitergeleitet, wo du Tool-Aufrufe am Handy genehmigen/ablehnen kannst

Dieses Plugin basiert auf dem Channel-Erweiterungsmechanismus von CodeBuddy (siehe docs/cn/cli/channels.md und channels-reference.md) und erfordert keine Änderungen an CodeBuddy selbst.


1. Funktionsweise

Matrix 房间  ──(matrix-js-sdk 收消息)──▶  matrix-channel (本插件)
                                              │  notifications/claude/channel
                                              ▼
                                        CodeBuddy Code 会话
                                              │  reply 工具 / 权限请求
                                              ▼
                                        matrix-channel ──(sendText)──▶ Matrix 房间

Das Plugin wird als Unterprozess von CodeBuddy über stdio gestartet und kommuniziert über das MCP-Protokoll.


Related MCP server: mcacp

2. Installation

cd matrix-channel
npm install
npm run build        # 编译到 dist/(也可直接用 tsx 运行,无需构建)

Für die Laufzeit wird Node >= 20 benötigt.


2.1 Schnellstart (Digitaler Avatar)

  1. Installieren / Kompilieren

    cd matrix-channel && npm install && npm run build
  2. .env ausfüllen (minimaler funktionsfähiger Satz, siehe Abschnitt 3)

    MATRIX_HOMESERVER=https://im.yiq.pub
    MATRIX_ACCESS_TOKEN=<从 Element:设置 → 帮助 → 高级 → 访问令牌 复制>
    MATRIX_USER_ID=@evlon-ai:im.yiq.pub
    MATRIX_ALLOWLIST=@evlon:im.yiq.pub           # 防 prompt 注入,必填
    MATRIX_OWNER_ID=@evlon:im.yiq.pub            # 分身管理者=你,审批权只认此身份
    MATRIX_CONTROL_ROOM_ID=!<控制室房间ID>:im.yiq.pub
    MATRIX_MENTION_REQUIRED=true                 # 群里只响应 @分身
    # 可选:MATRIX_TRUSTED_SENDERS / MATRIX_TRUSTED_ROOMS / MATRIX_AUTHORIZED_WORK
  3. Selbsttest (nach jeder Änderung an .env zuerst ausführen)

    npm run doctor      # 期望:连接 ✅、账号 ✅、E2EE ✅
  4. CodeBuddy anbinden: In der Projekt-.mcp.json registrieren (absoluter Pfad) und dann starten

    codebuddy --channels server:matrix --dangerously-load-development-channels
  5. Tägliche Nutzung

    • Im Gruppenchat @Avatar Aufgaben zuweisen → vertrauenswürdige Quellen/autorisierte Arbeiten werden automatisch ausgeführt; unbekannte Arbeiten erstellen zuerst einen Plan und warten im Kontrollraum auf dein approve.

    • Hochrisiko-Tools (Bash/Dateien schreiben usw.) fragen dich immer im Kontrollraum.

    • Du gibst Befehle im Kontrollraum (nur MATRIX_OWNER_ID wird akzeptiert):

      • approve (run / go, optional mit Raum-ID) → autorisiert Aufgaben in diesem Raum

      • yes <id> / no <id> → genehmigt / lehnt wartende Hochrisiko-Berechtigungsanfragen ab

Für verschlüsselte Gruppen ist MATRIX_E2EE=true erforderlich; wenn MATRIX_DEVICE_ID leer bleibt, wird automatisch aus /devices ausgewählt. Bei Fehlern die Geräte-ID aus „Einstellungen → Geräte" eintragen.


3. Konfiguration

Kopiere .env.example zu .env und fülle es aus:

cp .env.example .env

Variable

Beschreibung

MATRIX_HOMESERVER

Homeserver-Adresse, z. B. https://matrix.org (Pflichtfeld)

MATRIX_ACCESS_TOKEN

Access_token des Kontos (empfohlen; aus Element unter „Einstellungen → Hilfe" kopieren)

MATRIX_USER_ID

Optional, zur Erkennung der „eigenen Nachrichten", z. B. @alice:matrix.org

MATRIX_USER / MATRIX_PASSWORD

Alternative Authentifizierungsmethode; beim Start wird loginWithPassword zum Token-Austausch verwendet

MATRIX_ALLOWLIST

Erlaubte Absender-Benutzer-IDs für Nachrichten, kommagetrennt (unbedingt konfigurieren)

MATRIX_ROOM_ALLOWLIST

Erlaubte Raum-IDs zum Abhören, kommagetrennt (leer = alle)

MATRIX_CONTROL_ROOM_ID

Raum-ID des Berechtigungs-Relay-Kontrollraums (optional, aber im Digitalen-Avatar-Modus Pflichtfeld)

MATRIX_OWNER_ID

Matrix-Benutzer-ID des Avatar-Managers (Owner) (Pflichtfeld). Genehmigungsrechte gelten nur für diese Identität

MATRIX_TRUSTED_SENDERS

Vertrauenswürdige Kollegen-Benutzer-IDs, kommagetrennt; deren Arbeiten werden automatisch ausgeführt (sichere Tools)

MATRIX_TRUSTED_ROOMS

Vertrauenswürdige Gruppen-IDs, kommagetrennt; alle Arbeiten in diesen Räumen werden automatisch ausgeführt

MATRIX_AUTHORIZED_WORK

Beschreibung autorisierter Routinearbeiten (Freitext), damit der Avatar „häufig vs. unbekannt" unterscheiden kann

MATRIX_MENTION_REQUIRED

Ob in Gruppen nur auf @-Erwähnungen reagiert wird (Standard true; bei mehreren Avataren empfohlen)

MATRIX_HIGH_RISK_TOOLS

Liste der Hochrisiko-Tools, kommagetrennt; Standard Bash,Write,Edit,MultiEdit,NotebookEdit

MATRIX_DOWNLOAD_MEDIA

Ob Bilder/Dateien lokal heruntergeladen und als [file: Pfad] eingefügt werden (Standard false)

MATRIX_MEDIA_DIR

Medien-Download-Verzeichnis (Standard .matrix-media)

MATRIX_E2EE

Ob Ende-zu-Ende-Verschlüsselung aktiviert ist (Standard false, siehe Abschnitt 6 unten)

MATRIX_CRYPTO_DB

Hat bei matrix-js-sdk 42.x keine Wirkung (siehe Abschnitt 6): Rust-Crypto läuft über wasm + fake-indexeddb-Speicher-Shim, Schlüssel werden nicht auf der Festplatte gespeichert. Leer lassen

⚠️ Sicherheit: MATRIX_ALLOWLIST unbedingt konfigurieren (Prüfung nach Absender statt Raum, um Injektionen durch beliebige Mitglieder im Gruppenchat zu vermeiden). Leer lassen erlaubt allen, nur für lokale Tests geeignet.


4. Anbindung an CodeBuddy

Variante A: Entwicklungsphase (Markt-Whitelist umgehen)

Registriere dieses Plugin in der .mcp.json deines CodeBuddy-Projekts:

{
  "mcpServers": {
    "matrix": {
      "command": "npx",
      "args": ["tsx", "/绝对路径/matrix-channel/src/index.ts"]
    }
  }
}

Dann CodeBuddy starten:

codebuddy --channels server:matrix --dangerously-load-development-channels

Nach dem Kompilieren kann die Ausführung mit node wie folgt geändert werden:

"args": ["node", "/绝对路径/matrix-channel/dist/index.js"]

Variante B: Als Plugin verpacken (nach Einreichung im offiziellen Markt)

npm run build

Dann codebuddy-matrix-channel als Plugin veröffentlichen und anschließend verwenden:

codebuddy --channels plugin:matrix-channel@<你的市场>

5. Verwendung

  1. Nach dem Start Nachrichten in erlaubten Matrix-Räumen senden; in der CodeBuddy-Sitzung erscheint #matrix · @du: ...

  2. Nach Abschluss der Verarbeitung durch CodeBuddy erscheint die Antwort im Matrix-Raum

  3. Wenn MATRIX_CONTROL_ROOM_ID konfiguriert ist: Bei Tool-Aufrufen, die eine Genehmigung erfordern (Bash / Write usw.), erhält der Kontrollraum eine Benachrichtigung (als m.notice-Systemnachricht gesendet, ohne Ungelesen/Erinnerungen auszulösen); mit yes <id> genehmigen / no <id> ablehnen

Parameter des reply-Tools

Parameter

Beschreibung

chat_id

Matrix-Raum-ID (aus dem chat_id-Attribut des Nachrichten-Tags in der Sitzung)

text

Der zu sendende Text

html

Optional, HTML-Inhalt (wird zusammen mit text gesendet, im Format org.matrix.custom.html)

msgtype

Optional, m.text (Standard, normale Nachricht) oder m.notice (Systemnachricht: löst im Client kein Ungelesen/Erinnerung/Benachrichtigung aus)

Beispiel: CodeBuddy eine Statusmeldung mit m.notice zurücksenden lassen: reply({ chat_id: "!abc:server", text: "Verarbeitet", msgtype: "m.notice" }).

health_check-Tool

Kann direkt in der CodeBuddy-Sitzung aufgerufen oder im /mcp-Health-Check ausgelöst werden; entspricht dem Konnektivitäts-/E2EE-Teil von npm run doctor und gibt JSON zurück:

{ "ok": true, "userId": "@alice:matrix.org", "e2ee": true, "cryptoReady": true }

Bei ok=false wird ein error-Feld mit der Fehlerursache angehängt (Verbindung/Authentifizierung/E2EE-Initialisierung).


6. Einschränkungen und Hinweise

  • Ende-zu-Ende-verschlüsselte (E2EE) Räume: Standardmäßig werden nur unverschlüsselte Räume unterstützt. Zum Überbrücken verschlüsselter Räume MATRIX_E2EE=true setzen; das Plugin nutzt dann die in matrix-js-sdk integrierte Rust-Crypto (initRustCrypto), wobei das SDK automatisch „beim Empfang entschlüsseln, beim Senden verschlüsseln" übernimmt – kein eigenes Verschlüsselungsprotokoll nötig. Nach Aktivierung:

    • Verschlüsselte Nachrichten treffen als m.room.encrypted ein; nach der Entschlüsselung durch das SDK (Event.decrypted) wird der Typ zum echten Typ und das Plugin leitet sie an die Sitzung weiter;

    • Antworten an verschlüsselte Räume werden vom SDK automatisch verschlüsselt;

    • Schlüsselspeicherung (wichtig, versionsabhängig): Bei matrix-js-sdk 42.x hat das Rust-Crypto-Backend nur eine wasm/IndexedDB-Implementierung (@matrix-org/matrix-sdk-crypto-wasm), kein natives Node-Backend. Damit es unter Node läuft, injiziert das Plugin beim Start mit fake-indexeddb/auto einen globalen indexedDB-Shim in Node – dieser Shim ist rein speicherbasiert, daher:

      • Schlüssel existieren nur im Prozessspeicher; MATRIX_CRYPTO_DB erzeugt in dieser Version keine echte SQLite-Datei auf der Festplatte; nach einem Prozessneustart müssen Schlüssel neu ausgehandelt werden (beeinträchtigt Senden/Empfangen nicht, erfordert nur erneuten Schlüsselaustausch/Geräteverifizierung).

      • Echte Festplatten-Persistenz erfordert ein Upgrade auf eine matrix-js-sdk-Version mit nativem @matrix-org/matrix-sdk-crypto-nodejs-Backend oder eine zukünftige Version mit nodejs-Einstieg (dann den fake-indexeddb-Shim entfernen und das native Backend verwenden).

      • Hinweis: Das in den Abhängigkeiten bereits installierte @matrix-org/matrix-sdk-crypto-nodejs wird unter der aktuellen 42.2.0 nicht vom SDK aufgerufen und dient nur als Option für zukünftige Upgrades; der aktuelle Verschlüsselungskern arbeitet über wasm + fake-indexeddb-Speicher-Shim.

    • Beim ersten Betreten eines verschlüsselten Raums mit einem neuen Gerät wird empfohlen, im Matrix-Client das Gerät dieses Bots zu verifizieren (sonst kann der Gegenüber den Hinweis „nicht verifiziertes Gerät" sehen, Nachrichten funktionieren aber weiterhin normal).

  • Medien: Standardmäßig wird nur der Nachrichtentext in die Sitzung überbrückt; mit MATRIX_DOWNLOAD_MEDIA werden Bilder/Dateien lokal heruntergeladen und als [file: Pfad] eingefügt, damit der Agent sie lesen kann.

  • Berechtigungs-Relay hängt von der claude/channel/permission-Fähigkeit von CodeBuddy ab; wenn die CodeBuddy-Version diese nicht unterstützt, bleibt die Kern-Chat-Brücke davon unberührt.


7. Digitaler Avatar: Autorisierungsmodell des Managers (Kern-Szenario)

Behandle den Avatar als „Kollegen im Gruppenchat", der beliebig per @ beauftragt werden kann, aber vor der Zustimmung des Managers nichts wirklich ändert.

Szenario

  • Kollegen erstellen mehrere Gruppen (z. B. #ProjektA, #Kundenservice), in denen gleichzeitig mehrere Avatar-Bots sein können. Kollegen beauftragen deinen Avatar per @ im Gruppenchat; nur bei @-Erwähnung wird reagiert (bei direkten Privatnachrichten immer).

  • Nach Erhalt eines Auftrags:

    • Häufige / autorisierte Arbeiten (von deinen voreingestellten MATRIX_TRUSTED_SENDERS / MATRIX_TRUSTED_ROOMS oder im Rahmen von MATRIX_AUTHORIZED_WORK) → automatisch ausführen (sichere Tools).

    • Unbekannte Arbeiten (nicht im Autorisierungsbereich) → der Avatar erstellt zuerst einen Plan und eskaliert über request_approval an deinen Kontrollraum; erst nach deinem approve wird ausgeführt.

    • Hochrisiko-Operationen (MATRIX_HIGH_RISK_TOOLS, z. B. Bash / Dateien schreiben) → unabhängig von der Quelle immer bei dir anfragen.

Architektur-Ebenen

  • MCP-Plugin = sichere Übertragung + harte Sperre (code-erzwungen, vertraut dem Modell nicht): @-Filter, Berechtigungsentscheidung allow/deny basiert nur auf verifizierbaren Fakten (ob Owner, ob vertrauenswürdige Quelle, ob Hochrisiko-Tool), Kontrollraum-Genehmigungen erkennen nur MATRIX_OWNER_ID.

  • SKILL = Strategie-Gehirn (semantische Beurteilung, dem Agent überlassen): skills/matrix-avatar/SKILL.md leitet den Avatar bei der Unterscheidung „häufig vs. unbekannt"; bei Unbekanntem wechselt er in den Planungsmodus und ruft request_approval auf. Der Agent beantragt nur Genehmigungen, gibt sich nie selbst frei; Freigaben kommen nur von „vertrauenswürdigen Quellen des Managers" oder „Manager-approve".

Die im Plugin integrierten Channel-instructions enthalten diese Strategie bereits inline, sodass es auch ohne zusätzliche SKILL-Installation funktioniert; skills/matrix-avatar/SKILL.md steht dir zur Wiederverwendung/Feinabstimmung in CodeBuddy zur Verfügung.

Drei-Ebenen-Aufgabenstatus (pro Raum)

Status

Bedeutung

Sichere Tools

Hochrisiko-Tools

approved

Vertrauenswürdige Quelle / bereits approve

automatisch ausführen

beim Manager anfragen (Kontrollraum yes)

pending

Eskaliert, wartet auf Prüfung (request_approval)

blockiert

blockiert

unauthorized

Unbekannte Quelle, nicht autorisiert

blockiert

blockiert (und approve vorschlagen)

Kontrollraum-Befehle (nur für Manager MATRIX_OWNER_ID gültig)

  • approve (oder run / go, optional mit Raum-ID, z. B. approve !projectA:server) → autorisiert die aktuelle Aufgabe in diesem Raum, der Avatar beginnt mit der Ausführung.

  • yes <id> / no <id> → genehmigt / lehnt wartende Hochrisiko-Berechtigungsanfragen ab.

  • Antworten anderer im Kontrollraum werden ignoriert.

Konfigurationsbeispiel (.env)

MATRIX_OWNER_ID=@you:matrix.org
MATRIX_TRUSTED_SENDERS=@alice:matrix.org,@bob:matrix.org
MATRIX_TRUSTED_ROOMS=!projectA:server
MATRIX_AUTHORIZED_WORK=回答产品问题、总结会议纪要、起草文档
MATRIX_MENTION_REQUIRED=true
MATRIX_HIGH_RISK_TOOLS=Bash,Write,Edit,MultiEdit,NotebookEdit

8. Selbsttest (doctor)

Nach dem Ausfüllen der .env kann zuerst ein Selbsttest zur Bestätigung von Konfiguration, Konnektivität und E2EE-Status ausgeführt werden, bevor CodeBuddy gestartet wird:

npm run doctor

Der Selbsttest gibt die aktuelle Konfiguration aus (Token maskiert), prüft die Erreichbarkeit des Homeservers und die Gültigkeit der Anmeldedaten und versucht bei MATRIX_E2EE=true die Initialisierung der Rust-Crypto. Bei jedem Fehler wird eine klare Ursache angegeben und mit einem Exit-Code ungleich 0 beendet.


9. Verzeichnisstruktur

matrix-channel/
├── src/
│   ├── config.ts     # 环境变量 / 白名单 / 授权配置读取与校验
│   ├── matrix.ts     # Matrix 客户端封装(连接、@提及过滤、收/发、下载媒体、E2EE、自检)
│   ├── index.ts      # MCP 服务:channel 通知、授权硬闸、reply / request_approval 工具、控制室审批
│   └── doctor.ts     # `npm run doctor` 自检入口
├── skills/
│   └── matrix-avatar/
│       └── SKILL.md  # 分身行为策略(语义判断:常用 vs 陌生)
├── package.json
├── tsconfig.json
├── .gitignore
├── .env.example
└── README.md

Available Tools

6 tools
health_checkA

运行连接/E2EE 自检(等价于 npm run doctor),返回 Matrix 连接与加密状态。可在 /mcp 健康检查中调用。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool performs a diagnostic self-check and returns connection and encryption status, which implies a read-only probe. It does not explicitly say it has no side effects, but the self-check framing makes the behavior sufficiently transparent for a zero-parameter tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one compact sentence that front-loads the action and scope, then adds the return value and invocation context. Every clause earns its place; there is no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple zero-parameter diagnostic tool with no output schema, the description covers purpose, method, return value, and invocation context. Nothing essential is missing for an agent to select and call the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters and schema description coverage is 100%, so there is nothing for the description to clarify. Baseline for zero parameters is 4, and the description adds no conflicting or misleading parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource: it runs a connection/E2EE self-check equivalent to 'npm run doctor' and returns Matrix connection and encryption status. It also distinguishes this health-check tool from the messaging/approval-oriented sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear usage context by stating it can be invoked during /mcp health checks and is for checking connection/encryption status. It does not explicitly name when-not-to-use conditions, but the sibling tools are clearly different in purpose, so the distinction is implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_roomsA

列出本分身已加入的所有 Matrix 房间(room_id + 标题),用于了解「我在哪些房间 / 群」。当不知道该回哪个房间时,可据此找到与管理者(owner)的私聊房间。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and discloses the scope (only rooms the avatar has joined) and the output content (room_id + title). For a read-only, zero-parameter listing tool this is adequate, though it omits minor traits like ordering, pagination, and whether the owner room is guaranteed to exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with zero filler. The first sentence front-loads the core purpose and output fields; the second adds a practical decision aid without repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 0-parameter list tool with no output schema, the description covers what is listed, what fields come back, and when to use it. Minor gaps (e.g., behavior when no rooms exist, pagination) are low-stakes for a read-only listing, so nothing critical is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so schema coverage is trivially 100% and there is nothing to document. The baseline of 4 applies because no parameter semantics are needed; the description appropriately spends its effort on output and scope instead.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb (列出/list) and resource (all Matrix rooms this avatar has joined), and explicitly states the returned fields (room_id + title). The scope '本分身已加入' clearly separates it from per-room siblings like room_info and room_members, so an agent can tell them apart without opening another schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides a concrete usage scenario: when unsure which room to reply to, use this tool to locate the owner's private chat room. It does not, however, name alternatives or state when not to use it (e.g., room_info for a single room's details), so it lacks explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

replyA

通过 Matrix 把回复发送到指定房间(chat_id)。省略 chat_id 时回复发往最近一次转发进来的房间(原路返回)。发送会按配置自动重试;若多次仍发不回来源房间,则改用默认回复(MATRIX_DEFAULT_REPLY)发往控制室/owner 私聊兜底。

ParametersJSON Schema
NameRequiredDescriptionDefault
htmlNo可选,HTML 格式正文(与 text 同时发送)
textYes要发送的文本
chat_idNoMatrix 房间 ID,例如 !abc:server。省略时回复发往最近一次转发进来的房间。
msgtypeNo消息类型:m.text 普通消息;m.notice 系统提示(不触发未读/提醒)

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

没有 annotations,因此描述承担了全部行为披露责任。描述主动说明了自动重试机制、失败后的默认回复兜底行为(发往控制室/owner 私聊),以及原路返回的逻辑,这些都是非显而易见的关键行为。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

描述短小精悍,三句话分别说明核心操作、chat_id 省略行为和重试/兜底机制,信息密度高且没有冗余。关键行为前置,结构清晰。

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

对于发送消息类工具,描述配合完整 schema 已覆盖调用所需信息:目标房间、默认回退行为、重试和失败兜底。没有输出 schema 也不影响理解,整体上下文完整。

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema 描述覆盖率为 100%,所有参数在 schema 中已有说明。描述额外强调了 chat_id 省略时的行为,但 schema 中同样包含该信息,因此描述在参数语义上未显著超出 schema 提供的价值。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述明确说明该工具通过 Matrix 发送回复到指定房间,并解释了省略 chat_id 时的原路返回行为。动词和资源都很具体,与 list_rooms、room_info 等只读查询类兄弟工具形成清晰区分。

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

描述清晰说明了何时使用该工具(发送回复)以及省略 chat_id 时的行为,但未明确提及何时不应使用或列举替代工具。整体使用场景清楚,只是缺少显式的排他性说明。

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

request_approvalA

当判断当前任务来自陌生来源或含高风险时调用,把任务升级到管理者控制室等待审批。管理者回复 approve 后任务会被重放并执行。

ParametersJSON Schema
NameRequiredDescriptionDefault
reasonYes需要审批的原因/计划摘要

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that the task is escalated, that it waits for approval, and that it will be replayed and executed after the manager replies 'approve'. It does not mention rejection behavior, but the core lifecycle is clearly disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one concise sentence that front-loads the trigger condition, then states the action and outcome. Every part is informative and there is no redundant wording.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with a single required parameter and no output schema, the description covers the key context: when to call, what happens, and what triggers execution. It does not specify behavior on rejection, but the overall guidance is sufficient for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already covers the single parameter 'reason' with 100% coverage, including its meaning as the approval reason or plan summary. The description adds no further parameter-level detail, so the baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies a specific action: escalating the current task to a manager control room for approval. It also gives the triggering condition ('unfamiliar source or high risk'), which distinguishes it from the sibling tools like reply, health_check, and list_rooms.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: when the task is from an unfamiliar source or carries high risk. It does not explicitly list alternatives or exclusions, but the condition is clear enough that an agent can decide appropriately.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

room_infoA

获取指定 Matrix 房间(群/私聊)的可读信息:名称、主题、成员昵称与 ID。用于配置与检查「房间 ID ↔ 名称」映射。chat_id 省略时取最近一次转发进来的房间。

ParametersJSON Schema
NameRequiredDescriptionDefault
chat_idNoMatrix 房间 ID,例如 !abc:server。省略时取最近对话房间。

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the behavioral disclosure burden. It does disclose that the operation retrieves readable info and defines the default behavior when chat_id is omitted, which is useful. However, it does not explicitly state that the operation has no side effects, what happens on invalid room IDs, or any permission requirements — gaps that matter for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no filler. The first sentence states the tool's purpose and outputs, the second gives the use case and default behavior. Critical information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple getter with one optional parameter, the description is mostly complete: it lists return fields, the use case, and the fallback behavior. Since there is no output schema, describing the expected fields is important and done here. Minor omissions around error/not-found behavior prevent a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value beyond the schema by clarifying that 'recent conversation' specifically means the most recently forwarded room, and by explaining why chat_id is optional in terms of the mapping use case.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies a clear verb ('获取' / get) and resource ('指定 Matrix 房间'), and lists the exact data returned (name, topic, member nicknames and IDs). It does not explicitly contrast itself with siblings such as list_rooms or room_members, but the resource scope and output fields are specific enough to distinguish it without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states a concrete use case: configuring and checking the 'room ID ↔ name' mapping. It also explains the optional chat_id behavior (fallback to the most recently forwarded room), which guides when to call the tool without an argument. No alternatives or when-not-to-use conditions are mentioned, hence not a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

room_membersA

获取指定 Matrix 房间(群聊)的在场成员列表,返回每个成员的 user_id 与 display_name,用于了解「谁在场」。chat_id 省略时取最近一次转发进来的房间。

ParametersJSON Schema
NameRequiredDescriptionDefault
chat_idNoMatrix 房间 ID,例如 !abc:server。省略时取最近对话房间。

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

无 annotations,描述承担行为说明职责。它说明了工具是只读查询、返回成员列表并解释 chat_id 缺省行为,但未披露任何可能的权限要求、失败情形或数据即时性等行为特征。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

两句话完整说明用途、返回值与缺省行为,信息密度高且无冗余,属于精炼的合格描述。

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

对单参数只读列表工具,描述已说明返回字段、缺省行为和使用场景;缺少输出结构样例或错误条件,但整体足以让 agent 正确调用。

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

参数仅有 chat_id,schema 已包含描述;描述额外说明了省略 chat_id 时的默认行为(取最近对话房间),为参数语义增加了超出 schema 的价值。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述使用明确动词「获取」与资源「指定 Matrix 房间(群聊)的在场成员列表」,并具体说明返回 user_id 与 display_name,足以与 siblings 如 list_rooms、room_info 区分。

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

描述说明 chat_id 省略时取最近转发进来的房间,提供了明确的使用上下文;但未明确说明何时不使用本工具(例如需要房间详情时用 room_info),因此未达满分。

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv0.1.0
    • First observedhealth_check
    • First observedlist_rooms
    • First observedreply
    • First observedrequest_approval
    • First observedroom_info
    • First observedroom_members

TDQS

A4.1/5.0

Scored across 6 tools

Disambiguation4/5

The tools are mostly distinct: reply, health_check, request_approval, list_rooms, room_members, and room_info each target a different action or resource. The only mild overlap is between room_info and room_members, since room_info also includes member names/IDs, but the descriptions are clear enough to guide selection.

Naming Consistency3/5

All names are lowercase snake_case, but the semantic pattern is mixed: reply is a bare verb, list_rooms and request_approval are verb+noun, while room_members and room_info are noun+noun descriptors. This is readable but not consistently a verb_noun convention.

Tool Count5/5

Six tools is a tight, well-scoped set for a Matrix channel bridge. Each tool supports a distinct part of the workflow—responding, verifying health, escalating approval, and discovering rooms and participants—without redundancy or bloat.

Completeness4/5

The set covers the core bot workflow on a Matrix channel: replying, understanding room context, checking connection health, and handling approval escalation. Minor gaps like joining/leaving rooms or reading message history exist, but they are outside the apparent core purpose and do not create dead ends.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers