UNPKG

businessmap-mcp

Version:

MCP server for Businessmap Kanbanize, exposing tools for managing business entities like boards, cards, and columns, facilitating LLM interaction.

59 lines (58 loc) 2.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CardCoOwnersToolsController = void 0; const zod_1 = require("zod"); const ApiService_1 = require("../../services/ApiService"); const apiResponseHandler_1 = require("../../utils/apiResponseHandler"); const env_1 = require("../../utils/env"); class CardCoOwnersToolsController { server; constructor(server) { this.server = server; this.registerTools(); } registerTools() { this.registerGetCardCoOwnersToolhandler(); this.registerCheckCardCoOwnerToolhandler(); if (!env_1.env.BUSINESSMAP_READ_ONLY) { this.registerAddCardCoOwnerToolhandler(); this.registerRemoveCardCoOwnerToolhandler(); } } registerGetCardCoOwnersToolhandler() { this.server.tool("get-card-co-owners", "Get a card's co-owners", { cardId: zod_1.z.string().describe("A card id"), }, async ({ cardId }) => { const response = await ApiService_1.apiServices.getCardCoOwners(cardId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerCheckCardCoOwnerToolhandler() { this.server.tool("check-card-co-owner", "Check if a user is a co-owner of a card, the user is a co-owner of the card! Otherwise, you would have gotten a 404 error.", { cardId: zod_1.z.string().describe("A card id"), userId: zod_1.z.string().describe("A user id"), }, async ({ cardId, userId }) => { const response = await ApiService_1.apiServices.checkCardCoOwner(cardId, userId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerAddCardCoOwnerToolhandler() { this.server.tool("add-card-co-owner", "Add a user as a co-owner of a card", { cardId: zod_1.z.string().describe("A card id"), userId: zod_1.z.string().describe("A user id"), }, async ({ cardId, userId }) => { const response = await ApiService_1.apiServices.addCardCoOwner(cardId, userId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerRemoveCardCoOwnerToolhandler() { this.server.tool("remove-card-co-owner", "Remove a user as a co-owner of a card", { cardId: zod_1.z.string().describe("A card id"), userId: zod_1.z.string().describe("A user id"), }, async ({ cardId, userId }) => { const response = await ApiService_1.apiServices.removeCardCoOwner(cardId, userId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } } exports.CardCoOwnersToolsController = CardCoOwnersToolsController;