@carbonvoice/cv-mcp-server 1.0.12 → 1.0.13
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/dist/generated/carbon-voice-api/CarbonVoiceSimplifiedAPI.zod.js +3 -5
- package/dist/generated/carbon-voice-api.js +3 -5
- package/dist/interfaces/conversation.interface.js +2 -0
- package/dist/schemas/conversation.js +17 -0
- package/dist/schemas/index.js +1 -0
- package/dist/server.js +57 -2
- package/package.json +1 -1
|
@@ -599,13 +599,11 @@ exports.getMessageByIdResponse = zod_1.z.object({
|
|
|
599
599
|
})).optional()
|
|
600
600
|
});
|
|
601
601
|
/**
|
|
602
|
-
* By default return messages
|
|
603
|
-
|
|
604
|
-
The **maximum** allowed range between dates is **31 days**.
|
|
602
|
+
* By default return most recent messages. The **maximum** allowed range between dates is **31 days**.
|
|
605
603
|
* @summary List Messages
|
|
606
604
|
*/
|
|
607
605
|
exports.listMessagesQueryPageDefault = 1;
|
|
608
|
-
exports.listMessagesQuerySizeDefault =
|
|
606
|
+
exports.listMessagesQuerySizeDefault = 20;
|
|
609
607
|
exports.listMessagesQuerySizeMax = 50;
|
|
610
608
|
exports.listMessagesQuerySortDirectionDefault = "DESC";
|
|
611
609
|
exports.listMessagesQueryParams = zod_1.z.object({
|
|
@@ -622,7 +620,7 @@ exports.listMessagesQueryParams = zod_1.z.object({
|
|
|
622
620
|
"user_ids": zod_1.z.array(zod_1.z.string()).optional().describe('User IDs (optional). List of user IDs to filter messages by. If not provided, all users will be included.')
|
|
623
621
|
});
|
|
624
622
|
exports.listMessagesResponsePageDefault = 1;
|
|
625
|
-
exports.listMessagesResponseSizeDefault =
|
|
623
|
+
exports.listMessagesResponseSizeDefault = 20;
|
|
626
624
|
exports.listMessagesResponseSizeMax = 50;
|
|
627
625
|
exports.listMessagesResponseSortDirectionDefault = "DESC";
|
|
628
626
|
exports.listMessagesResponseResultsItemLanguageDefault = "english";
|
|
@@ -99,11 +99,9 @@ const getCarbonVoiceSimplifiedAPI = () => {
|
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* @summary List Messages
|
|
106
|
-
*/
|
|
102
|
+
* By default return most recent messages. The **maximum** allowed range between dates is **31 days**.
|
|
103
|
+
* @summary List Messages
|
|
104
|
+
*/
|
|
107
105
|
const listMessages = (params) => {
|
|
108
106
|
return (0, axios_instance_1.mutator)({
|
|
109
107
|
url: `/simplified/messages`,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.catchUpConversationParams = exports.summarizeConversationParams = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.summarizeConversationParams = zod_1.z.object({
|
|
6
|
+
conversation_id: zod_1.z.string().nonempty(),
|
|
7
|
+
prompt_id: zod_1.z.string().nonempty(),
|
|
8
|
+
message_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
9
|
+
language: zod_1.z.string().optional(),
|
|
10
|
+
start_date: zod_1.z.string().datetime().optional(),
|
|
11
|
+
end_date: zod_1.z.string().datetime().optional(),
|
|
12
|
+
limit: zod_1.z.number().optional().default(50),
|
|
13
|
+
});
|
|
14
|
+
exports.catchUpConversationParams = zod_1.z.object({
|
|
15
|
+
...exports.summarizeConversationParams.shape,
|
|
16
|
+
include_only_unread_messages: zod_1.z.boolean().optional().default(true),
|
|
17
|
+
});
|
package/dist/schemas/index.js
CHANGED
package/dist/server.js
CHANGED
|
@@ -4,6 +4,7 @@ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const generated_1 = require("./generated");
|
|
6
6
|
const CarbonVoiceSimplifiedAPI_zod_1 = require("./generated/carbon-voice-api/CarbonVoiceSimplifiedAPI.zod");
|
|
7
|
+
const schemas_1 = require("./schemas");
|
|
7
8
|
const utils_1 = require("./utils");
|
|
8
9
|
// Create server instance
|
|
9
10
|
const server = new mcp_js_1.McpServer({
|
|
@@ -20,7 +21,7 @@ const api = (0, generated_1.getCarbonVoiceSimplifiedAPI)();
|
|
|
20
21
|
*********************/
|
|
21
22
|
// Messages
|
|
22
23
|
server.registerTool('list_messages', {
|
|
23
|
-
description: 'List Messages. By default returns
|
|
24
|
+
description: 'List Messages. By default returns latest 20 messages. The maximum allowed range between dates is 31 days.',
|
|
24
25
|
inputSchema: CarbonVoiceSimplifiedAPI_zod_1.listMessagesQueryParams.shape,
|
|
25
26
|
}, async (params) => {
|
|
26
27
|
try {
|
|
@@ -58,7 +59,8 @@ server.registerTool('get_recent_messages', {
|
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
server.registerTool('create_conversation_message', {
|
|
61
|
-
description: '
|
|
62
|
+
description: 'Sends a message to an existing conversation or any type with a conversation_id. ' +
|
|
63
|
+
'To reply as a thread, included a message_id for "parent_id". You must provide a transcript or attachment.',
|
|
62
64
|
inputSchema: CarbonVoiceSimplifiedAPI_zod_1.createConversationMessageParams.merge(CarbonVoiceSimplifiedAPI_zod_1.createConversationMessageBody).shape,
|
|
63
65
|
}, async (args) => {
|
|
64
66
|
try {
|
|
@@ -182,6 +184,59 @@ server.registerTool('get_conversation_users', {
|
|
|
182
184
|
return (0, utils_1.formatToMCPToolResponse)(error);
|
|
183
185
|
}
|
|
184
186
|
});
|
|
187
|
+
server.registerTool('summarize_conversation', {
|
|
188
|
+
description: 'Summarize a conversation.',
|
|
189
|
+
inputSchema: schemas_1.summarizeConversationParams.shape,
|
|
190
|
+
}, async (args) => {
|
|
191
|
+
var _a;
|
|
192
|
+
try {
|
|
193
|
+
let message_ids = args.message_ids || [];
|
|
194
|
+
// If no message ids are provided, get couple of messages from the conversation
|
|
195
|
+
if (!args.message_ids) {
|
|
196
|
+
const messages = await api.listMessages(args);
|
|
197
|
+
message_ids = ((_a = messages.results) === null || _a === void 0 ? void 0 : _a.map((message) => message.id)) || [];
|
|
198
|
+
}
|
|
199
|
+
const aiResponse = await api.aIResponseControllerCreateResponse({
|
|
200
|
+
prompt_id: args.prompt_id,
|
|
201
|
+
message_ids: message_ids,
|
|
202
|
+
channel_id: args.conversation_id,
|
|
203
|
+
language: args.language,
|
|
204
|
+
});
|
|
205
|
+
return (0, utils_1.formatToMCPToolResponse)(aiResponse);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
utils_1.logger.error('Error summarizing conversation:', { error });
|
|
209
|
+
return (0, utils_1.formatToMCPToolResponse)(error);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
// TODO: First we need to implement List messages filtered by unread messages
|
|
213
|
+
// server.registerTool(
|
|
214
|
+
// 'catch_up_conversation',
|
|
215
|
+
// {
|
|
216
|
+
// description: 'Catch up a conversation.',
|
|
217
|
+
// inputSchema: catchUpConversationParams.shape,
|
|
218
|
+
// },
|
|
219
|
+
// async (args: CatchUpConversationParams): Promise<McpToolResponse> => {
|
|
220
|
+
// try {
|
|
221
|
+
// let message_ids: string[] = args.message_ids || [];
|
|
222
|
+
// // If no message ids are provided, get couple of messages from the conversation
|
|
223
|
+
// if (!args.message_ids?.length) {
|
|
224
|
+
// const messages = await api.listMessages(args);
|
|
225
|
+
// message_ids = messages.results?.map((message) => message.id) || [];
|
|
226
|
+
// }
|
|
227
|
+
// const aiResponse = await api.aIResponseControllerCreateResponse({
|
|
228
|
+
// prompt_id: args.prompt_id,
|
|
229
|
+
// message_ids: message_ids,
|
|
230
|
+
// channel_id: args.conversation_id,
|
|
231
|
+
// language: args.language,
|
|
232
|
+
// });
|
|
233
|
+
// return formatToMCPToolResponse(aiResponse);
|
|
234
|
+
// } catch (error) {
|
|
235
|
+
// logger.error('Error catching up conversation:', { error });
|
|
236
|
+
// return formatToMCPToolResponse(error);
|
|
237
|
+
// }
|
|
238
|
+
// },
|
|
239
|
+
// );
|
|
185
240
|
// Folders
|
|
186
241
|
server.registerTool('get_workspace_folders_and_message_counts', {
|
|
187
242
|
description: 'Returns, for each workspace, the total number of folders and messages, as well as a breakdown of folders, ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonvoice/cv-mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Server implementation for integrating with Carbon Voice's API, providing tools and endpoints for voice messaging, conversations, and workspace management through MCP (Model Context Protocol)",
|
|
5
5
|
"author": "Carbon Voice",
|
|
6
6
|
"license": "ISC",
|