groove-mcp
Version:
Model Context Protocol server for Groove HQ
50 lines • 1.79 kB
JavaScript
import { queries, mutations } from '../utils/graphql-queries.js';
export class ContactTools {
client;
constructor(client) {
this.client = client;
}
async listContacts(args = {}) {
const variables = {
first: args.limit || 20,
after: args.after,
search: args.search,
};
const response = await this.client.request(queries.listContacts, variables);
return response.contacts.edges.map(edge => edge.node);
}
async getContact(id) {
const response = await this.client.request(queries.getContact, { id });
return response.contact;
}
async createContact(args) {
const input = {
email: args.email,
firstName: args.firstName,
lastName: args.lastName,
company: args.company,
title: args.title,
phone: args.phone,
};
const response = await this.client.request(mutations.createContact, { input });
return response.createContact.contact;
}
async updateContact(args) {
const input = {};
if (args.email !== undefined)
input.email = args.email;
if (args.firstName !== undefined)
input.firstName = args.firstName;
if (args.lastName !== undefined)
input.lastName = args.lastName;
if (args.company !== undefined)
input.company = args.company;
if (args.title !== undefined)
input.title = args.title;
if (args.phone !== undefined)
input.phone = args.phone;
const response = await this.client.request(mutations.updateContact, { id: args.id, input });
return response.updateContact.contact;
}
}
//# sourceMappingURL=contacts.js.map