UNPKG

groove-mcp

Version:

Model Context Protocol server for Groove HQ

50 lines 1.88 kB
import { queries, mutations } from '../utils/graphql-queries.js'; export class ConversationTools { client; constructor(client) { this.client = client; } async listConversations(args) { const variables = { first: args.limit || 20, status: args.status?.toUpperCase(), assigneeId: args.assigneeId, contactId: args.contactId, tagIds: args.tagIds, }; const response = await this.client.request(queries.listConversations, variables); return response.conversations.edges.map(edge => edge.node); } async getConversation(id) { const response = await this.client.request(queries.getConversation, { id }); return response.conversation; } async createConversation(args) { const input = { contactId: args.contactId, subject: args.subject, body: args.body, assigneeId: args.assigneeId, tagIds: args.tagIds, }; const response = await this.client.request(mutations.createConversation, { input }); return response.createConversation.conversation; } async updateConversation(args) { const input = {}; if (args.status) input.status = args.status.toUpperCase(); if (args.assigneeId !== undefined) input.assigneeId = args.assigneeId; if (args.tagIds) input.tagIds = args.tagIds; if (args.snoozedUntil) input.snoozedUntil = args.snoozedUntil; const response = await this.client.request(mutations.updateConversation, { id: args.id, input }); return response.updateConversation.conversation; } async closeConversation(id) { return this.updateConversation({ id, status: 'closed' }); } } //# sourceMappingURL=conversations.js.map