@jclvsh/iris 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,11 +46,15 @@ export function registerConversationCommands(program, client) {
|
|
|
46
46
|
});
|
|
47
47
|
conversations
|
|
48
48
|
.command("create")
|
|
49
|
-
.description("find-or-create
|
|
49
|
+
.description("find-or-create a conversation for a contact (hub by default; campaign thread with --campaign-id)")
|
|
50
50
|
.requiredOption("--contact-id <id>", "contact ID to converse with")
|
|
51
|
+
.option("--campaign-id <id>", "scope to a campaign the contact belongs to")
|
|
51
52
|
.action(async (opts) => {
|
|
52
53
|
try {
|
|
53
|
-
const
|
|
54
|
+
const body = { contact_id: opts.contactId };
|
|
55
|
+
if (opts.campaignId)
|
|
56
|
+
body.campaign_id = opts.campaignId;
|
|
57
|
+
const result = await client.post("/conversations", body);
|
|
54
58
|
formatOutput(result, getFormat(program.opts()));
|
|
55
59
|
}
|
|
56
60
|
catch (error) {
|
|
@@ -47,11 +47,15 @@ export function registerConversationTools(server, client) {
|
|
|
47
47
|
return formatMcpError(error);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
server.tool("create_conversation", "find-or-create
|
|
50
|
+
server.tool("create_conversation", "find-or-create a conversation for a contact - the hub conversation by default, or the campaign-scoped thread when campaign_id is passed (contact must be in that campaign). requires write scope.", {
|
|
51
51
|
contact_id: z.string().uuid().describe("contact ID to converse with"),
|
|
52
|
-
|
|
52
|
+
campaign_id: z.string().uuid().optional().describe("scope to a campaign the contact belongs to"),
|
|
53
|
+
}, async ({ contact_id, campaign_id }) => {
|
|
53
54
|
try {
|
|
54
|
-
const
|
|
55
|
+
const body = { contact_id };
|
|
56
|
+
if (campaign_id)
|
|
57
|
+
body.campaign_id = campaign_id;
|
|
58
|
+
const result = await client.post("/conversations", body);
|
|
55
59
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
56
60
|
}
|
|
57
61
|
catch (error) {
|