UNPKG

mcp-quickbase

Version:

Work with Quickbase via Model Context Protocol

87 lines 2.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateAppTool = void 0; const base_1 = require("../base"); const logger_1 = require("../../utils/logger"); const logger = (0, logger_1.createLogger)("CreateAppTool"); /** * Tool for creating a new Quickbase application */ class CreateAppTool extends base_1.BaseTool { /** * Constructor * @param client Quickbase client */ constructor(client) { super(client); this.name = "create_app"; this.description = "Creates a new Quickbase application. Only use this tool when explicitly asked to create a new application."; /** * Parameter schema for create_app */ this.paramSchema = { type: "object", properties: { name: { type: "string", description: "Name of the application", }, description: { type: "string", description: "Description of the application", }, options: { type: "object", description: "Additional options for app creation", }, }, required: ["name"], }; } /** * Run the create_app tool * @param params Tool parameters * @returns Created application details */ async run(params) { logger.info("Creating new Quickbase application", { name: params.name }); const { name, description, options } = params; // Prepare request body const body = { name, description: description || "", }; // Add any additional options if (options) { Object.assign(body, options); } // Create the application const response = await this.client.request({ method: "POST", path: "/apps", body, }); if (!response.success || !response.data) { logger.error("Failed to create application", { error: response.error, params, }); throw new Error(response.error?.message || "Failed to create application"); } const app = response.data; logger.info("Successfully created application", { appId: app.id, name: app.name, }); return { appId: app.id, name: app.name, description: app.description, created: app.created, appUrl: app.url, ...app, }; } } exports.CreateAppTool = CreateAppTool; //# sourceMappingURL=create_app.js.map