UNPKG

businessmap-mcp

Version:

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

71 lines (70 loc) 3.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CardSubtasksToolsController = 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 CardSubtasksToolsController { server; constructor(server) { this.server = server; this.registerTools(); } registerTools() { this.registerGetCardSubtasksToolhandler(); this.registerGetCardSubtaskToolhandler(); if (!env_1.env.BUSINESSMAP_READ_ONLY) { this.registerAddCardSubtaskToolhandler(); this.registerUpdateCardSubtaskToolhandler(); this.registerDeleteCardSubtaskToolhandler(); } } registerGetCardSubtasksToolhandler() { this.server.tool("get-card-subtasks", "Get a card's subtasks", { cardId: zod_1.z.string().describe("A card id"), }, async ({ cardId }) => { const response = await ApiService_1.apiServices.getCardSubtasks(cardId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerAddCardSubtaskToolhandler() { this.server.tool("add-card-subtask", "Add a subtask to a card", { cardId: zod_1.z.string().describe("A card id"), description: zod_1.z.string().describe("A description the subtask"), }, async ({ cardId, description }) => { const response = await ApiService_1.apiServices.addCardSubtask(cardId, description); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerGetCardSubtaskToolhandler() { this.server.tool("get-card-subtask", "Get the details of a subtask for a card", { cardId: zod_1.z.string().describe("A card id"), subtaskId: zod_1.z.string().describe("A subtask id"), }, async ({ cardId, subtaskId }) => { const response = await ApiService_1.apiServices.getCardSubtask(cardId, subtaskId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerUpdateCardSubtaskToolhandler() { this.server.tool("update-card-subtask", "Update the details of a subtask for a card", { cardId: zod_1.z.string().describe("A card id"), subtaskId: zod_1.z.string().describe("A subtask id"), description: zod_1.z.string().describe("A description the subtask"), isFinished: zod_1.z.number().min(0).max(1), }, async ({ cardId, subtaskId, description, isFinished }) => { const response = await ApiService_1.apiServices.updateCardSubtask(cardId, subtaskId, description, isFinished); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } registerDeleteCardSubtaskToolhandler() { this.server.tool("delete-card-subtask", "Delete a subtask for a card", { cardId: zod_1.z.string().describe("A card id"), subtaskId: zod_1.z.string().describe("A subtask id"), }, async ({ cardId, subtaskId }) => { const response = await ApiService_1.apiServices.deleteCardSubtask(cardId, subtaskId); return (0, apiResponseHandler_1.handleApiResponse)(response); }); } } exports.CardSubtasksToolsController = CardSubtasksToolsController;