@utaba/ucm-mcp-server
Version:
Universal Context Manager MCP Server - AI Productivity Platform
93 lines • 4.3 kB
JavaScript
import { BaseToolController } from '../base/BaseToolController.js';
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
export class DeleteRepositoryGuidanceTool extends BaseToolController {
baseUrl;
constructor(ucmClient, logger, publishingAuthorId, baseUrl) {
super(ucmClient, logger, publishingAuthorId);
this.baseUrl = baseUrl;
}
get name() {
return 'ucm_delete_repository_guidance';
}
get description() {
return `Provides guidance for deleting a repository via the web UI.`;
}
get inputSchema() {
return {
type: 'object',
properties: {
author: {
type: 'string',
description: this.publishingAuthorId ? `Author identifier: ${this.publishingAuthorId}` : 'Author identifier (e.g., "utaba", "1064600359")',
minLength: 1,
maxLength: 50
},
repository: {
type: 'string',
description: 'Repository name to delete (e.g., "main", "project-alpha")',
minLength: 1,
maxLength: 200
}
},
required: ['author', 'repository'],
additionalProperties: false
};
}
validateParams(params) {
super.validateParams(params);
if (!params.author || typeof params.author !== 'string' || params.author.trim() === '') {
throw new McpError(McpErrorCode.InvalidParams, 'Author identifier is required and cannot be empty');
}
if (!params.repository || typeof params.repository !== 'string' || params.repository.trim() === '') {
throw new McpError(McpErrorCode.InvalidParams, 'Repository name is required and cannot be empty');
}
}
async handleExecute(params) {
this.logger.info('DeleteRepositoryGuidanceTool', `Providing delete guidance for repository ${params.repository} for author ${params.author}`);
// Get the base URL for the web interface
const baseUrl = this.baseUrl;
const repositorySettingsUrl = `${baseUrl}/repository/${params.repository}/settings`;
const browseUrl = `${baseUrl}/browse/${params.author}`;
const guidance = {
action: 'delete_repository_guidance',
repository: {
author: params.author,
name: params.repository
},
message: `Repository deletion must be performed through the web interface for safety.`,
reason: 'Repository deletion is intentionally not available through MCP tools to prevent accidental deletion of valuable content.',
instructions: [
`1. Open the repository settings page: ${repositorySettingsUrl}`,
`2. Scroll to the "Danger Zone" section`,
`3. Click "Delete Repository" button`,
`4. Confirm the deletion by typing the repository name`,
`5. Click "Delete" to permanently remove the repository`
],
urls: {
repositorySettings: repositorySettingsUrl,
authorRepositories: browseUrl
},
warnings: [
'Repository deletion is permanent and cannot be undone',
'All artifacts and content in the repository will be permanently lost',
'Any links or references to this repository will become invalid',
'Make sure to backup any important content before deletion'
],
alternatives: [
'Consider renaming the repository instead of deleting it',
'Archive the repository by updating its description to indicate it is archived',
'Move important artifacts to another repository before deletion'
]
};
this.logger.info('DeleteRepositoryGuidanceTool', `Delete guidance provided for repository: ${params.repository}`);
return {
content: [
{
type: 'text',
text: JSON.stringify(guidance, null, 2)
}
]
};
}
}
//# sourceMappingURL=DeleteRepositoryGuidanceTool.js.map