Features: - Direct conversations (1-to-1) auto-created and permanent - Group conversations with leave/archive support - Real-time messaging via long-polling - Offline notifications via CLAUDE.md - Auto-registration on MCP startup Architecture: - Broker: Express HTTP server + SQLite - MCP Partner: Modular tools (one file per tool) - Full documentation and API reference
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import { brokerFetch, myId } from "../shared.js";
|
|
|
|
export const definition = {
|
|
name: "list_partners",
|
|
description: "Liste tous les partenaires connectés au réseau.",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {},
|
|
},
|
|
};
|
|
|
|
export async function handler() {
|
|
try {
|
|
const { partners } = await brokerFetch("/partners");
|
|
|
|
if (!partners?.length) {
|
|
return {
|
|
content: [{ type: "text", text: "Aucun partenaire enregistré." }],
|
|
};
|
|
}
|
|
|
|
let text = "**Partenaires:**\n\n";
|
|
for (const p of partners) {
|
|
const status = p.status === "online" ? "🟢" : "⚫";
|
|
const listening = p.isListening ? " 👂" : "";
|
|
const isMe = p.id === myId ? " (toi)" : "";
|
|
const statusMsg = p.status_message ? ` — _${p.status_message}_` : "";
|
|
text += `${status}${listening} **${p.name}** (${p.id})${isMe}${statusMsg}\n`;
|
|
}
|
|
|
|
text += "\n_Légende: 🟢 en ligne, ⚫ hors ligne, 👂 en écoute_";
|
|
|
|
return {
|
|
content: [{ type: "text", text }],
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
content: [{ type: "text", text: `Erreur: ${error.message}` }],
|
|
isError: true,
|
|
};
|
|
}
|
|
}
|