@respond-io/mcp-server 1.0.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.
- package/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/README.md +635 -0
- package/dist/constants.d.ts +89 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +143 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/TokenVerifier.d.ts +19 -0
- package/dist/middlewares/TokenVerifier.d.ts.map +1 -0
- package/dist/middlewares/TokenVerifier.js +68 -0
- package/dist/middlewares/TokenVerifier.js.map +1 -0
- package/dist/protocol/BaseProtocol.d.ts +4 -0
- package/dist/protocol/BaseProtocol.d.ts.map +1 -0
- package/dist/protocol/BaseProtocol.js +7 -0
- package/dist/protocol/BaseProtocol.js.map +1 -0
- package/dist/protocol/HttpStreamProtocol.d.ts +36 -0
- package/dist/protocol/HttpStreamProtocol.d.ts.map +1 -0
- package/dist/protocol/HttpStreamProtocol.js +148 -0
- package/dist/protocol/HttpStreamProtocol.js.map +1 -0
- package/dist/protocol/StdioProtocol.d.ts +14 -0
- package/dist/protocol/StdioProtocol.d.ts.map +1 -0
- package/dist/protocol/StdioProtocol.js +32 -0
- package/dist/protocol/StdioProtocol.js.map +1 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +4 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +36 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/BaseTool.d.ts +38 -0
- package/dist/tools/BaseTool.d.ts.map +1 -0
- package/dist/tools/BaseTool.js +39 -0
- package/dist/tools/BaseTool.js.map +1 -0
- package/dist/tools/comment.tool.d.ts +14 -0
- package/dist/tools/comment.tool.d.ts.map +1 -0
- package/dist/tools/comment.tool.js +43 -0
- package/dist/tools/comment.tool.js.map +1 -0
- package/dist/tools/contacts.tool.d.ts +17 -0
- package/dist/tools/contacts.tool.d.ts.map +1 -0
- package/dist/tools/contacts.tool.js +355 -0
- package/dist/tools/contacts.tool.js.map +1 -0
- package/dist/tools/conversation.tool.d.ts +14 -0
- package/dist/tools/conversation.tool.d.ts.map +1 -0
- package/dist/tools/conversation.tool.js +77 -0
- package/dist/tools/conversation.tool.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +7 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/messaging.tool.d.ts +15 -0
- package/dist/tools/messaging.tool.d.ts.map +1 -0
- package/dist/tools/messaging.tool.js +160 -0
- package/dist/tools/messaging.tool.js.map +1 -0
- package/dist/tools/workspace.tool.d.ts +15 -0
- package/dist/tools/workspace.tool.d.ts.map +1 -0
- package/dist/tools/workspace.tool.js +282 -0
- package/dist/tools/workspace.tool.js.map +1 -0
- package/dist/types.d.ts +351 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/api.d.ts +127 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +340 -0
- package/dist/utils/api.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.tool.js","sourceRoot":"","sources":["../../src/tools/contacts.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAIzB;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC;;;;OAIG;IACO,KAAK,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AAE,KAAK,EAAE,GAAG,IAAoD,CAAC;gBACnF,IAAI,CAAC;oBACH,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAU,CAAC,CAAC;oBAC1E,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;oBAGhE,MAAM,OAAO,GACX,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAE,IAAoC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oBAC1F,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;oBACtF,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;SACF;KACF,CAAC;CACH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseTool } from "./BaseTool.js";
|
|
2
|
+
import { Tool } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A tool for managing conversations.
|
|
5
|
+
* This tool provides functionalities for assigning conversations to users and updating their status.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConversationTool extends BaseTool {
|
|
8
|
+
/**
|
|
9
|
+
* The list of tools provided by the ConversationTool.
|
|
10
|
+
* It includes tools for assigning a conversation and updating its status.
|
|
11
|
+
*/
|
|
12
|
+
protected tools: Tool[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=conversation.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.tool.d.ts","sourceRoot":"","sources":["../../src/tools/conversation.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,OAAO,EAAO,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAiErB;CACH"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseTool } from "./BaseTool.js";
|
|
3
|
+
import { createSdkClient, formatContactIdentifier, handleSdkError, handleSdkResponse, } from "../utils/api.js";
|
|
4
|
+
/**
|
|
5
|
+
* A tool for managing conversations.
|
|
6
|
+
* This tool provides functionalities for assigning conversations to users and updating their status.
|
|
7
|
+
*/
|
|
8
|
+
export class ConversationTool extends BaseTool {
|
|
9
|
+
/**
|
|
10
|
+
* The list of tools provided by the ConversationTool.
|
|
11
|
+
* It includes tools for assigning a conversation and updating its status.
|
|
12
|
+
*/
|
|
13
|
+
tools = [
|
|
14
|
+
{
|
|
15
|
+
name: "assign_conversation",
|
|
16
|
+
description: "Assign or unassign a conversation to a user.",
|
|
17
|
+
schema: {
|
|
18
|
+
identifier: z
|
|
19
|
+
.string()
|
|
20
|
+
.describe("The contact's identifier. Can be the contact's ID, email, or phone number."),
|
|
21
|
+
assignee: z
|
|
22
|
+
.string()
|
|
23
|
+
.nullable()
|
|
24
|
+
.describe("The user ID or email of the assignee. Set to null to unassign."),
|
|
25
|
+
},
|
|
26
|
+
handler: async (args, ctx) => {
|
|
27
|
+
const { identifier, assignee } = args;
|
|
28
|
+
try {
|
|
29
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
30
|
+
const formattedIdentifier = formatContactIdentifier(identifier);
|
|
31
|
+
const result = await sdkClient.conversations.assign(formattedIdentifier, { assignee });
|
|
32
|
+
return handleSdkResponse(result);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return handleSdkError(error);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "update_conversation_status",
|
|
41
|
+
description: "Open or close a conversation.",
|
|
42
|
+
schema: {
|
|
43
|
+
identifier: z
|
|
44
|
+
.string()
|
|
45
|
+
.describe("The contact's identifier. Can be the contact's ID, email, or phone number."),
|
|
46
|
+
status: z
|
|
47
|
+
.enum(["open", "close"])
|
|
48
|
+
.describe("The desired conversation status, either 'open' or 'close'."),
|
|
49
|
+
category: z
|
|
50
|
+
.string()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("The closing note category, required when closing a conversation."),
|
|
53
|
+
summary: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("A summary of the conversation, required when closing."),
|
|
57
|
+
},
|
|
58
|
+
handler: async (args, ctx) => {
|
|
59
|
+
const { identifier, status, category, summary } = args;
|
|
60
|
+
try {
|
|
61
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
62
|
+
const formattedIdentifier = formatContactIdentifier(identifier);
|
|
63
|
+
const result = await sdkClient.conversations.updateStatus(formattedIdentifier, {
|
|
64
|
+
status: status,
|
|
65
|
+
category,
|
|
66
|
+
summary,
|
|
67
|
+
});
|
|
68
|
+
return handleSdkResponse(result);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return handleSdkError(error);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=conversation.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.tool.js","sourceRoot":"","sources":["../../src/tools/conversation.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB;;;GAGG;AACH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,EAAE;qBACV,QAAQ,CAAC,kEAAkE,CAAC;gBAC/E,OAAO,EAAE,CAAC;qBACP,MAAM,EAAE;qBACR,QAAQ,EAAE;qBACV,QAAQ,CAAC,uDAAuD,CAAC;aACrE;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;gBAC3B,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAKjD,CAAC;gBACF,IAAI,CAAC;oBACH,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAU,CAAC,CAAC;oBAC1E,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;oBAChE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,YAAY,CAAC,mBAAmB,EAAE;wBAC7E,MAAM,EAAE,MAA0B;wBAClC,QAAQ;wBACR,OAAO;qBACR,CAAC,CAAC;oBACH,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;SACF;KACF,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseTool } from "./BaseTool.js";
|
|
2
|
+
import { Tool } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A tool for sending and retrieving messages.
|
|
5
|
+
* This tool provides functionalities for sending various types of messages to a contact,
|
|
6
|
+
* retrieving a specific message by its ID, and listing messages for a contact.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MessagingTool extends BaseTool {
|
|
9
|
+
/**
|
|
10
|
+
* The list of tools provided by the MessagingTool.
|
|
11
|
+
* It includes tools for sending a message, getting a message, and listing messages.
|
|
12
|
+
*/
|
|
13
|
+
protected tools: Tool[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=messaging.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.tool.d.ts","sourceRoot":"","sources":["../../src/tools/messaging.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,OAAO,EAAO,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAgKrB;CACH"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseTool } from "./BaseTool.js";
|
|
3
|
+
import { createSdkClient, formatContactIdentifier, handleSdkError, handleSdkResponse, } from "../utils/api.js";
|
|
4
|
+
/**
|
|
5
|
+
* A tool for sending and retrieving messages.
|
|
6
|
+
* This tool provides functionalities for sending various types of messages to a contact,
|
|
7
|
+
* retrieving a specific message by its ID, and listing messages for a contact.
|
|
8
|
+
*/
|
|
9
|
+
export class MessagingTool extends BaseTool {
|
|
10
|
+
/**
|
|
11
|
+
* The list of tools provided by the MessagingTool.
|
|
12
|
+
* It includes tools for sending a message, getting a message, and listing messages.
|
|
13
|
+
*/
|
|
14
|
+
tools = [
|
|
15
|
+
{
|
|
16
|
+
name: "send_message",
|
|
17
|
+
description: "Send a message to a contact through a specific channel.",
|
|
18
|
+
schema: {
|
|
19
|
+
identifier: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe("The contact's identifier. Can be the contact's ID, email, or phone number."),
|
|
22
|
+
channelId: z
|
|
23
|
+
.number()
|
|
24
|
+
.nullable()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("The channel ID to send the message from. If null, the last interacted channel will be used."),
|
|
27
|
+
messageType: z
|
|
28
|
+
.enum(["text", "attachment", "whatsapp_template", "email", "quick_reply"])
|
|
29
|
+
.describe("The type of message to send."),
|
|
30
|
+
text: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("The message text, required for 'text' and 'email' message types."),
|
|
34
|
+
subject: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("The email subject, required for 'email' message types."),
|
|
38
|
+
attachmentUrl: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("The URL of the attachment, required for 'attachment' message types."),
|
|
42
|
+
attachmentType: z
|
|
43
|
+
.enum(["image", "video", "audio", "file"])
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("The type of the attachment."),
|
|
46
|
+
templateName: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("The name of the WhatsApp template, required for 'whatsapp_template' message types."),
|
|
50
|
+
templateLanguage: z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("The language code of the WhatsApp template."),
|
|
54
|
+
},
|
|
55
|
+
handler: async (args, ctx) => {
|
|
56
|
+
const { identifier, channelId, messageType, ...messageData } = args;
|
|
57
|
+
try {
|
|
58
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
59
|
+
const formattedIdentifier = formatContactIdentifier(identifier);
|
|
60
|
+
let message;
|
|
61
|
+
switch (messageType) {
|
|
62
|
+
case "text":
|
|
63
|
+
message = { type: "text", text: messageData.text };
|
|
64
|
+
break;
|
|
65
|
+
case "attachment":
|
|
66
|
+
message = {
|
|
67
|
+
type: "attachment",
|
|
68
|
+
attachment: {
|
|
69
|
+
type: messageData.attachmentType,
|
|
70
|
+
url: messageData.attachmentUrl,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
break;
|
|
74
|
+
case "email":
|
|
75
|
+
message = {
|
|
76
|
+
type: "email",
|
|
77
|
+
text: messageData.text,
|
|
78
|
+
subject: messageData.subject,
|
|
79
|
+
};
|
|
80
|
+
break;
|
|
81
|
+
case "whatsapp_template":
|
|
82
|
+
message = {
|
|
83
|
+
type: "whatsapp_template",
|
|
84
|
+
template: {
|
|
85
|
+
name: messageData.templateName,
|
|
86
|
+
languageCode: messageData.templateLanguage,
|
|
87
|
+
components: [],
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
throw new Error(`Unsupported message type: ${messageType}`);
|
|
93
|
+
}
|
|
94
|
+
const result = await sdkClient.messaging.send(formattedIdentifier, {
|
|
95
|
+
channelId,
|
|
96
|
+
message,
|
|
97
|
+
});
|
|
98
|
+
return handleSdkResponse(result);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
return handleSdkError(error);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "get_message",
|
|
107
|
+
description: "Retrieve a message by its ID.",
|
|
108
|
+
schema: {
|
|
109
|
+
identifier: z
|
|
110
|
+
.string()
|
|
111
|
+
.describe("The contact's identifier. Can be the contact's ID, email, or phone number."),
|
|
112
|
+
messageId: z.number().describe("The ID of the message to retrieve."),
|
|
113
|
+
},
|
|
114
|
+
handler: async (args, ctx) => {
|
|
115
|
+
const { identifier, messageId } = args;
|
|
116
|
+
try {
|
|
117
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
118
|
+
const formattedIdentifier = formatContactIdentifier(identifier);
|
|
119
|
+
const message = await sdkClient.messaging.get(formattedIdentifier, messageId);
|
|
120
|
+
return handleSdkResponse(message);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return handleSdkError(error);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "list_messages",
|
|
129
|
+
description: "List messages for a contact with optional pagination.",
|
|
130
|
+
schema: {
|
|
131
|
+
identifier: z
|
|
132
|
+
.string()
|
|
133
|
+
.describe("The contact's identifier. Can be the contact's ID, email, or phone number."),
|
|
134
|
+
limit: z
|
|
135
|
+
.number()
|
|
136
|
+
.min(1)
|
|
137
|
+
.max(100)
|
|
138
|
+
.default(20)
|
|
139
|
+
.describe("The number of messages to return, between 1 and 100."),
|
|
140
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
141
|
+
},
|
|
142
|
+
handler: async (args, ctx) => {
|
|
143
|
+
const { identifier, limit = 20, cursorId, } = args;
|
|
144
|
+
try {
|
|
145
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
146
|
+
const formattedIdentifier = formatContactIdentifier(identifier);
|
|
147
|
+
const result = await sdkClient.messaging.list(formattedIdentifier, {
|
|
148
|
+
limit,
|
|
149
|
+
cursorId,
|
|
150
|
+
});
|
|
151
|
+
return handleSdkResponse(result);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return handleSdkError(error);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=messaging.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.tool.js","sourceRoot":"","sources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AAE;gBACN,UAAU,EAAE,CAAC;qBACV,MAAM,EAAE;qBACR,QAAQ,CAAC,4EAA4E,CAAC;gBACzF,KAAK,EAAE,CAAC;qBACL,MAAM,EAAE;qBACR,GAAG,CAAC,CAAC,CAAC;qBACN,GAAG,CAAC,GAAG,CAAC;qBACR,OAAO,CAAC,EAAE,CAAC;qBACX,QAAQ,CAAC,sDAAsD,CAAC;gBACnE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;aAC1E;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;gBAC3B,MAAM,EACJ,UAAU,EACV,KAAK,GAAG,EAAE,EACV,QAAQ,GACT,GAAG,IAIH,CAAC;gBACF,IAAI,CAAC;oBACH,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,GAAU,CAAC,CAAC;oBAC1E,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;oBAChE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,EAAE;wBACjE,KAAK;wBACL,QAAQ;qBACT,CAAC,CAAC;oBACH,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACnC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;SACF;KACF,CAAC;CACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseTool } from "./BaseTool.js";
|
|
2
|
+
import { Tool } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A tool for managing the workspace.
|
|
5
|
+
* This tool provides functionalities for listing users, creating custom fields,
|
|
6
|
+
* listing channels, and managing tags.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WorkspaceTool extends BaseTool {
|
|
9
|
+
/**
|
|
10
|
+
* The list of tools provided by the WorkspaceTool.
|
|
11
|
+
* It includes tools for managing users, custom fields, channels, and tags.
|
|
12
|
+
*/
|
|
13
|
+
protected tools: Tool[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=workspace.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.tool.d.ts","sourceRoot":"","sources":["../../src/tools/workspace.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAO,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAwRrB;CACH"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BaseTool } from "./BaseTool.js";
|
|
3
|
+
import { createSdkClient, handleSdkError, handleSdkResponse } from "../utils/api.js";
|
|
4
|
+
/**
|
|
5
|
+
* A tool for managing the workspace.
|
|
6
|
+
* This tool provides functionalities for listing users, creating custom fields,
|
|
7
|
+
* listing channels, and managing tags.
|
|
8
|
+
*/
|
|
9
|
+
export class WorkspaceTool extends BaseTool {
|
|
10
|
+
/**
|
|
11
|
+
* The list of tools provided by the WorkspaceTool.
|
|
12
|
+
* It includes tools for managing users, custom fields, channels, and tags.
|
|
13
|
+
*/
|
|
14
|
+
tools = [
|
|
15
|
+
{
|
|
16
|
+
name: "list_users",
|
|
17
|
+
description: "Get a list of users in the workspace.",
|
|
18
|
+
schema: {
|
|
19
|
+
limit: z
|
|
20
|
+
.number()
|
|
21
|
+
.min(1)
|
|
22
|
+
.max(100)
|
|
23
|
+
.default(10)
|
|
24
|
+
.describe("The number of users to return, between 1 and 100."),
|
|
25
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
26
|
+
},
|
|
27
|
+
handler: async (args, ctx) => {
|
|
28
|
+
const { limit, cursorId } = args;
|
|
29
|
+
try {
|
|
30
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
31
|
+
const result = await sdkClient.space.listUsers({ limit, cursorId });
|
|
32
|
+
return handleSdkResponse(result);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return handleSdkError(error);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "get_user",
|
|
41
|
+
description: "Get a workspace user by their ID.",
|
|
42
|
+
schema: {
|
|
43
|
+
id: z.number().describe("The user ID."),
|
|
44
|
+
},
|
|
45
|
+
handler: async (args, ctx) => {
|
|
46
|
+
const { id } = args;
|
|
47
|
+
try {
|
|
48
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
49
|
+
const result = await sdkClient.space.getUser(id);
|
|
50
|
+
return handleSdkResponse(result);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return handleSdkError(error);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "list_custom_fields",
|
|
59
|
+
description: "Get a list of all custom fields in the workspace.",
|
|
60
|
+
schema: {
|
|
61
|
+
limit: z
|
|
62
|
+
.number()
|
|
63
|
+
.min(1)
|
|
64
|
+
.max(100)
|
|
65
|
+
.default(10)
|
|
66
|
+
.describe("The number of custom fields to return, between 1 and 100."),
|
|
67
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
68
|
+
},
|
|
69
|
+
handler: async (args, ctx) => {
|
|
70
|
+
const { limit, cursorId } = args;
|
|
71
|
+
try {
|
|
72
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
73
|
+
const result = await sdkClient.space.listCustomFields({ limit, cursorId });
|
|
74
|
+
return handleSdkResponse(result);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return handleSdkError(error);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "get_custom_field",
|
|
83
|
+
description: "Get a custom field by its ID.",
|
|
84
|
+
schema: {
|
|
85
|
+
id: z.number().describe("The custom field ID."),
|
|
86
|
+
},
|
|
87
|
+
handler: async (args, ctx) => {
|
|
88
|
+
const { id } = args;
|
|
89
|
+
try {
|
|
90
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
91
|
+
const result = await sdkClient.space.getCustomField(id);
|
|
92
|
+
return handleSdkResponse(result);
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
return handleSdkError(error);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "create_custom_field",
|
|
101
|
+
description: "Create a new custom field.",
|
|
102
|
+
schema: {
|
|
103
|
+
name: z.string().max(50).describe("The name of the custom field (max 50 characters)."),
|
|
104
|
+
slug: z
|
|
105
|
+
.string()
|
|
106
|
+
.regex(/^[A-Za-z0-9_]+$/)
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("A unique identifier for the custom field (letters, numbers, and underscores only)."),
|
|
109
|
+
description: z.string().optional().describe("A description for the custom field."),
|
|
110
|
+
dataType: z
|
|
111
|
+
.enum(["text", "list", "checkbox", "email", "number", "url", "date", "time"])
|
|
112
|
+
.describe("The data type of the custom field."),
|
|
113
|
+
allowedValues: z
|
|
114
|
+
.array(z.string())
|
|
115
|
+
.optional()
|
|
116
|
+
.describe("An array of allowed values, required for 'list' data types."),
|
|
117
|
+
},
|
|
118
|
+
handler: async (args, ctx) => {
|
|
119
|
+
const { name, slug, description, dataType, allowedValues } = args;
|
|
120
|
+
try {
|
|
121
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
122
|
+
const result = await sdkClient.space.createCustomField({
|
|
123
|
+
name,
|
|
124
|
+
slug,
|
|
125
|
+
description,
|
|
126
|
+
dataType,
|
|
127
|
+
allowedValues,
|
|
128
|
+
});
|
|
129
|
+
return handleSdkResponse(result);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
return handleSdkError(error);
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "list_channels",
|
|
138
|
+
description: "Get all messaging channels connected in the workspace.",
|
|
139
|
+
schema: {
|
|
140
|
+
limit: z
|
|
141
|
+
.number()
|
|
142
|
+
.min(1)
|
|
143
|
+
.max(100)
|
|
144
|
+
.default(10)
|
|
145
|
+
.describe("The number of channels to return, between 1 and 100."),
|
|
146
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
147
|
+
},
|
|
148
|
+
handler: async (args, ctx) => {
|
|
149
|
+
const { limit, cursorId } = args;
|
|
150
|
+
try {
|
|
151
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
152
|
+
const result = await sdkClient.space.listChannels({ limit, cursorId });
|
|
153
|
+
return handleSdkResponse(result);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
return handleSdkError(error);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "list_closing_notes",
|
|
162
|
+
description: "List closing note categories/options used when closing conversations.",
|
|
163
|
+
schema: {
|
|
164
|
+
limit: z
|
|
165
|
+
.number()
|
|
166
|
+
.min(1)
|
|
167
|
+
.max(100)
|
|
168
|
+
.default(10)
|
|
169
|
+
.describe("The number of closing notes to return, between 1 and 100."),
|
|
170
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
171
|
+
},
|
|
172
|
+
handler: async (args, ctx) => {
|
|
173
|
+
const { limit, cursorId } = args;
|
|
174
|
+
try {
|
|
175
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
176
|
+
const result = await sdkClient.space.listClosingNotes({ limit, cursorId });
|
|
177
|
+
return handleSdkResponse(result);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return handleSdkError(error);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "list_templates",
|
|
186
|
+
description: "List WhatsApp (or channel) message templates for a channel.",
|
|
187
|
+
schema: {
|
|
188
|
+
channelId: z.number().describe("The channel ID to list templates for."),
|
|
189
|
+
limit: z
|
|
190
|
+
.number()
|
|
191
|
+
.min(1)
|
|
192
|
+
.max(100)
|
|
193
|
+
.default(10)
|
|
194
|
+
.describe("The number of templates to return, between 1 and 100."),
|
|
195
|
+
cursorId: z.number().optional().describe("The cursor ID for pagination."),
|
|
196
|
+
},
|
|
197
|
+
handler: async (args, ctx) => {
|
|
198
|
+
const { channelId, limit = 10, cursorId, } = args;
|
|
199
|
+
try {
|
|
200
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
201
|
+
const result = await sdkClient.space.listTemplates(channelId, { limit, cursorId });
|
|
202
|
+
return handleSdkResponse(result);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
return handleSdkError(error);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "create_tag",
|
|
211
|
+
description: "Create a workspace tag (used to tag contacts or conversations).",
|
|
212
|
+
schema: {
|
|
213
|
+
name: z.string().describe("The tag name."),
|
|
214
|
+
description: z.string().optional().describe("Optional description for the tag."),
|
|
215
|
+
colorCode: z
|
|
216
|
+
.string()
|
|
217
|
+
.optional()
|
|
218
|
+
.describe("Optional hex color code for the tag (e.g. #FF5733)."),
|
|
219
|
+
emoji: z.string().optional().describe("Optional emoji for the tag."),
|
|
220
|
+
},
|
|
221
|
+
handler: async (args, ctx) => {
|
|
222
|
+
const { name, description, colorCode, emoji } = args;
|
|
223
|
+
try {
|
|
224
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
225
|
+
const result = await sdkClient.space.createTag({
|
|
226
|
+
name,
|
|
227
|
+
description,
|
|
228
|
+
colorCode,
|
|
229
|
+
emoji,
|
|
230
|
+
});
|
|
231
|
+
return handleSdkResponse(result);
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
return handleSdkError(error);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "update_tag",
|
|
240
|
+
description: "Update an existing workspace tag.",
|
|
241
|
+
schema: {
|
|
242
|
+
currentName: z.string().describe("The current name of the tag to update."),
|
|
243
|
+
name: z.string().optional().describe("The new name for the tag."),
|
|
244
|
+
colorCode: z.string().optional().describe("Optional new hex color code (e.g. #FFD700)."),
|
|
245
|
+
},
|
|
246
|
+
handler: async (args, ctx) => {
|
|
247
|
+
const { currentName, name, colorCode } = args;
|
|
248
|
+
try {
|
|
249
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
250
|
+
const result = await sdkClient.space.updateTag({
|
|
251
|
+
currentName,
|
|
252
|
+
name,
|
|
253
|
+
colorCode,
|
|
254
|
+
});
|
|
255
|
+
return handleSdkResponse(result);
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
return handleSdkError(error);
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: "delete_tag",
|
|
264
|
+
description: "Delete a workspace tag by name.",
|
|
265
|
+
schema: {
|
|
266
|
+
name: z.string().describe("The name of the tag to delete."),
|
|
267
|
+
},
|
|
268
|
+
handler: async (args, ctx) => {
|
|
269
|
+
const { name } = args;
|
|
270
|
+
try {
|
|
271
|
+
const sdkClient = createSdkClient(this.apiBaseUrl, this.mode, ctx);
|
|
272
|
+
const result = await sdkClient.space.deleteTag({ name });
|
|
273
|
+
return handleSdkResponse(result);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
return handleSdkError(error);
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
];
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=workspace.tool.js.map
|