UNPKG

@utaba/ucm-mcp-server

Version:

Universal Context Manager MCP Server - AI Productivity Platform

67 lines 2.69 kB
import { BaseToolController } from '../base/BaseToolController.js'; export class ListRepositoriesTool extends BaseToolController { constructor(ucmClient, logger, publishingAuthorId) { super(ucmClient, logger, publishingAuthorId); } get name() { return 'ucm_list_repositories'; } get description() { return 'List all repositories for a specific author with pagination and statistics'; } get inputSchema() { return { type: 'object', properties: { author: { type: 'string', description: `Author identifier (e.g., "${this.publishingAuthorId || '1234567890'}")`, minLength: 1, maxLength: 50 }, offset: { type: 'number', description: 'Number of items to skip for pagination (default: 0)', minimum: 0 }, limit: { type: 'number', description: 'Maximum number of items to return (default: 20, max: 100)', minimum: 1, maximum: 100 } }, required: ['author'] }; } async handleExecute(params) { const { author, offset, limit } = params; this.logger.debug('ListRepositoriesTool', `Listing repositories for author: ${author}`, '', { offset: offset || 0, limit: limit || 'default' }); try { // Use listRepositories to get repositories for the author const response = await this.ucmClient.listRepositories(author, offset, limit); this.logger.info('ListRepositoriesTool', `Listed ${response.data.length} repositories for author: ${author}`, '', { total: response.pagination?.total, offset: response.pagination?.offset, limit: response.pagination?.limit }); // Return the full response with pagination metadata and context return { author, listingType: 'repositories', data: response.data, pagination: response.pagination, hasMore: response.pagination.offset + response.pagination.limit < response.pagination.total, _links: response._links }; } catch (error) { this.logger.error('ListRepositoriesTool', `Failed to list repositories for author: ${author}`, '', error); throw error; } } } //# sourceMappingURL=ListRepositoriesTool.js.map