UNPKG

groove-mcp

Version:

Model Context Protocol server for Groove HQ

56 lines 2.02 kB
import { queries } from '../utils/graphql-queries.js'; export class KnowledgeBaseResources { client; constructor(client) { this.client = client; } async listArticles(args = {}) { const variables = { categoryId: args.categoryId, published: args.published, featured: args.featured, first: args.limit || 20, after: args.after, }; const response = await this.client.request(queries.listKbArticles, variables); return response.knowledgeBaseArticles.edges.map(edge => edge.node); } async getArticle(id) { const response = await this.client.request(queries.getKbArticle, { id }); return response.knowledgeBaseArticle; } async listCategories() { const response = await this.client.request(queries.listKbCategories); return response.knowledgeBaseCategories; } async searchArticles(args) { const variables = { query: args.query, first: args.limit || 20, after: args.after, }; const response = await this.client.request(queries.searchKbArticles, variables); return response.searchKnowledgeBaseArticles.edges.map(edge => edge.node); } // Helper method to build resource URIs buildResourceUri(type, id) { return `groove://kb/${type}/${id}`; } // Format article for MCP resource formatArticleResource(article) { return { uri: this.buildResourceUri('article', article.id), name: article.title, description: article.bodyPlainText?.substring(0, 200) + '...' || '', mimeType: 'text/markdown', metadata: { category: article.category?.name, views: article.views, helpful: article.helpfulVotes, published: article.published, featured: article.featured, }, }; } } //# sourceMappingURL=kb-articles.js.map