UNPKG

ucm-mcp-server

Version:

Universal Context Manager MCP Server - AI-native artifact management

48 lines 2.02 kB
import { BaseToolController } from '../base/BaseToolController.js'; export class AuthorIndexTool extends BaseToolController { constructor(ucmClient, logger, publishingAuthorId) { super(ucmClient, logger, publishingAuthorId); } get name() { return 'ucm_get_author_index'; } get description() { return `Discover a dynamic markdown index guide for AI assistants working with an author\'s content. Your author id is '${this.publishingAuthorId}'`; } get inputSchema() { return { type: 'object', properties: { author: { type: 'string', description: `Author identifier: ${this.publishingAuthorId || '1234567890'}` } }, required: ['author'] }; } async handleExecute(params) { const { author } = params; this.logger.debug('AuthorIndexTool', `Retrieving author index for: ${author}`); try { // Get author index content from API (author-level index, not repository-specific) const authorIndexContent = await this.ucmClient.getAuthorIndex(author); this.logger.info('AuthorIndexTool', 'Author index retrieved successfully', '', { author, contentLength: authorIndexContent.length, source: `UCM API /api/v1/authors/${author}/index` }); return authorIndexContent; } catch (error) { let errorMessage = `Failed to retrieve author index for ${author}.`; if (this.publishingAuthorId && author != this.publishingAuthorId) { errorMessage += ` did you mean '${this.publishingAuthorId}'`; error.message = error.message += ` did you mean '${this.publishingAuthorId}'`; } this.logger.error('AuthorIndexTool', `${errorMessage}`, '', error); throw error; } } } //# sourceMappingURL=AuthorIndexTool.js.map