@burdenoff/mcp-libs 2026.523.1 → 2026.525.1
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/chunk-HRWIDQJE.js +1771 -0
- package/dist/chunk-HRWIDQJE.js.map +1 -0
- package/dist/modules/conversations/index.cjs +1174 -0
- package/dist/modules/conversations/index.cjs.map +1 -1
- package/dist/modules/conversations/index.js +1174 -0
- package/dist/modules/conversations/index.js.map +1 -1
- package/dist/modules/export/index.cjs +348 -0
- package/dist/modules/export/index.cjs.map +1 -1
- package/dist/modules/export/index.js +348 -0
- package/dist/modules/export/index.js.map +1 -1
- package/dist/modules/integrations/index.cjs +539 -0
- package/dist/modules/integrations/index.cjs.map +1 -1
- package/dist/modules/integrations/index.js +539 -0
- package/dist/modules/integrations/index.js.map +1 -1
- package/dist/modules/sandbox/index.cjs +864 -0
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +699 -1
- package/dist/modules/sandbox/index.js.map +1 -1
- package/dist/modules/scheduler/index.cjs +736 -0
- package/dist/modules/scheduler/index.cjs.map +1 -1
- package/dist/modules/scheduler/index.js +736 -0
- package/dist/modules/scheduler/index.js.map +1 -1
- package/dist/modules/vibecontrols/index.cjs +4230 -477
- package/dist/modules/vibecontrols/index.cjs.map +1 -1
- package/dist/modules/vibecontrols/index.js +3424 -401
- package/dist/modules/vibecontrols/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-N2CZNPYC.js +0 -875
- package/dist/chunk-N2CZNPYC.js.map +0 -1
|
@@ -71,6 +71,283 @@ var UPDATE_CONVERSATION_SETTINGS = `
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
`;
|
|
74
|
+
var GET_MESSAGE = `
|
|
75
|
+
query Message($id: ID!) {
|
|
76
|
+
message(id: $id) {
|
|
77
|
+
id conversationId authorId authorType content type status
|
|
78
|
+
isEdited isPinned isHidden createdAt updatedAt
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
var EDIT_MESSAGE = `
|
|
83
|
+
mutation EditMessage($input: EditMessageInput!) {
|
|
84
|
+
editMessage(input: $input) {
|
|
85
|
+
id content isEdited editedAt updatedAt
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
var DELETE_MESSAGE = `
|
|
90
|
+
mutation DeleteMessage($id: ID!, $hard: Boolean) {
|
|
91
|
+
deleteMessage(id: $id, hard: $hard) { success messageId }
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
var FORWARD_MESSAGE = `
|
|
95
|
+
mutation ForwardMessage($messageId: ID!, $targetConversationId: ID!) {
|
|
96
|
+
forwardMessage(messageId: $messageId, targetConversationId: $targetConversationId) {
|
|
97
|
+
success
|
|
98
|
+
message { id conversationId content type createdAt }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
var PIN_MESSAGE = `
|
|
103
|
+
mutation PinMessage($messageId: ID!) {
|
|
104
|
+
pinMessage(messageId: $messageId) { id isPinned pinnedAt }
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
var UNPIN_MESSAGE = `
|
|
108
|
+
mutation UnpinMessage($messageId: ID!) {
|
|
109
|
+
unpinMessage(messageId: $messageId) { id isPinned pinnedAt }
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
var HIDE_MESSAGE = `
|
|
113
|
+
mutation HideMessage($messageId: ID!, $reason: String!) {
|
|
114
|
+
hideMessage(messageId: $messageId, reason: $reason) { id isHidden }
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
var UNHIDE_MESSAGE = `
|
|
118
|
+
mutation UnhideMessage($messageId: ID!) {
|
|
119
|
+
unhideMessage(messageId: $messageId) { id isHidden }
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
var SEARCH_MESSAGES = `
|
|
123
|
+
query SearchMessages($query: String!, $conversationId: ID, $first: Int, $after: String) {
|
|
124
|
+
searchMessages(query: $query, conversationId: $conversationId, first: $first, after: $after) {
|
|
125
|
+
edges { cursor node { id conversationId authorId content type createdAt } }
|
|
126
|
+
pageInfo { hasNextPage endCursor }
|
|
127
|
+
totalCount
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
var UNREAD_MESSAGES = `
|
|
132
|
+
query UnreadMessages($first: Int, $after: String) {
|
|
133
|
+
unreadMessages(first: $first, after: $after) {
|
|
134
|
+
edges { cursor node { id conversationId authorId content type createdAt } }
|
|
135
|
+
pageInfo { hasNextPage endCursor }
|
|
136
|
+
totalCount
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
var REPORT_MESSAGE = `
|
|
141
|
+
mutation ReportMessage($messageId: ID!, $reason: String!) {
|
|
142
|
+
reportMessage(messageId: $messageId, reason: $reason) {
|
|
143
|
+
success messageId reportId
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
var GET_DRAFT = `
|
|
148
|
+
query Draft($conversationId: ID!) {
|
|
149
|
+
draft(conversationId: $conversationId) {
|
|
150
|
+
id conversationId userId content parentMessageId createdAt updatedAt
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
var SAVE_DRAFT = `
|
|
155
|
+
mutation SaveDraft($input: SaveDraftInput!) {
|
|
156
|
+
saveDraft(input: $input) {
|
|
157
|
+
id conversationId userId content parentMessageId createdAt updatedAt
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
var DELETE_DRAFT = `
|
|
162
|
+
mutation DeleteDraft($conversationId: ID!) {
|
|
163
|
+
deleteDraft(conversationId: $conversationId) { success conversationId }
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
var ADD_REACTION = `
|
|
167
|
+
mutation AddReaction($messageId: ID!, $emoji: String!) {
|
|
168
|
+
addReaction(messageId: $messageId, emoji: $emoji) {
|
|
169
|
+
id messageId userId emoji createdAt
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
var REMOVE_REACTION = `
|
|
174
|
+
mutation RemoveReaction($messageId: ID!, $emoji: String!) {
|
|
175
|
+
removeReaction(messageId: $messageId, emoji: $emoji) {
|
|
176
|
+
success messageId emoji
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
var GET_THREAD = `
|
|
181
|
+
query Thread($messageId: ID!, $first: Int, $after: String) {
|
|
182
|
+
thread(messageId: $messageId, first: $first, after: $after) {
|
|
183
|
+
edges { cursor node { id conversationId authorId content type createdAt threadRootId parentMessageId } }
|
|
184
|
+
pageInfo { hasNextPage endCursor }
|
|
185
|
+
totalCount
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
var GET_OR_CREATE_DIRECT_CONVERSATION = `
|
|
190
|
+
mutation GetOrCreateDirectConversation($userId: ID!) {
|
|
191
|
+
getOrCreateDirectConversation(userId: $userId) {
|
|
192
|
+
id title type createdAt
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
var LIST_MENTIONS = `
|
|
197
|
+
query Mentions($first: Int, $after: String, $unreadOnly: Boolean) {
|
|
198
|
+
mentions(first: $first, after: $after, unreadOnly: $unreadOnly) {
|
|
199
|
+
edges { cursor node { id conversationId authorId content type createdAt } }
|
|
200
|
+
pageInfo { hasNextPage endCursor }
|
|
201
|
+
totalCount
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
var SEARCH_CONVERSATIONS = `
|
|
206
|
+
query SearchConversations($query: String!, $first: Int, $after: String) {
|
|
207
|
+
searchConversations(query: $query, first: $first, after: $after) {
|
|
208
|
+
edges { cursor node { id title type description createdAt updatedAt unreadCount } }
|
|
209
|
+
pageInfo { hasNextPage endCursor }
|
|
210
|
+
totalCount
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
var GET_PRESENCE = `
|
|
215
|
+
query Presence($userIds: [ID!]!) {
|
|
216
|
+
presence(userIds: $userIds) {
|
|
217
|
+
userId status customStatus lastSeenAt
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
`;
|
|
221
|
+
var UPDATE_PRESENCE = `
|
|
222
|
+
mutation UpdatePresence($status: PresenceStatus!, $customStatus: String) {
|
|
223
|
+
updatePresence(status: $status, customStatus: $customStatus) {
|
|
224
|
+
userId status customStatus lastSeenAt
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
var LIST_TYPING_INDICATORS = `
|
|
229
|
+
query TypingIndicators($conversationId: ID!) {
|
|
230
|
+
typingIndicators(conversationId: $conversationId) {
|
|
231
|
+
conversationId userId startedAt
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
var START_TYPING = `
|
|
236
|
+
mutation StartTyping($conversationId: ID!) {
|
|
237
|
+
startTyping(conversationId: $conversationId)
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
var STOP_TYPING = `
|
|
241
|
+
mutation StopTyping($conversationId: ID!) {
|
|
242
|
+
stopTyping(conversationId: $conversationId)
|
|
243
|
+
}
|
|
244
|
+
`;
|
|
245
|
+
var ADD_PARTICIPANT = `
|
|
246
|
+
mutation AddParticipant($input: AddParticipantInput!) {
|
|
247
|
+
addParticipant(input: $input) {
|
|
248
|
+
id conversationId userId customTitle customAvatar createdAt
|
|
249
|
+
canAddMembers canRemoveMembers canSendMessages
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
`;
|
|
253
|
+
var REMOVE_PARTICIPANT = `
|
|
254
|
+
mutation RemoveParticipant($input: RemoveParticipantInput!) {
|
|
255
|
+
removeParticipant(input: $input) { success conversationId userId }
|
|
256
|
+
}
|
|
257
|
+
`;
|
|
258
|
+
var UPDATE_PARTICIPANT_ROLE = `
|
|
259
|
+
mutation UpdateParticipantRole($input: UpdateParticipantRoleInput!) {
|
|
260
|
+
updateParticipantRole(input: $input) {
|
|
261
|
+
id conversationId userId canAddMembers canRemoveMembers canSendMessages
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
`;
|
|
265
|
+
var LEAVE_CONVERSATION = `
|
|
266
|
+
mutation LeaveConversation($conversationId: ID!) {
|
|
267
|
+
leaveConversation(conversationId: $conversationId) { success conversationId }
|
|
268
|
+
}
|
|
269
|
+
`;
|
|
270
|
+
var ARCHIVE_CONVERSATION = `
|
|
271
|
+
mutation ArchiveConversation($id: ID!) {
|
|
272
|
+
archiveConversation(id: $id) { id state }
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
275
|
+
var UNARCHIVE_CONVERSATION = `
|
|
276
|
+
mutation UnarchiveConversation($id: ID!) {
|
|
277
|
+
unarchiveConversation(id: $id) { id state }
|
|
278
|
+
}
|
|
279
|
+
`;
|
|
280
|
+
var MUTE_CONVERSATION = `
|
|
281
|
+
mutation MuteConversation($conversationId: ID!, $until: DateTime) {
|
|
282
|
+
muteConversation(conversationId: $conversationId, until: $until) {
|
|
283
|
+
id conversationId userId
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
`;
|
|
287
|
+
var UNMUTE_CONVERSATION = `
|
|
288
|
+
mutation UnmuteConversation($conversationId: ID!) {
|
|
289
|
+
unmuteConversation(conversationId: $conversationId) {
|
|
290
|
+
id conversationId userId
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
`;
|
|
294
|
+
var PIN_CONVERSATION = `
|
|
295
|
+
mutation PinConversation($conversationId: ID!) {
|
|
296
|
+
pinConversation(conversationId: $conversationId) {
|
|
297
|
+
id conversationId userId
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
`;
|
|
301
|
+
var UNPIN_CONVERSATION = `
|
|
302
|
+
mutation UnpinConversation($conversationId: ID!) {
|
|
303
|
+
unpinConversation(conversationId: $conversationId) {
|
|
304
|
+
id conversationId userId
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
`;
|
|
308
|
+
var MARK_CONVERSATION_AS_READ = `
|
|
309
|
+
mutation MarkConversationAsRead($conversationId: ID!, $messageId: ID) {
|
|
310
|
+
markConversationAsRead(conversationId: $conversationId, messageId: $messageId) {
|
|
311
|
+
id conversationId userId
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
`;
|
|
315
|
+
var CREATE_INVITE_LINK = `
|
|
316
|
+
mutation CreateInviteLink($input: CreateInviteLinkInput!) {
|
|
317
|
+
createInviteLink(input: $input) {
|
|
318
|
+
code url currentUses maxUses expiresAt createdAt
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
`;
|
|
322
|
+
var JOIN_VIA_INVITE_LINK = `
|
|
323
|
+
mutation JoinViaInviteLink($code: String!) {
|
|
324
|
+
joinViaInviteLink(code: $code) {
|
|
325
|
+
id conversationId userId createdAt
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
`;
|
|
329
|
+
var VALIDATE_INVITE_LINK = `
|
|
330
|
+
query ValidateInviteLink($code: String!) {
|
|
331
|
+
validateInviteLink(code: $code) {
|
|
332
|
+
valid usesRemaining expiresAt
|
|
333
|
+
conversation { id title type }
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
`;
|
|
337
|
+
var VOTE_POLL = `
|
|
338
|
+
mutation VotePoll($pollId: ID!, $optionIds: [ID!]!) {
|
|
339
|
+
votePoll(pollId: $pollId, optionIds: $optionIds) {
|
|
340
|
+
id question totalVotes isClosed
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
`;
|
|
344
|
+
var UPDATE_NOTIFICATION_SETTINGS = `
|
|
345
|
+
mutation UpdateNotificationSettings($input: UpdateNotificationSettingsInput!) {
|
|
346
|
+
updateNotificationSettings(input: $input) {
|
|
347
|
+
id conversationId userId
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
`;
|
|
74
351
|
|
|
75
352
|
// src/modules/conversations/tools.ts
|
|
76
353
|
var ConversationTypeEnum = z.enum(["DIRECT", "GROUP", "CHANNEL"]);
|
|
@@ -394,6 +671,903 @@ function registerConversationsTools(server, ctx, track) {
|
|
|
394
671
|
}
|
|
395
672
|
}
|
|
396
673
|
);
|
|
674
|
+
registerMessageTools(server, ctx, track);
|
|
675
|
+
registerDraftTools(server, ctx, track);
|
|
676
|
+
registerReactionTools(server, ctx, track);
|
|
677
|
+
registerThreadAndDirectTools(server, ctx, track);
|
|
678
|
+
registerMentionsAndSearchTools(server, ctx, track);
|
|
679
|
+
registerPresenceAndTypingTools(server, ctx, track);
|
|
680
|
+
registerParticipantTools(server, ctx, track);
|
|
681
|
+
registerConversationActionTools(server, ctx, track);
|
|
682
|
+
registerInviteTools(server, ctx, track);
|
|
683
|
+
registerPollAndNotificationTools(server, ctx, track);
|
|
684
|
+
registerPollingTools(server, ctx, track);
|
|
685
|
+
}
|
|
686
|
+
function unwrap(error) {
|
|
687
|
+
return error instanceof Error ? error.message : String(error);
|
|
688
|
+
}
|
|
689
|
+
var PresenceStatusEnum = z.enum(["ONLINE", "OFFLINE", "AWAY", "DO_NOT_DISTURB"]);
|
|
690
|
+
var ParticipantRoleEnum = z.enum(["ADMIN", "MODERATOR", "MEMBER", "GUEST"]);
|
|
691
|
+
var NotificationLevelExtEnum = z.enum(["ALL", "MENTIONS", "MUTED", "NONE"]);
|
|
692
|
+
function registerMessageTools(server, ctx, track) {
|
|
693
|
+
server.registerTool(
|
|
694
|
+
track(mcpToolName(ctx.productName, "conversations_messages_get")),
|
|
695
|
+
{
|
|
696
|
+
title: "Get Message",
|
|
697
|
+
description: "Fetch a single message by ID.",
|
|
698
|
+
inputSchema: { id: z.string().describe("Message ID") }
|
|
699
|
+
},
|
|
700
|
+
async ({ id }) => {
|
|
701
|
+
try {
|
|
702
|
+
const data = await ctx.gql.workspace.request(GET_MESSAGE, {
|
|
703
|
+
id
|
|
704
|
+
});
|
|
705
|
+
if (!data.message) return errorResult(`Message ${id} not found`);
|
|
706
|
+
return jsonResult(data.message);
|
|
707
|
+
} catch (error) {
|
|
708
|
+
ctx.logger.error("conversations_messages_get failed", { error });
|
|
709
|
+
return errorResult(`Failed to get message: ${unwrap(error)}`);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
server.registerTool(
|
|
714
|
+
track(mcpToolName(ctx.productName, "conversations_messages_edit")),
|
|
715
|
+
{
|
|
716
|
+
title: "Edit Message",
|
|
717
|
+
description: "Edit an existing message. Provide new content (object) and optional reason.",
|
|
718
|
+
inputSchema: {
|
|
719
|
+
id: z.string().describe("Message ID to edit"),
|
|
720
|
+
content: z.record(z.unknown()).describe('New message content (e.g. { text: "..." })'),
|
|
721
|
+
reason: z.string().optional().describe("Optional reason for the edit (audit log)")
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
async ({ id, content, reason }) => {
|
|
725
|
+
try {
|
|
726
|
+
const input = { id, content };
|
|
727
|
+
if (reason !== void 0) input.reason = reason;
|
|
728
|
+
const data = await ctx.gql.workspace.request(EDIT_MESSAGE, {
|
|
729
|
+
input
|
|
730
|
+
});
|
|
731
|
+
return jsonResult(data.editMessage);
|
|
732
|
+
} catch (error) {
|
|
733
|
+
ctx.logger.error("conversations_messages_edit failed", { error });
|
|
734
|
+
return errorResult(`Failed to edit message: ${unwrap(error)}`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
);
|
|
738
|
+
server.registerTool(
|
|
739
|
+
track(mcpToolName(ctx.productName, "conversations_messages_delete")),
|
|
740
|
+
{
|
|
741
|
+
title: "Delete Message",
|
|
742
|
+
description: "Soft-delete (default) or hard-delete a message.",
|
|
743
|
+
inputSchema: {
|
|
744
|
+
id: z.string().describe("Message ID to delete"),
|
|
745
|
+
hard: z.boolean().optional().describe("Hard delete (default: false = soft delete)")
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
async ({ id, hard }) => {
|
|
749
|
+
try {
|
|
750
|
+
const data = await ctx.gql.workspace.request(DELETE_MESSAGE, { id, hard });
|
|
751
|
+
return jsonResult(data.deleteMessage);
|
|
752
|
+
} catch (error) {
|
|
753
|
+
ctx.logger.error("conversations_messages_delete failed", { error });
|
|
754
|
+
return errorResult(`Failed to delete message: ${unwrap(error)}`);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
server.registerTool(
|
|
759
|
+
track(mcpToolName(ctx.productName, "conversations_messages_forward")),
|
|
760
|
+
{
|
|
761
|
+
title: "Forward Message",
|
|
762
|
+
description: "Forward an existing message into another conversation.",
|
|
763
|
+
inputSchema: {
|
|
764
|
+
messageId: z.string().describe("Source message ID"),
|
|
765
|
+
targetConversationId: z.string().describe("Destination conversation ID")
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
async ({ messageId, targetConversationId }) => {
|
|
769
|
+
try {
|
|
770
|
+
const data = await ctx.gql.workspace.request(FORWARD_MESSAGE, { messageId, targetConversationId });
|
|
771
|
+
if (!data.forwardMessage.success || !data.forwardMessage.message) {
|
|
772
|
+
return errorResult("Forward failed: server returned no message");
|
|
773
|
+
}
|
|
774
|
+
return jsonResult(data.forwardMessage.message);
|
|
775
|
+
} catch (error) {
|
|
776
|
+
ctx.logger.error("conversations_messages_forward failed", { error });
|
|
777
|
+
return errorResult(`Failed to forward message: ${unwrap(error)}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
);
|
|
781
|
+
server.registerTool(
|
|
782
|
+
track(mcpToolName(ctx.productName, "conversations_messages_pin")),
|
|
783
|
+
{
|
|
784
|
+
title: "Pin Message",
|
|
785
|
+
description: "Pin a message to its conversation.",
|
|
786
|
+
inputSchema: { messageId: z.string().describe("Message ID to pin") }
|
|
787
|
+
},
|
|
788
|
+
async ({ messageId }) => {
|
|
789
|
+
try {
|
|
790
|
+
const data = await ctx.gql.workspace.request(PIN_MESSAGE, {
|
|
791
|
+
messageId
|
|
792
|
+
});
|
|
793
|
+
return jsonResult(data.pinMessage);
|
|
794
|
+
} catch (error) {
|
|
795
|
+
ctx.logger.error("conversations_messages_pin failed", { error });
|
|
796
|
+
return errorResult(`Failed to pin message: ${unwrap(error)}`);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
server.registerTool(
|
|
801
|
+
track(mcpToolName(ctx.productName, "conversations_messages_unpin")),
|
|
802
|
+
{
|
|
803
|
+
title: "Unpin Message",
|
|
804
|
+
description: "Remove a pinned message from its conversation.",
|
|
805
|
+
inputSchema: { messageId: z.string().describe("Message ID to unpin") }
|
|
806
|
+
},
|
|
807
|
+
async ({ messageId }) => {
|
|
808
|
+
try {
|
|
809
|
+
const data = await ctx.gql.workspace.request(UNPIN_MESSAGE, {
|
|
810
|
+
messageId
|
|
811
|
+
});
|
|
812
|
+
return jsonResult(data.unpinMessage);
|
|
813
|
+
} catch (error) {
|
|
814
|
+
ctx.logger.error("conversations_messages_unpin failed", { error });
|
|
815
|
+
return errorResult(`Failed to unpin message: ${unwrap(error)}`);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
server.registerTool(
|
|
820
|
+
track(mcpToolName(ctx.productName, "conversations_messages_hide")),
|
|
821
|
+
{
|
|
822
|
+
title: "Hide Message (moderate)",
|
|
823
|
+
description: "Moderator action: hide a message with a reason.",
|
|
824
|
+
inputSchema: {
|
|
825
|
+
messageId: z.string().describe("Message ID to hide"),
|
|
826
|
+
reason: z.string().describe("Moderation reason")
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
async ({ messageId, reason }) => {
|
|
830
|
+
try {
|
|
831
|
+
const data = await ctx.gql.workspace.request(HIDE_MESSAGE, {
|
|
832
|
+
messageId,
|
|
833
|
+
reason
|
|
834
|
+
});
|
|
835
|
+
return jsonResult(data.hideMessage);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
ctx.logger.error("conversations_messages_hide failed", { error });
|
|
838
|
+
return errorResult(`Failed to hide message: ${unwrap(error)}`);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
);
|
|
842
|
+
server.registerTool(
|
|
843
|
+
track(mcpToolName(ctx.productName, "conversations_messages_unhide")),
|
|
844
|
+
{
|
|
845
|
+
title: "Unhide Message (moderate)",
|
|
846
|
+
description: "Moderator action: restore a previously hidden message.",
|
|
847
|
+
inputSchema: { messageId: z.string().describe("Message ID to unhide") }
|
|
848
|
+
},
|
|
849
|
+
async ({ messageId }) => {
|
|
850
|
+
try {
|
|
851
|
+
const data = await ctx.gql.workspace.request(
|
|
852
|
+
UNHIDE_MESSAGE,
|
|
853
|
+
{ messageId }
|
|
854
|
+
);
|
|
855
|
+
return jsonResult(data.unhideMessage);
|
|
856
|
+
} catch (error) {
|
|
857
|
+
ctx.logger.error("conversations_messages_unhide failed", { error });
|
|
858
|
+
return errorResult(`Failed to unhide message: ${unwrap(error)}`);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
);
|
|
862
|
+
server.registerTool(
|
|
863
|
+
track(mcpToolName(ctx.productName, "conversations_messages_search")),
|
|
864
|
+
{
|
|
865
|
+
title: "Search Messages",
|
|
866
|
+
description: "Full-text search across messages. Optionally scope to a conversation.",
|
|
867
|
+
inputSchema: {
|
|
868
|
+
query: z.string().describe("Search query"),
|
|
869
|
+
conversationId: z.string().optional().describe("Restrict to this conversation"),
|
|
870
|
+
first: z.number().optional(),
|
|
871
|
+
after: z.string().optional()
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
async ({ query, conversationId, first, after }) => {
|
|
875
|
+
try {
|
|
876
|
+
const data = await ctx.gql.workspace.request(SEARCH_MESSAGES, { query, conversationId, first, after });
|
|
877
|
+
return jsonResult({
|
|
878
|
+
items: data.searchMessages.edges.map((e) => e.node),
|
|
879
|
+
pageInfo: data.searchMessages.pageInfo,
|
|
880
|
+
totalCount: data.searchMessages.totalCount
|
|
881
|
+
});
|
|
882
|
+
} catch (error) {
|
|
883
|
+
ctx.logger.error("conversations_messages_search failed", { error });
|
|
884
|
+
return errorResult(`Failed to search messages: ${unwrap(error)}`);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
);
|
|
888
|
+
server.registerTool(
|
|
889
|
+
track(mcpToolName(ctx.productName, "conversations_messages_unread")),
|
|
890
|
+
{
|
|
891
|
+
title: "List Unread Messages",
|
|
892
|
+
description: "List unread messages for the current actor across all conversations.",
|
|
893
|
+
inputSchema: { first: z.number().optional(), after: z.string().optional() }
|
|
894
|
+
},
|
|
895
|
+
async ({ first, after }) => {
|
|
896
|
+
try {
|
|
897
|
+
const data = await ctx.gql.workspace.request(UNREAD_MESSAGES, { first, after });
|
|
898
|
+
return jsonResult({
|
|
899
|
+
items: data.unreadMessages.edges.map((e) => e.node),
|
|
900
|
+
pageInfo: data.unreadMessages.pageInfo,
|
|
901
|
+
totalCount: data.unreadMessages.totalCount
|
|
902
|
+
});
|
|
903
|
+
} catch (error) {
|
|
904
|
+
ctx.logger.error("conversations_messages_unread failed", { error });
|
|
905
|
+
return errorResult(`Failed to list unread messages: ${unwrap(error)}`);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
);
|
|
909
|
+
server.registerTool(
|
|
910
|
+
track(mcpToolName(ctx.productName, "conversations_messages_report")),
|
|
911
|
+
{
|
|
912
|
+
title: "Report Message",
|
|
913
|
+
description: "Report a message for moderation review.",
|
|
914
|
+
inputSchema: {
|
|
915
|
+
messageId: z.string().describe("Message ID to report"),
|
|
916
|
+
reason: z.string().describe("Reason for the report")
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
async ({ messageId, reason }) => {
|
|
920
|
+
try {
|
|
921
|
+
const data = await ctx.gql.workspace.request(REPORT_MESSAGE, { messageId, reason });
|
|
922
|
+
return jsonResult(data.reportMessage);
|
|
923
|
+
} catch (error) {
|
|
924
|
+
ctx.logger.error("conversations_messages_report failed", { error });
|
|
925
|
+
return errorResult(`Failed to report message: ${unwrap(error)}`);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
);
|
|
929
|
+
}
|
|
930
|
+
function registerDraftTools(server, ctx, track) {
|
|
931
|
+
server.registerTool(
|
|
932
|
+
track(mcpToolName(ctx.productName, "conversations_drafts_get")),
|
|
933
|
+
{
|
|
934
|
+
title: "Get Draft",
|
|
935
|
+
description: "Fetch the current actor\u2019s draft for a conversation, if any.",
|
|
936
|
+
inputSchema: { conversationId: z.string().describe("Conversation ID") }
|
|
937
|
+
},
|
|
938
|
+
async ({ conversationId }) => {
|
|
939
|
+
try {
|
|
940
|
+
const data = await ctx.gql.workspace.request(GET_DRAFT, { conversationId });
|
|
941
|
+
return jsonResult(data.draft);
|
|
942
|
+
} catch (error) {
|
|
943
|
+
ctx.logger.error("conversations_drafts_get failed", { error });
|
|
944
|
+
return errorResult(`Failed to get draft: ${unwrap(error)}`);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
server.registerTool(
|
|
949
|
+
track(mcpToolName(ctx.productName, "conversations_drafts_save")),
|
|
950
|
+
{
|
|
951
|
+
title: "Save Draft",
|
|
952
|
+
description: "Save (upsert) the current actor\u2019s draft for a conversation.",
|
|
953
|
+
inputSchema: {
|
|
954
|
+
conversationId: z.string().describe("Conversation ID"),
|
|
955
|
+
content: z.record(z.unknown()).describe("Draft content payload"),
|
|
956
|
+
parentMessageId: z.string().optional().describe("Reply parent (for thread drafts)")
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
async ({ conversationId, content, parentMessageId }) => {
|
|
960
|
+
try {
|
|
961
|
+
const input = { conversationId, content };
|
|
962
|
+
if (parentMessageId !== void 0) input.parentMessageId = parentMessageId;
|
|
963
|
+
const data = await ctx.gql.workspace.request(SAVE_DRAFT, { input });
|
|
964
|
+
return jsonResult(data.saveDraft);
|
|
965
|
+
} catch (error) {
|
|
966
|
+
ctx.logger.error("conversations_drafts_save failed", { error });
|
|
967
|
+
return errorResult(`Failed to save draft: ${unwrap(error)}`);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
server.registerTool(
|
|
972
|
+
track(mcpToolName(ctx.productName, "conversations_drafts_delete")),
|
|
973
|
+
{
|
|
974
|
+
title: "Delete Draft",
|
|
975
|
+
description: "Delete the current actor\u2019s draft for a conversation.",
|
|
976
|
+
inputSchema: { conversationId: z.string().describe("Conversation ID") }
|
|
977
|
+
},
|
|
978
|
+
async ({ conversationId }) => {
|
|
979
|
+
try {
|
|
980
|
+
const data = await ctx.gql.workspace.request(DELETE_DRAFT, { conversationId });
|
|
981
|
+
return jsonResult(data.deleteDraft);
|
|
982
|
+
} catch (error) {
|
|
983
|
+
ctx.logger.error("conversations_drafts_delete failed", { error });
|
|
984
|
+
return errorResult(`Failed to delete draft: ${unwrap(error)}`);
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
function registerReactionTools(server, ctx, track) {
|
|
990
|
+
server.registerTool(
|
|
991
|
+
track(mcpToolName(ctx.productName, "conversations_reactions_add")),
|
|
992
|
+
{
|
|
993
|
+
title: "Add Reaction",
|
|
994
|
+
description: "Add an emoji reaction to a message.",
|
|
995
|
+
inputSchema: {
|
|
996
|
+
messageId: z.string().describe("Message ID"),
|
|
997
|
+
emoji: z.string().describe("Emoji character / shortcode")
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
async ({ messageId, emoji }) => {
|
|
1001
|
+
try {
|
|
1002
|
+
const data = await ctx.gql.workspace.request(
|
|
1003
|
+
ADD_REACTION,
|
|
1004
|
+
{ messageId, emoji }
|
|
1005
|
+
);
|
|
1006
|
+
return jsonResult(data.addReaction);
|
|
1007
|
+
} catch (error) {
|
|
1008
|
+
ctx.logger.error("conversations_reactions_add failed", { error });
|
|
1009
|
+
return errorResult(`Failed to add reaction: ${unwrap(error)}`);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
server.registerTool(
|
|
1014
|
+
track(mcpToolName(ctx.productName, "conversations_reactions_remove")),
|
|
1015
|
+
{
|
|
1016
|
+
title: "Remove Reaction",
|
|
1017
|
+
description: "Remove the current actor\u2019s emoji reaction from a message.",
|
|
1018
|
+
inputSchema: {
|
|
1019
|
+
messageId: z.string().describe("Message ID"),
|
|
1020
|
+
emoji: z.string().describe("Emoji character / shortcode")
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
async ({ messageId, emoji }) => {
|
|
1024
|
+
try {
|
|
1025
|
+
const data = await ctx.gql.workspace.request(REMOVE_REACTION, { messageId, emoji });
|
|
1026
|
+
return jsonResult(data.removeReaction);
|
|
1027
|
+
} catch (error) {
|
|
1028
|
+
ctx.logger.error("conversations_reactions_remove failed", { error });
|
|
1029
|
+
return errorResult(`Failed to remove reaction: ${unwrap(error)}`);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1034
|
+
function registerThreadAndDirectTools(server, ctx, track) {
|
|
1035
|
+
server.registerTool(
|
|
1036
|
+
track(mcpToolName(ctx.productName, "conversations_threads_get")),
|
|
1037
|
+
{
|
|
1038
|
+
title: "Get Thread",
|
|
1039
|
+
description: "List the replies under a thread-root message.",
|
|
1040
|
+
inputSchema: {
|
|
1041
|
+
messageId: z.string().describe("Thread root message ID"),
|
|
1042
|
+
first: z.number().optional(),
|
|
1043
|
+
after: z.string().optional()
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
async ({ messageId, first, after }) => {
|
|
1047
|
+
try {
|
|
1048
|
+
const data = await ctx.gql.workspace.request(GET_THREAD, { messageId, first, after });
|
|
1049
|
+
return jsonResult({
|
|
1050
|
+
items: data.thread.edges.map((e) => e.node),
|
|
1051
|
+
pageInfo: data.thread.pageInfo,
|
|
1052
|
+
totalCount: data.thread.totalCount
|
|
1053
|
+
});
|
|
1054
|
+
} catch (error) {
|
|
1055
|
+
ctx.logger.error("conversations_threads_get failed", { error });
|
|
1056
|
+
return errorResult(`Failed to load thread: ${unwrap(error)}`);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1060
|
+
server.registerTool(
|
|
1061
|
+
track(mcpToolName(ctx.productName, "conversations_get_or_create_direct")),
|
|
1062
|
+
{
|
|
1063
|
+
title: "Get or Create Direct Conversation",
|
|
1064
|
+
description: "Open (or create) a 1:1 DM conversation with another user.",
|
|
1065
|
+
inputSchema: { userId: z.string().describe("Other user ID") }
|
|
1066
|
+
},
|
|
1067
|
+
async ({ userId }) => {
|
|
1068
|
+
try {
|
|
1069
|
+
const data = await ctx.gql.workspace.request(GET_OR_CREATE_DIRECT_CONVERSATION, { userId });
|
|
1070
|
+
return jsonResult(data.getOrCreateDirectConversation);
|
|
1071
|
+
} catch (error) {
|
|
1072
|
+
ctx.logger.error("conversations_get_or_create_direct failed", { error });
|
|
1073
|
+
return errorResult(`Failed to open direct conversation: ${unwrap(error)}`);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
function registerMentionsAndSearchTools(server, ctx, track) {
|
|
1079
|
+
server.registerTool(
|
|
1080
|
+
track(mcpToolName(ctx.productName, "conversations_mentions_list")),
|
|
1081
|
+
{
|
|
1082
|
+
title: "List Mentions",
|
|
1083
|
+
description: "List messages that mention the current actor.",
|
|
1084
|
+
inputSchema: {
|
|
1085
|
+
first: z.number().optional(),
|
|
1086
|
+
after: z.string().optional(),
|
|
1087
|
+
unreadOnly: z.boolean().optional().describe("Only show unread mentions")
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
async ({ first, after, unreadOnly }) => {
|
|
1091
|
+
try {
|
|
1092
|
+
const data = await ctx.gql.workspace.request(LIST_MENTIONS, { first, after, unreadOnly });
|
|
1093
|
+
return jsonResult({
|
|
1094
|
+
items: data.mentions.edges.map((e) => e.node),
|
|
1095
|
+
pageInfo: data.mentions.pageInfo,
|
|
1096
|
+
totalCount: data.mentions.totalCount
|
|
1097
|
+
});
|
|
1098
|
+
} catch (error) {
|
|
1099
|
+
ctx.logger.error("conversations_mentions_list failed", { error });
|
|
1100
|
+
return errorResult(`Failed to list mentions: ${unwrap(error)}`);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
server.registerTool(
|
|
1105
|
+
track(mcpToolName(ctx.productName, "conversations_search")),
|
|
1106
|
+
{
|
|
1107
|
+
title: "Search Conversations",
|
|
1108
|
+
description: "Full-text search across conversations the actor is a member of.",
|
|
1109
|
+
inputSchema: {
|
|
1110
|
+
query: z.string().describe("Search query"),
|
|
1111
|
+
first: z.number().optional(),
|
|
1112
|
+
after: z.string().optional()
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
async ({ query, first, after }) => {
|
|
1116
|
+
try {
|
|
1117
|
+
const data = await ctx.gql.workspace.request(SEARCH_CONVERSATIONS, { query, first, after });
|
|
1118
|
+
return jsonResult({
|
|
1119
|
+
items: data.searchConversations.edges.map((e) => e.node),
|
|
1120
|
+
pageInfo: data.searchConversations.pageInfo,
|
|
1121
|
+
totalCount: data.searchConversations.totalCount
|
|
1122
|
+
});
|
|
1123
|
+
} catch (error) {
|
|
1124
|
+
ctx.logger.error("conversations_search failed", { error });
|
|
1125
|
+
return errorResult(`Failed to search conversations: ${unwrap(error)}`);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
function registerPresenceAndTypingTools(server, ctx, track) {
|
|
1131
|
+
server.registerTool(
|
|
1132
|
+
track(mcpToolName(ctx.productName, "conversations_presence_get")),
|
|
1133
|
+
{
|
|
1134
|
+
title: "Get Presence",
|
|
1135
|
+
description: "Get presence status (online/away/etc) for a set of user IDs.",
|
|
1136
|
+
inputSchema: {
|
|
1137
|
+
userIds: z.array(z.string()).describe("User IDs to look up")
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
async ({ userIds }) => {
|
|
1141
|
+
try {
|
|
1142
|
+
const data = await ctx.gql.workspace.request(GET_PRESENCE, { userIds });
|
|
1143
|
+
return jsonResult({ items: data.presence });
|
|
1144
|
+
} catch (error) {
|
|
1145
|
+
ctx.logger.error("conversations_presence_get failed", { error });
|
|
1146
|
+
return errorResult(`Failed to get presence: ${unwrap(error)}`);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
server.registerTool(
|
|
1151
|
+
track(mcpToolName(ctx.productName, "conversations_presence_update")),
|
|
1152
|
+
{
|
|
1153
|
+
title: "Update Presence",
|
|
1154
|
+
description: "Update the current actor\u2019s presence status and optional custom message.",
|
|
1155
|
+
inputSchema: {
|
|
1156
|
+
status: PresenceStatusEnum,
|
|
1157
|
+
customStatus: z.string().optional()
|
|
1158
|
+
}
|
|
1159
|
+
},
|
|
1160
|
+
async ({ status, customStatus }) => {
|
|
1161
|
+
try {
|
|
1162
|
+
const data = await ctx.gql.workspace.request(UPDATE_PRESENCE, { status, customStatus });
|
|
1163
|
+
return jsonResult(data.updatePresence);
|
|
1164
|
+
} catch (error) {
|
|
1165
|
+
ctx.logger.error("conversations_presence_update failed", { error });
|
|
1166
|
+
return errorResult(`Failed to update presence: ${unwrap(error)}`);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
);
|
|
1170
|
+
server.registerTool(
|
|
1171
|
+
track(mcpToolName(ctx.productName, "conversations_typing_list")),
|
|
1172
|
+
{
|
|
1173
|
+
title: "List Typing Indicators",
|
|
1174
|
+
description: "List users currently typing in a conversation.",
|
|
1175
|
+
inputSchema: { conversationId: z.string() }
|
|
1176
|
+
},
|
|
1177
|
+
async ({ conversationId }) => {
|
|
1178
|
+
try {
|
|
1179
|
+
const data = await ctx.gql.workspace.request(LIST_TYPING_INDICATORS, { conversationId });
|
|
1180
|
+
return jsonResult({ items: data.typingIndicators });
|
|
1181
|
+
} catch (error) {
|
|
1182
|
+
ctx.logger.error("conversations_typing_list failed", { error });
|
|
1183
|
+
return errorResult(`Failed to list typing indicators: ${unwrap(error)}`);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
server.registerTool(
|
|
1188
|
+
track(mcpToolName(ctx.productName, "conversations_typing_start")),
|
|
1189
|
+
{
|
|
1190
|
+
title: "Start Typing",
|
|
1191
|
+
description: "Broadcast that the current actor started typing in a conversation.",
|
|
1192
|
+
inputSchema: { conversationId: z.string() }
|
|
1193
|
+
},
|
|
1194
|
+
async ({ conversationId }) => {
|
|
1195
|
+
try {
|
|
1196
|
+
const data = await ctx.gql.workspace.request(START_TYPING, {
|
|
1197
|
+
conversationId
|
|
1198
|
+
});
|
|
1199
|
+
return jsonResult({ ok: data.startTyping });
|
|
1200
|
+
} catch (error) {
|
|
1201
|
+
ctx.logger.error("conversations_typing_start failed", { error });
|
|
1202
|
+
return errorResult(`Failed to start typing: ${unwrap(error)}`);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
);
|
|
1206
|
+
server.registerTool(
|
|
1207
|
+
track(mcpToolName(ctx.productName, "conversations_typing_stop")),
|
|
1208
|
+
{
|
|
1209
|
+
title: "Stop Typing",
|
|
1210
|
+
description: "Broadcast that the current actor stopped typing in a conversation.",
|
|
1211
|
+
inputSchema: { conversationId: z.string() }
|
|
1212
|
+
},
|
|
1213
|
+
async ({ conversationId }) => {
|
|
1214
|
+
try {
|
|
1215
|
+
const data = await ctx.gql.workspace.request(STOP_TYPING, {
|
|
1216
|
+
conversationId
|
|
1217
|
+
});
|
|
1218
|
+
return jsonResult({ ok: data.stopTyping });
|
|
1219
|
+
} catch (error) {
|
|
1220
|
+
ctx.logger.error("conversations_typing_stop failed", { error });
|
|
1221
|
+
return errorResult(`Failed to stop typing: ${unwrap(error)}`);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1225
|
+
}
|
|
1226
|
+
function registerParticipantTools(server, ctx, track) {
|
|
1227
|
+
server.registerTool(
|
|
1228
|
+
track(mcpToolName(ctx.productName, "conversations_participants_add")),
|
|
1229
|
+
{
|
|
1230
|
+
title: "Add Participant",
|
|
1231
|
+
description: "Add a user to a conversation, optionally with a specific role.",
|
|
1232
|
+
inputSchema: {
|
|
1233
|
+
conversationId: z.string(),
|
|
1234
|
+
userId: z.string(),
|
|
1235
|
+
role: ParticipantRoleEnum.optional()
|
|
1236
|
+
}
|
|
1237
|
+
},
|
|
1238
|
+
async ({ conversationId, userId, role }) => {
|
|
1239
|
+
try {
|
|
1240
|
+
const input = { conversationId, userId };
|
|
1241
|
+
if (role !== void 0) input.role = role;
|
|
1242
|
+
const data = await ctx.gql.workspace.request(ADD_PARTICIPANT, { input });
|
|
1243
|
+
return jsonResult(data.addParticipant);
|
|
1244
|
+
} catch (error) {
|
|
1245
|
+
ctx.logger.error("conversations_participants_add failed", { error });
|
|
1246
|
+
return errorResult(`Failed to add participant: ${unwrap(error)}`);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
);
|
|
1250
|
+
server.registerTool(
|
|
1251
|
+
track(mcpToolName(ctx.productName, "conversations_participants_remove")),
|
|
1252
|
+
{
|
|
1253
|
+
title: "Remove Participant",
|
|
1254
|
+
description: "Remove a user from a conversation.",
|
|
1255
|
+
inputSchema: {
|
|
1256
|
+
conversationId: z.string(),
|
|
1257
|
+
userId: z.string(),
|
|
1258
|
+
reason: z.string().optional()
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
async ({ conversationId, userId, reason }) => {
|
|
1262
|
+
try {
|
|
1263
|
+
const input = { conversationId, userId };
|
|
1264
|
+
if (reason !== void 0) input.reason = reason;
|
|
1265
|
+
const data = await ctx.gql.workspace.request(REMOVE_PARTICIPANT, { input });
|
|
1266
|
+
return jsonResult(data.removeParticipant);
|
|
1267
|
+
} catch (error) {
|
|
1268
|
+
ctx.logger.error("conversations_participants_remove failed", { error });
|
|
1269
|
+
return errorResult(`Failed to remove participant: ${unwrap(error)}`);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
);
|
|
1273
|
+
server.registerTool(
|
|
1274
|
+
track(mcpToolName(ctx.productName, "conversations_participants_update_role")),
|
|
1275
|
+
{
|
|
1276
|
+
title: "Update Participant Role",
|
|
1277
|
+
description: "Change a participant\u2019s role in a conversation.",
|
|
1278
|
+
inputSchema: {
|
|
1279
|
+
conversationId: z.string(),
|
|
1280
|
+
userId: z.string(),
|
|
1281
|
+
role: ParticipantRoleEnum
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
async ({ conversationId, userId, role }) => {
|
|
1285
|
+
try {
|
|
1286
|
+
const data = await ctx.gql.workspace.request(UPDATE_PARTICIPANT_ROLE, { input: { conversationId, userId, role } });
|
|
1287
|
+
return jsonResult(data.updateParticipantRole);
|
|
1288
|
+
} catch (error) {
|
|
1289
|
+
ctx.logger.error("conversations_participants_update_role failed", { error });
|
|
1290
|
+
return errorResult(`Failed to update participant role: ${unwrap(error)}`);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
server.registerTool(
|
|
1295
|
+
track(mcpToolName(ctx.productName, "conversations_leave")),
|
|
1296
|
+
{
|
|
1297
|
+
title: "Leave Conversation",
|
|
1298
|
+
description: "Leave a conversation as the current actor.",
|
|
1299
|
+
inputSchema: { conversationId: z.string() }
|
|
1300
|
+
},
|
|
1301
|
+
async ({ conversationId }) => {
|
|
1302
|
+
try {
|
|
1303
|
+
const data = await ctx.gql.workspace.request(LEAVE_CONVERSATION, { conversationId });
|
|
1304
|
+
return jsonResult(data.leaveConversation);
|
|
1305
|
+
} catch (error) {
|
|
1306
|
+
ctx.logger.error("conversations_leave failed", { error });
|
|
1307
|
+
return errorResult(`Failed to leave conversation: ${unwrap(error)}`);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
function registerConversationActionTools(server, ctx, track) {
|
|
1313
|
+
server.registerTool(
|
|
1314
|
+
track(mcpToolName(ctx.productName, "conversations_archive")),
|
|
1315
|
+
{
|
|
1316
|
+
title: "Archive Conversation",
|
|
1317
|
+
description: "Archive a conversation (state \u2192 ARCHIVED).",
|
|
1318
|
+
inputSchema: { id: z.string().describe("Conversation ID") }
|
|
1319
|
+
},
|
|
1320
|
+
async ({ id }) => {
|
|
1321
|
+
try {
|
|
1322
|
+
const data = await ctx.gql.workspace.request(ARCHIVE_CONVERSATION, { id });
|
|
1323
|
+
return jsonResult(data.archiveConversation);
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
ctx.logger.error("conversations_archive failed", { error });
|
|
1326
|
+
return errorResult(`Failed to archive: ${unwrap(error)}`);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
);
|
|
1330
|
+
server.registerTool(
|
|
1331
|
+
track(mcpToolName(ctx.productName, "conversations_unarchive")),
|
|
1332
|
+
{
|
|
1333
|
+
title: "Unarchive Conversation",
|
|
1334
|
+
description: "Restore an archived conversation.",
|
|
1335
|
+
inputSchema: { id: z.string().describe("Conversation ID") }
|
|
1336
|
+
},
|
|
1337
|
+
async ({ id }) => {
|
|
1338
|
+
try {
|
|
1339
|
+
const data = await ctx.gql.workspace.request(UNARCHIVE_CONVERSATION, { id });
|
|
1340
|
+
return jsonResult(data.unarchiveConversation);
|
|
1341
|
+
} catch (error) {
|
|
1342
|
+
ctx.logger.error("conversations_unarchive failed", { error });
|
|
1343
|
+
return errorResult(`Failed to unarchive: ${unwrap(error)}`);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
);
|
|
1347
|
+
server.registerTool(
|
|
1348
|
+
track(mcpToolName(ctx.productName, "conversations_mute")),
|
|
1349
|
+
{
|
|
1350
|
+
title: "Mute Conversation",
|
|
1351
|
+
description: "Mute notifications for a conversation. Optional `until` (ISO timestamp).",
|
|
1352
|
+
inputSchema: {
|
|
1353
|
+
conversationId: z.string(),
|
|
1354
|
+
until: z.string().optional().describe("ISO timestamp; omit for indefinite mute")
|
|
1355
|
+
}
|
|
1356
|
+
},
|
|
1357
|
+
async ({ conversationId, until }) => {
|
|
1358
|
+
try {
|
|
1359
|
+
const data = await ctx.gql.workspace.request(MUTE_CONVERSATION, { conversationId, until });
|
|
1360
|
+
return jsonResult(data.muteConversation);
|
|
1361
|
+
} catch (error) {
|
|
1362
|
+
ctx.logger.error("conversations_mute failed", { error });
|
|
1363
|
+
return errorResult(`Failed to mute: ${unwrap(error)}`);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
);
|
|
1367
|
+
server.registerTool(
|
|
1368
|
+
track(mcpToolName(ctx.productName, "conversations_unmute")),
|
|
1369
|
+
{
|
|
1370
|
+
title: "Unmute Conversation",
|
|
1371
|
+
description: "Re-enable notifications for a conversation.",
|
|
1372
|
+
inputSchema: { conversationId: z.string().describe("Conversation ID") }
|
|
1373
|
+
},
|
|
1374
|
+
async ({ conversationId }) => {
|
|
1375
|
+
try {
|
|
1376
|
+
const data = await ctx.gql.workspace.request(UNMUTE_CONVERSATION, { conversationId });
|
|
1377
|
+
return jsonResult(data.unmuteConversation);
|
|
1378
|
+
} catch (error) {
|
|
1379
|
+
ctx.logger.error("conversations_unmute failed", { error });
|
|
1380
|
+
return errorResult(`Failed to unmute: ${unwrap(error)}`);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
server.registerTool(
|
|
1385
|
+
track(mcpToolName(ctx.productName, "conversations_pin")),
|
|
1386
|
+
{
|
|
1387
|
+
title: "Pin Conversation",
|
|
1388
|
+
description: "Pin a conversation to the top of the actor\u2019s list.",
|
|
1389
|
+
inputSchema: { conversationId: z.string().describe("Conversation ID") }
|
|
1390
|
+
},
|
|
1391
|
+
async ({ conversationId }) => {
|
|
1392
|
+
try {
|
|
1393
|
+
const data = await ctx.gql.workspace.request(PIN_CONVERSATION, { conversationId });
|
|
1394
|
+
return jsonResult(data.pinConversation);
|
|
1395
|
+
} catch (error) {
|
|
1396
|
+
ctx.logger.error("conversations_pin failed", { error });
|
|
1397
|
+
return errorResult(`Failed to pin: ${unwrap(error)}`);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
);
|
|
1401
|
+
server.registerTool(
|
|
1402
|
+
track(mcpToolName(ctx.productName, "conversations_unpin")),
|
|
1403
|
+
{
|
|
1404
|
+
title: "Unpin Conversation",
|
|
1405
|
+
description: "Unpin a conversation from the actor\u2019s list.",
|
|
1406
|
+
inputSchema: { conversationId: z.string().describe("Conversation ID") }
|
|
1407
|
+
},
|
|
1408
|
+
async ({ conversationId }) => {
|
|
1409
|
+
try {
|
|
1410
|
+
const data = await ctx.gql.workspace.request(UNPIN_CONVERSATION, { conversationId });
|
|
1411
|
+
return jsonResult(data.unpinConversation);
|
|
1412
|
+
} catch (error) {
|
|
1413
|
+
ctx.logger.error("conversations_unpin failed", { error });
|
|
1414
|
+
return errorResult(`Failed to unpin: ${unwrap(error)}`);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
);
|
|
1418
|
+
server.registerTool(
|
|
1419
|
+
track(mcpToolName(ctx.productName, "conversations_mark_as_read")),
|
|
1420
|
+
{
|
|
1421
|
+
title: "Mark Conversation As Read",
|
|
1422
|
+
description: "Mark a conversation as read up to a specific message (defaults to latest).",
|
|
1423
|
+
inputSchema: {
|
|
1424
|
+
conversationId: z.string(),
|
|
1425
|
+
messageId: z.string().optional()
|
|
1426
|
+
}
|
|
1427
|
+
},
|
|
1428
|
+
async ({ conversationId, messageId }) => {
|
|
1429
|
+
try {
|
|
1430
|
+
const data = await ctx.gql.workspace.request(MARK_CONVERSATION_AS_READ, { conversationId, messageId });
|
|
1431
|
+
return jsonResult(data.markConversationAsRead);
|
|
1432
|
+
} catch (error) {
|
|
1433
|
+
ctx.logger.error("conversations_mark_as_read failed", { error });
|
|
1434
|
+
return errorResult(`Failed to mark as read: ${unwrap(error)}`);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
function registerInviteTools(server, ctx, track) {
|
|
1440
|
+
server.registerTool(
|
|
1441
|
+
track(mcpToolName(ctx.productName, "conversations_invites_create")),
|
|
1442
|
+
{
|
|
1443
|
+
title: "Create Invite Link",
|
|
1444
|
+
description: "Mint a shareable invite link/code for a conversation.",
|
|
1445
|
+
inputSchema: {
|
|
1446
|
+
conversationId: z.string(),
|
|
1447
|
+
maxUses: z.number().int().optional(),
|
|
1448
|
+
expiresAt: z.string().optional().describe("ISO timestamp")
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
async ({ conversationId, maxUses, expiresAt }) => {
|
|
1452
|
+
try {
|
|
1453
|
+
const input = { conversationId };
|
|
1454
|
+
if (maxUses !== void 0) input.maxUses = maxUses;
|
|
1455
|
+
if (expiresAt !== void 0) input.expiresAt = expiresAt;
|
|
1456
|
+
const data = await ctx.gql.workspace.request(CREATE_INVITE_LINK, { input });
|
|
1457
|
+
return jsonResult(data.createInviteLink);
|
|
1458
|
+
} catch (error) {
|
|
1459
|
+
ctx.logger.error("conversations_invites_create failed", { error });
|
|
1460
|
+
return errorResult(`Failed to create invite link: ${unwrap(error)}`);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1464
|
+
server.registerTool(
|
|
1465
|
+
track(mcpToolName(ctx.productName, "conversations_invites_join")),
|
|
1466
|
+
{
|
|
1467
|
+
title: "Join Via Invite Link",
|
|
1468
|
+
description: "Redeem an invite code/link and join the conversation.",
|
|
1469
|
+
inputSchema: { code: z.string().describe("Invite code") }
|
|
1470
|
+
},
|
|
1471
|
+
async ({ code }) => {
|
|
1472
|
+
try {
|
|
1473
|
+
const data = await ctx.gql.workspace.request(JOIN_VIA_INVITE_LINK, { code });
|
|
1474
|
+
return jsonResult(data.joinViaInviteLink);
|
|
1475
|
+
} catch (error) {
|
|
1476
|
+
ctx.logger.error("conversations_invites_join failed", { error });
|
|
1477
|
+
return errorResult(`Failed to join via invite link: ${unwrap(error)}`);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
);
|
|
1481
|
+
server.registerTool(
|
|
1482
|
+
track(mcpToolName(ctx.productName, "conversations_invites_validate")),
|
|
1483
|
+
{
|
|
1484
|
+
title: "Validate Invite Link",
|
|
1485
|
+
description: "Check whether an invite code is currently valid; returns conversation preview.",
|
|
1486
|
+
inputSchema: { code: z.string().describe("Invite code") }
|
|
1487
|
+
},
|
|
1488
|
+
async ({ code }) => {
|
|
1489
|
+
try {
|
|
1490
|
+
const data = await ctx.gql.workspace.request(VALIDATE_INVITE_LINK, { code });
|
|
1491
|
+
return jsonResult(data.validateInviteLink);
|
|
1492
|
+
} catch (error) {
|
|
1493
|
+
ctx.logger.error("conversations_invites_validate failed", { error });
|
|
1494
|
+
return errorResult(`Failed to validate invite link: ${unwrap(error)}`);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
);
|
|
1498
|
+
}
|
|
1499
|
+
function registerPollAndNotificationTools(server, ctx, track) {
|
|
1500
|
+
server.registerTool(
|
|
1501
|
+
track(mcpToolName(ctx.productName, "conversations_polls_vote")),
|
|
1502
|
+
{
|
|
1503
|
+
title: "Vote in Poll",
|
|
1504
|
+
description: "Cast a vote (one or more options) on a poll attached to a message.",
|
|
1505
|
+
inputSchema: {
|
|
1506
|
+
pollId: z.string(),
|
|
1507
|
+
optionIds: z.array(z.string()).describe("Option IDs to vote for")
|
|
1508
|
+
}
|
|
1509
|
+
},
|
|
1510
|
+
async ({ pollId, optionIds }) => {
|
|
1511
|
+
try {
|
|
1512
|
+
const data = await ctx.gql.workspace.request(
|
|
1513
|
+
VOTE_POLL,
|
|
1514
|
+
{ pollId, optionIds }
|
|
1515
|
+
);
|
|
1516
|
+
return jsonResult(data.votePoll);
|
|
1517
|
+
} catch (error) {
|
|
1518
|
+
ctx.logger.error("conversations_polls_vote failed", { error });
|
|
1519
|
+
return errorResult(`Failed to vote: ${unwrap(error)}`);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
);
|
|
1523
|
+
server.registerTool(
|
|
1524
|
+
track(mcpToolName(ctx.productName, "conversations_notifications_update")),
|
|
1525
|
+
{
|
|
1526
|
+
title: "Update Notification Settings",
|
|
1527
|
+
description: "Update notification level (ALL | MENTIONS | MUTED | NONE) for a conversation membership.",
|
|
1528
|
+
inputSchema: {
|
|
1529
|
+
conversationId: z.string(),
|
|
1530
|
+
notificationLevel: NotificationLevelExtEnum
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
async ({ conversationId, notificationLevel }) => {
|
|
1534
|
+
try {
|
|
1535
|
+
const data = await ctx.gql.workspace.request(UPDATE_NOTIFICATION_SETTINGS, {
|
|
1536
|
+
input: { conversationId, notificationLevel }
|
|
1537
|
+
});
|
|
1538
|
+
return jsonResult(data.updateNotificationSettings);
|
|
1539
|
+
} catch (error) {
|
|
1540
|
+
ctx.logger.error("conversations_notifications_update failed", { error });
|
|
1541
|
+
return errorResult(`Failed to update notification settings: ${unwrap(error)}`);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
function registerPollingTools(server, ctx, track) {
|
|
1547
|
+
server.registerTool(
|
|
1548
|
+
track(mcpToolName(ctx.productName, "conversations_messages_check")),
|
|
1549
|
+
{
|
|
1550
|
+
title: "Check for New Messages (poll)",
|
|
1551
|
+
description: "Polling substitute for the messageAdded / messageUpdated / messageDeleted subscriptions. Returns recent messages in a conversation; clients should call repeatedly with the last seen cursor.",
|
|
1552
|
+
inputSchema: {
|
|
1553
|
+
conversationId: z.string().describe("Conversation ID"),
|
|
1554
|
+
first: z.number().optional().describe("Page size (default 20)"),
|
|
1555
|
+
after: z.string().optional().describe("Cursor from the previous poll")
|
|
1556
|
+
}
|
|
1557
|
+
},
|
|
1558
|
+
async ({ conversationId, first, after }) => {
|
|
1559
|
+
try {
|
|
1560
|
+
const data = await ctx.gql.workspace.request(LIST_MESSAGES, { conversationId, first: first ?? 20, after });
|
|
1561
|
+
return jsonResult({
|
|
1562
|
+
items: data.messages.edges.map((e) => e.node),
|
|
1563
|
+
pageInfo: data.messages.pageInfo
|
|
1564
|
+
});
|
|
1565
|
+
} catch (error) {
|
|
1566
|
+
ctx.logger.error("conversations_messages_check failed", { error });
|
|
1567
|
+
return errorResult(`Failed to poll messages: ${unwrap(error)}`);
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
);
|
|
397
1571
|
}
|
|
398
1572
|
|
|
399
1573
|
// src/modules/conversations/index.ts
|