mcp-claude-duo/mcp-partner/tools/leave_conversation.js
StillHammer 66e5c677ea v3.0 - Conversation-based messaging system
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
2026-01-25 02:57:24 +07:00

45 lines
1.1 KiB
JavaScript

import { brokerFetch, myId, ensureRegistered } from "../shared.js";
export const definition = {
name: "leave_conversation",
description: "Quitte une conversation de groupe. Impossible de quitter une conv directe.",
inputSchema: {
type: "object",
properties: {
conversation: {
type: "string",
description: "ID de la conversation à quitter",
},
},
required: ["conversation"],
},
};
export async function handler(args) {
try {
await ensureRegistered();
const response = await brokerFetch(`/conversations/${args.conversation}/leave`, {
method: "POST",
body: JSON.stringify({ partnerId: myId }),
});
if (response.error) {
return {
content: [{ type: "text", text: `Erreur: ${response.error}` }],
isError: true,
};
}
const archived = response.archived ? " (conversation archivée car plus de participants)" : "";
return {
content: [{ type: "text", text: `Tu as quitté la conversation.${archived}` }],
};
} catch (error) {
return {
content: [{ type: "text", text: `Erreur: ${error.message}` }],
isError: true,
};
}
}