@utaba/ucm-mcp-server
Version:
Universal Context Manager MCP Server - AI-native artifact management
32 lines • 1.14 kB
JavaScript
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
export class BaseToolController {
ucmClient;
logger;
publishingAuthorId;
constructor(ucmClient, logger, publishingAuthorId) {
this.ucmClient = ucmClient;
this.logger = logger;
this.publishingAuthorId = publishingAuthorId;
}
async execute(params) {
try {
this.validateParams(params);
return await this.handleExecute(params);
}
catch (error) {
this.logger.error('BaseToolController', `Tool ${this.name} execution failed`, '', error);
throw error;
}
}
validateParams(params) {
// Basic validation - can be overridden by specific tools
if (this.inputSchema.required) {
for (const field of this.inputSchema.required) {
if (params[field] === undefined || params[field] === null) {
throw new McpError(McpErrorCode.InvalidParams, `Required parameter '${field}' is missing`);
}
}
}
}
}
//# sourceMappingURL=BaseToolController.js.map