ucm-mcp-server
Version: 
Universal Context Manager MCP Server - AI-native artifact management
48 lines • 2.04 kB
JavaScript
import { BaseToolController } from '../base/BaseToolController.js';
export class AuthorRecentsTool extends BaseToolController {
    constructor(ucmClient, logger, publishingAuthorId) {
        super(ucmClient, logger, publishingAuthorId);
    }
    get name() {
        return 'ucm_get_author_recents';
    }
    get description() {
        return `Generate author activity tracking showing the 20 most recently modified artifacts within an author context. 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('AuthorRecentsTool', `Retrieving author recents for: ${author}`);
        try {
            // Get author recent activity content from API
            const authorRecentsContent = await this.ucmClient.getAuthorRecents(author);
            this.logger.info('AuthorRecentsTool', 'Author recents retrieved successfully', '', {
                author,
                contentLength: authorRecentsContent.length,
                source: `UCM API /api/v1/resources/author/${author}/recents`
            });
            return authorRecentsContent;
        }
        catch (error) {
            let errorMessage = `Failed to retrieve author recents 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('AuthorRecentsTool', `${errorMessage}`, '', error);
            throw error;
        }
    }
}
//# sourceMappingURL=AuthorRecentsTool.js.map